mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-29 12:32:48 +00:00
Add ECJPAKE key exchange
This commit is contained in:
parent
294139b57a
commit
557535d8c4
@ -192,6 +192,12 @@
|
|||||||
#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
|
#error "MBEDTLS_KEY_EXCHANGE_RSA_ENABLED defined, but not all prerequisites"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \
|
||||||
|
( !defined(MBEDTLS_ECJPAKE_C) || !defined(MBEDTLS_SHA256_C) || \
|
||||||
|
!defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) )
|
||||||
|
#error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
|
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
|
||||||
( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
|
( !defined(MBEDTLS_PLATFORM_C) || !defined(MBEDTLS_PLATFORM_MEMORY) )
|
||||||
#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
|
#error "MBEDTLS_MEMORY_BUFFER_ALLOC_C defined, but not all prerequisites"
|
||||||
|
@ -694,6 +694,23 @@
|
|||||||
*/
|
*/
|
||||||
#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
|
#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
|
*
|
||||||
|
* Enable the ECJPAKE based ciphersuite modes in SSL / TLS.
|
||||||
|
*
|
||||||
|
* \warning Those are currently experimental.
|
||||||
|
*
|
||||||
|
* Requires: MBEDTLS_ECJPAKE_C
|
||||||
|
* MBEDTLS_SHA256_C
|
||||||
|
* MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||||
|
*
|
||||||
|
* This enables the following ciphersuites (if other requisites are
|
||||||
|
* enabled as well):
|
||||||
|
* MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
|
||||||
|
*/
|
||||||
|
#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def MBEDTLS_PK_PARSE_EC_EXTENDED
|
* \def MBEDTLS_PK_PARSE_EC_EXTENDED
|
||||||
*
|
*
|
||||||
|
@ -389,6 +389,9 @@ union mbedtls_ssl_premaster_secret
|
|||||||
unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
|
unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
|
||||||
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
|
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
|
unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
|
#define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
|
||||||
|
@ -244,6 +244,7 @@ typedef enum {
|
|||||||
MBEDTLS_KEY_EXCHANGE_ECDHE_PSK,
|
MBEDTLS_KEY_EXCHANGE_ECDHE_PSK,
|
||||||
MBEDTLS_KEY_EXCHANGE_ECDH_RSA,
|
MBEDTLS_KEY_EXCHANGE_ECDH_RSA,
|
||||||
MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA,
|
MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA,
|
||||||
|
MBEDTLS_KEY_EXCHANGE_ECJPAKE,
|
||||||
} mbedtls_key_exchange_type_t;
|
} mbedtls_key_exchange_type_t;
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
|
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
|
||||||
|
@ -1556,7 +1556,7 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
|||||||
break;
|
break;
|
||||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \
|
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C)
|
||||||
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
|
case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS:
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
|
||||||
|
|
||||||
|
@ -7160,6 +7160,7 @@ int mbedtls_ssl_check_cert_usage( const mbedtls_x509_crt *cert,
|
|||||||
case MBEDTLS_KEY_EXCHANGE_PSK:
|
case MBEDTLS_KEY_EXCHANGE_PSK:
|
||||||
case MBEDTLS_KEY_EXCHANGE_DHE_PSK:
|
case MBEDTLS_KEY_EXCHANGE_DHE_PSK:
|
||||||
case MBEDTLS_KEY_EXCHANGE_ECDHE_PSK:
|
case MBEDTLS_KEY_EXCHANGE_ECDHE_PSK:
|
||||||
|
case MBEDTLS_KEY_EXCHANGE_ECJPAKE:
|
||||||
usage = 0;
|
usage = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,6 +264,9 @@ static const char *features[] = {
|
|||||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED)
|
||||||
"MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED",
|
"MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED",
|
||||||
#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED */
|
#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED */
|
||||||
|
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||||
|
"MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED",
|
||||||
|
#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||||
#if defined(MBEDTLS_PK_PARSE_EC_EXTENDED)
|
#if defined(MBEDTLS_PK_PARSE_EC_EXTENDED)
|
||||||
"MBEDTLS_PK_PARSE_EC_EXTENDED",
|
"MBEDTLS_PK_PARSE_EC_EXTENDED",
|
||||||
#endif /* MBEDTLS_PK_PARSE_EC_EXTENDED */
|
#endif /* MBEDTLS_PK_PARSE_EC_EXTENDED */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user