From 6b5c9a3744e9547c59abb873bc744425951fd654 Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Mon, 21 Dec 2020 08:02:59 -0500 Subject: [PATCH] Add an "SSL" infix to MBEDTLS_EARLY_KEY_COMPUTATION Signed-off-by: Andrzej Kurek --- configs/baremetal.h | 2 +- include/mbedtls/check_config.h | 4 ++-- include/mbedtls/config.h | 4 ++-- include/mbedtls/ssl_internal.h | 4 ++-- library/ssl_cli.c | 8 ++++---- library/version_features.c | 6 +++--- programs/ssl/query_config.c | 8 ++++---- scripts/config.pl | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/configs/baremetal.h b/configs/baremetal.h index 038b06026..3c59bb926 100644 --- a/configs/baremetal.h +++ b/configs/baremetal.h @@ -166,7 +166,7 @@ #define MBEDTLS_DELAYED_SERVER_CERT_VERIFICATION #define MBEDTLS_SSL_FREE_SERVER_CERTIFICATE #define MBEDTLS_SSL_IMMEDIATE_TRANSMISSION -#define MBEDTLS_EARLY_KEY_COMPUTATION +#define MBEDTLS_SSL_EARLY_KEY_COMPUTATION #if defined(MBEDTLS_USER_CONFIG_FILE) #include MBEDTLS_USER_CONFIG_FILE diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h index 97dcc02c2..2a2f19c14 100644 --- a/include/mbedtls/check_config.h +++ b/include/mbedtls/check_config.h @@ -915,8 +915,8 @@ #endif -#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) && !defined(MBEDTLS_USE_TINYCRYPT) -#error "MBEDTLS_EARLY_KEY_COMPUTATION can only be used with MBEDTLS_USE_TINYCRYPT" +#if defined(MBEDTLS_SSL_EARLY_KEY_COMPUTATION) && !defined(MBEDTLS_USE_TINYCRYPT) +#error "MBEDTLS_SSL_EARLY_KEY_COMPUTATION can only be used with MBEDTLS_USE_TINYCRYPT" #endif /* diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index 0fca50a89..d9b69224a 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -1625,14 +1625,14 @@ //#define MBEDTLS_SSL_IMMEDIATE_TRANSMISSION /** - * \def MBEDTLS_EARLY_KEY_COMPUTATION + * \def MBEDTLS_SSL_EARLY_KEY_COMPUTATION * * Create ephemeral Diffie-Hellman key pair after * the ClientHello has been successfully transmitted. * * Requires: */ -//#define MBEDTLS_EARLY_KEY_COMPUTATION +//#define MBEDTLS_SSL_EARLY_KEY_COMPUTATION /** * \def MBEDTLS_SSL_HW_RECORD_ACCEL diff --git a/include/mbedtls/ssl_internal.h b/include/mbedtls/ssl_internal.h index bd2169ef3..5d8f6fdbd 100644 --- a/include/mbedtls/ssl_internal.h +++ b/include/mbedtls/ssl_internal.h @@ -573,10 +573,10 @@ struct mbedtls_ssl_handshake_params #if defined(MBEDTLS_USE_TINYCRYPT) uint8_t ecdh_privkey[NUM_ECC_BYTES]; -#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) +#if defined(MBEDTLS_SSL_EARLY_KEY_COMPUTATION) uint8_t ecdhe_computed; uint8_t ecdh_publickey[2*NUM_ECC_BYTES]; -#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */ +#endif /* MBEDTLS_SSL_EARLY_KEY_COMPUTATION */ uint8_t ecdh_peerkey[2*NUM_ECC_BYTES]; #endif /* MBEDTLS_USE_TINYCRYPT */ diff --git a/library/ssl_cli.c b/library/ssl_cli.c index bde7d10ff..ba6a806e4 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -3667,7 +3667,7 @@ static int ssl_out_client_key_exchange_write( mbedtls_ssl_context *ssl, *p++ = 2 * NUM_ECC_BYTES + 1; *p++ = 0x04; /* uncompressed point presentation */ -#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) +#if defined(MBEDTLS_SSL_EARLY_KEY_COMPUTATION) mbedtls_platform_memcpy( p, ssl->handshake->ecdh_publickey, 2 * NUM_ECC_BYTES ); #else @@ -3676,7 +3676,7 @@ static int ssl_out_client_key_exchange_write( mbedtls_ssl_context *ssl, return( MBEDTLS_ERR_PLATFORM_FAULT_DETECTED ); if( ret != UECC_SUCCESS ) return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED ); -#endif /* MBEDTLS_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */ +#endif /* MBEDTLS_SSL_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */ p += 2 * NUM_ECC_BYTES; } else @@ -4282,7 +4282,7 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl ) * ServerHelloDone */ case MBEDTLS_SSL_SERVER_HELLO: -#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) && defined(MBEDTLS_USE_TINYCRYPT) +#if defined(MBEDTLS_SSL_EARLY_KEY_COMPUTATION) && defined(MBEDTLS_USE_TINYCRYPT) /* Make sure that the ECDHE pre-computation is only done once */ if( ssl->handshake->ecdhe_computed == 0 ) { @@ -4293,7 +4293,7 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl ) return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED ); ssl->handshake->ecdhe_computed = 1; } -#endif /* MBEDTLS_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */ +#endif /* MBEDTLS_SSL_EARLY_KEY_COMPUTATION && MBEDTLS_USE_TINYCRYPT */ ret = ssl_parse_server_hello( ssl ); break; diff --git a/library/version_features.c b/library/version_features.c index 11045f8bc..0ada3c672 100644 --- a/library/version_features.c +++ b/library/version_features.c @@ -498,9 +498,9 @@ static const char *features[] = { #if defined(MBEDTLS_SSL_IMMEDIATE_TRANSMISSION) "MBEDTLS_SSL_IMMEDIATE_TRANSMISSION", #endif /* MBEDTLS_SSL_IMMEDIATE_TRANSMISSION */ -#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) - "MBEDTLS_EARLY_KEY_COMPUTATION", -#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */ +#if defined(MBEDTLS_SSL_EARLY_KEY_COMPUTATION) + "MBEDTLS_SSL_EARLY_KEY_COMPUTATION", +#endif /* MBEDTLS_SSL_EARLY_KEY_COMPUTATION */ #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) "MBEDTLS_SSL_HW_RECORD_ACCEL", #endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */ diff --git a/programs/ssl/query_config.c b/programs/ssl/query_config.c index 6f4e67fb3..1f8ae210c 100644 --- a/programs/ssl/query_config.c +++ b/programs/ssl/query_config.c @@ -1370,13 +1370,13 @@ int query_config( const char *config ) } #endif /* MBEDTLS_SSL_IMMEDIATE_TRANSMISSION */ -#if defined(MBEDTLS_EARLY_KEY_COMPUTATION) - if( strcmp( "MBEDTLS_EARLY_KEY_COMPUTATION", config ) == 0 ) +#if defined(MBEDTLS_SSL_EARLY_KEY_COMPUTATION) + if( strcmp( "MBEDTLS_SSL_EARLY_KEY_COMPUTATION", config ) == 0 ) { - MACRO_EXPANSION_TO_STR( MBEDTLS_EARLY_KEY_COMPUTATION ); + MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_EARLY_KEY_COMPUTATION ); return( 0 ); } -#endif /* MBEDTLS_EARLY_KEY_COMPUTATION */ +#endif /* MBEDTLS_SSL_EARLY_KEY_COMPUTATION */ #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) if( strcmp( "MBEDTLS_SSL_HW_RECORD_ACCEL", config ) == 0 ) diff --git a/scripts/config.pl b/scripts/config.pl index 1fc156cbd..d2af5a475 100755 --- a/scripts/config.pl +++ b/scripts/config.pl @@ -65,7 +65,7 @@ # MBEDTLS_DELAYED_SERVER_CERT_VERIFICATION # MBEDTLS_SSL_FREE_SERVER_CERTIFICATE # MBEDTLS_SSL_IMMEDIATE_TRANSMISSION -# MBEDTLS_EARLY_KEY_COMPUTATION +# MBEDTLS_SSL_EARLY_KEY_COMPUTATION # and any symbol beginning _ALT # # The baremetal configuration excludes options that require a library or @@ -157,7 +157,7 @@ MBEDTLS_PLATFORM_FAULT_CALLBACKS MBEDTLS_DELAYED_SERVER_CERT_VERIFICATION MBEDTLS_SSL_FREE_SERVER_CERTIFICATE MBEDTLS_SSL_IMMEDIATE_TRANSMISSION -MBEDTLS_EARLY_KEY_COMPUTATION +MBEDTLS_SSL_EARLY_KEY_COMPUTATION _ALT\s*$ );