From 29efc0f37d86385d947cd517dec173c2ca9b54be Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Thu, 7 May 2020 10:54:43 +0200 Subject: [PATCH] Remove unnecessary MBEDTLS_ECP_C preprocessor condition The ssl_cli.c:ssl_write_supported_elliptic_curves_ext() function is compiled only if MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C or MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED is defined which implies that MBEDTLS_ECP_C is defined. Thus remove the precompiler conditions on MBEDTLS_ECP_C in its code. Signed-off-by: Ronald Cron --- library/ssl_cli.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 5798b3c16..1e4e32d99 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -268,30 +268,18 @@ static void ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl, unsigned char *elliptic_curve_list = p + 6; size_t elliptic_curve_len = 0; const mbedtls_ecp_curve_info *info; -#if defined(MBEDTLS_ECP_C) const mbedtls_ecp_group_id *grp_id; -#else - ((void) ssl); -#endif *olen = 0; MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding supported_elliptic_curves extension" ) ); -#if defined(MBEDTLS_ECP_C) for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ ) -#else - for( info = mbedtls_ecp_curve_list(); - info->grp_id != MBEDTLS_ECP_DP_NONE; - info++ ) -#endif { -#if defined(MBEDTLS_ECP_C) info = mbedtls_ecp_curve_info_from_grp_id( *grp_id ); -#endif if( info == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, @@ -310,19 +298,11 @@ static void ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl, elliptic_curve_len = 0; -#if defined(MBEDTLS_ECP_C) for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ ) -#else - for( info = mbedtls_ecp_curve_list(); - info->grp_id != MBEDTLS_ECP_DP_NONE; - info++ ) -#endif { -#if defined(MBEDTLS_ECP_C) info = mbedtls_ecp_curve_info_from_grp_id( *grp_id ); -#endif elliptic_curve_list[elliptic_curve_len++] = info->tls_id >> 8; elliptic_curve_list[elliptic_curve_len++] = info->tls_id & 0xFF; }