Skip to content

Commit

Permalink
fix ci fail without ECDH_C
Browse files Browse the repository at this point in the history
Signed-off-by: Jerry Yu <[email protected]>
  • Loading branch information
yuhaoth committed Sep 8, 2021
1 parent ca61d38 commit 7b8fdc7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions library/ssl_tls13_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,20 @@ static int ssl_tls13_write_key_share_ext( mbedtls_ssl_context *ssl,
return( ret );
}

#if (defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C))
#if defined(MBEDTLS_ECDH_C)

/* TODO: Code for MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED missing */
static int check_ecdh_params( const mbedtls_ssl_context *ssl )
{
const mbedtls_ecp_curve_info *curve_info;
mbedtls_ecp_group_id grp_id;
#if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
grp_id = ssl->handshake->ecdh_ctx.grp.id;
#else
grp_id = ssl->handshake->ecdh_ctx.grp_id;
#endif

curve_info = mbedtls_ecp_curve_info_from_grp_id( ssl->handshake->ecdh_ctx.grp_id );
curve_info = mbedtls_ecp_curve_info_from_grp_id( grp_id );
if( curve_info == NULL )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
Expand All @@ -497,7 +503,7 @@ static int check_ecdh_params( const mbedtls_ssl_context *ssl )
MBEDTLS_SSL_DEBUG_MSG( 2, ( "ECDH curve: %s", curve_info->name ) );

#if defined(MBEDTLS_ECP_C)
if( mbedtls_ssl_check_curve( ssl, ssl->handshake->ecdh_ctx.grp_id ) != 0 )
if( mbedtls_ssl_check_curve( ssl, grp_id ) != 0 )
#else
if( ssl->handshake->ecdh_ctx.grp.nbits < 163 ||
ssl->handshake->ecdh_ctx.grp.nbits > 521 )
Expand Down

0 comments on commit 7b8fdc7

Please sign in to comment.