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 <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-05-07 10:54:43 +02:00
parent 8cf6b49e6d
commit 29efc0f37d

View file

@ -268,30 +268,18 @@ static void ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl,
unsigned char *elliptic_curve_list = p + 6; unsigned char *elliptic_curve_list = p + 6;
size_t elliptic_curve_len = 0; size_t elliptic_curve_len = 0;
const mbedtls_ecp_curve_info *info; const mbedtls_ecp_curve_info *info;
#if defined(MBEDTLS_ECP_C)
const mbedtls_ecp_group_id *grp_id; const mbedtls_ecp_group_id *grp_id;
#else
((void) ssl);
#endif
*olen = 0; *olen = 0;
MBEDTLS_SSL_DEBUG_MSG( 3, MBEDTLS_SSL_DEBUG_MSG( 3,
( "client hello, adding supported_elliptic_curves extension" ) ); ( "client hello, adding supported_elliptic_curves extension" ) );
#if defined(MBEDTLS_ECP_C)
for( grp_id = ssl->conf->curve_list; for( grp_id = ssl->conf->curve_list;
*grp_id != MBEDTLS_ECP_DP_NONE; *grp_id != MBEDTLS_ECP_DP_NONE;
grp_id++ ) 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 ); info = mbedtls_ecp_curve_info_from_grp_id( *grp_id );
#endif
if( info == NULL ) if( info == NULL )
{ {
MBEDTLS_SSL_DEBUG_MSG( 1, 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; elliptic_curve_len = 0;
#if defined(MBEDTLS_ECP_C)
for( grp_id = ssl->conf->curve_list; for( grp_id = ssl->conf->curve_list;
*grp_id != MBEDTLS_ECP_DP_NONE; *grp_id != MBEDTLS_ECP_DP_NONE;
grp_id++ ) 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 ); 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 >> 8;
elliptic_curve_list[elliptic_curve_len++] = info->tls_id & 0xFF; elliptic_curve_list[elliptic_curve_len++] = info->tls_id & 0xFF;
} }