fix clang build fail

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2021-12-10 12:57:45 +08:00
parent 4a2fa5d0aa
commit 889b3b76da

View file

@ -655,7 +655,6 @@ int mbedtls_ssl_tls13_calculate_verify_data( mbedtls_ssl_context* ssl,
size_t transcript_len;
unsigned char *base_key = NULL;
size_t base_key_len;
mbedtls_md_type_t const md_type = ssl->handshake->ciphersuite_info->mac;
const mbedtls_md_info_t* const md_info =
@ -678,15 +677,9 @@ int mbedtls_ssl_tls13_calculate_verify_data( mbedtls_ssl_context* ssl,
MBEDTLS_SSL_DEBUG_BUF( 4, "handshake hash", transcript, transcript_len );
if( from == MBEDTLS_SSL_IS_CLIENT )
{
base_key = ssl->handshake->tls13_hs_secrets.client_handshake_traffic_secret;
base_key_len = sizeof( ssl->handshake->tls13_hs_secrets.client_handshake_traffic_secret );
}
else
{
base_key = ssl->handshake->tls13_hs_secrets.server_handshake_traffic_secret;
base_key_len = sizeof( ssl->handshake->tls13_hs_secrets.server_handshake_traffic_secret );
}
ret = ssl_tls13_calc_finished_core( md_type, base_key, transcript, dst );
if( ret != 0 )
@ -698,7 +691,10 @@ int mbedtls_ssl_tls13_calculate_verify_data( mbedtls_ssl_context* ssl,
exit:
/* Erase handshake secrets */
mbedtls_platform_zeroize( base_key, base_key_len );
if( from == MBEDTLS_SSL_IS_CLIENT )
mbedtls_platform_zeroize( base_key, sizeof( ssl->handshake->tls13_hs_secrets.client_handshake_traffic_secret ) );
else
mbedtls_platform_zeroize( base_key, sizeof( ssl->handshake->tls13_hs_secrets.server_handshake_traffic_secret ) );
mbedtls_platform_zeroize( transcript, sizeof( transcript ) );
return( ret );
}