tls: remove dependency from mbedtls_ecp_curve functions
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit is contained in:
parent
b402e4bde1
commit
18c9fed857
7 changed files with 238 additions and 80 deletions
|
@ -230,9 +230,8 @@ static int ssl_tls13_get_default_group_id( mbedtls_ssl_context *ssl,
|
|||
|
||||
for ( ; *group_list != 0; group_list++ )
|
||||
{
|
||||
const mbedtls_ecp_curve_info *curve_info;
|
||||
curve_info = mbedtls_ecp_curve_info_from_tls_id( *group_list );
|
||||
if( curve_info != NULL &&
|
||||
if( ( mbedtls_ssl_get_psa_curve_info_from_tls_id( *group_list,
|
||||
NULL, NULL ) == PSA_SUCCESS ) &&
|
||||
mbedtls_ssl_tls13_named_group_is_ecdhe( *group_list ) )
|
||||
{
|
||||
*group_id = *group_list;
|
||||
|
@ -385,7 +384,6 @@ static int ssl_tls13_parse_hrr_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
const unsigned char *end )
|
||||
{
|
||||
#if defined(MBEDTLS_ECDH_C)
|
||||
const mbedtls_ecp_curve_info *curve_info = NULL;
|
||||
const unsigned char *p = buf;
|
||||
int selected_group;
|
||||
int found = 0;
|
||||
|
@ -412,8 +410,9 @@ static int ssl_tls13_parse_hrr_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
*/
|
||||
for( ; *group_list != 0; group_list++ )
|
||||
{
|
||||
curve_info = mbedtls_ecp_curve_info_from_tls_id( *group_list );
|
||||
if( curve_info == NULL || curve_info->tls_id != selected_group )
|
||||
if( ( mbedtls_ssl_get_psa_curve_info_from_tls_id( *group_list,
|
||||
NULL, NULL ) == PSA_ERROR_NOT_SUPPORTED ) ||
|
||||
*group_list != selected_group )
|
||||
continue;
|
||||
|
||||
/* We found a match */
|
||||
|
@ -493,15 +492,15 @@ static int ssl_tls13_parse_key_share_ext( mbedtls_ssl_context *ssl,
|
|||
#if defined(MBEDTLS_ECDH_C)
|
||||
if( mbedtls_ssl_tls13_named_group_is_ecdhe( group ) )
|
||||
{
|
||||
const mbedtls_ecp_curve_info *curve_info =
|
||||
mbedtls_ecp_curve_info_from_tls_id( group );
|
||||
if( curve_info == NULL )
|
||||
if( mbedtls_ssl_get_psa_curve_info_from_tls_id( group, NULL, NULL )
|
||||
== PSA_ERROR_NOT_SUPPORTED )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Invalid TLS curve group id" ) );
|
||||
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
||||
}
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "ECDH curve: %s", curve_info->name ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "ECDH curve: %s",
|
||||
mbedtls_ssl_get_curve_name_from_tls_id( group ) ) );
|
||||
|
||||
ret = mbedtls_ssl_tls13_read_public_ecdhe_share( ssl, p, end - p );
|
||||
if( ret != 0 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue