1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Revert "move ciphersuite validation to set_session"

This reverts commit 19ae6f62c7.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu
2022-10-08 10:30:53 +08:00
parent 379b91a393
commit 21f9095fa8
5 changed files with 9 additions and 55 deletions

View File

@ -1485,36 +1485,4 @@ int mbedtls_ssl_tls13_generate_and_write_ecdh_key_exchange(
}
#endif /* MBEDTLS_ECDH_C */
int mbedtls_ssl_tls13_ciphersuite_to_alg( mbedtls_ssl_context *ssl,
int ciphersuite,
psa_algorithm_t *psa_alg )
{
const mbedtls_ssl_ciphersuite_t *ciphersuite_info = NULL;
psa_algorithm_t alg;
ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( ciphersuite );
if( psa_alg )
*psa_alg = PSA_ALG_NONE;
if( mbedtls_ssl_validate_ciphersuite(
ssl, ciphersuite_info,
MBEDTLS_SSL_VERSION_TLS1_3,
MBEDTLS_SSL_VERSION_TLS1_3 ) != 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 4, ( "%d is not valid.", ciphersuite ) );
return( MBEDTLS_ERR_SSL_INVALID_MAC );
}
alg = mbedtls_psa_translate_md( ciphersuite_info->mac );
if( alg == PSA_ALG_NONE )
{
MBEDTLS_SSL_DEBUG_MSG( 4, ( "%d is not valid.", ciphersuite ) );
return( MBEDTLS_ERR_SSL_INVALID_MAC );
}
if( psa_alg )
*psa_alg = alg;
return( 0 );
}
#endif /* MBEDTLS_SSL_TLS_C && MBEDTLS_SSL_PROTO_TLS1_3 */