mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-12 10:13:39 +00:00
Use mbedtls_psa_parse_tls_ecc_group() instead PSA_KEY_TYPE_ECC_KEY_PAIR( mbedtls_ecc_group_to_psa() )
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
0a60c129de
commit
a21af3da00
@ -3119,17 +3119,12 @@ curve_matching_done:
|
|||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Perform PSA-based ECDH computation." ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Perform PSA-based ECDH computation." ) );
|
||||||
|
|
||||||
/* Convert EC group to PSA key type. */
|
/* Convert EC group to PSA key type. */
|
||||||
if( ( handshake->ecdh_psa_type =
|
handshake->ecdh_psa_type = mbedtls_psa_parse_tls_ecc_group(
|
||||||
PSA_KEY_TYPE_ECC_KEY_PAIR( mbedtls_ecc_group_to_psa(
|
(*curve)->tls_id, &ecdh_bits );
|
||||||
(*curve)->grp_id, &ecdh_bits ) ) ) == 0 )
|
|
||||||
{
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Could not convert ECC group to PSA." ) );
|
|
||||||
return( MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ecdh_bits > 0xffff )
|
if( handshake->ecdh_psa_type == 0 || ecdh_bits > 0xffff )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Invalid ecdh_bits." ) );
|
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Invalid ecc group parse." ) );
|
||||||
return( MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER );
|
return( MBEDTLS_ERR_SSL_ILLEGAL_PARAMETER );
|
||||||
}
|
}
|
||||||
handshake->ecdh_bits = (uint16_t) ecdh_bits;
|
handshake->ecdh_bits = (uint16_t) ecdh_bits;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user