fix various issues

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-05-06 11:16:55 +08:00
parent e110d258d9
commit f86eb75c58
4 changed files with 10 additions and 10 deletions

View file

@ -1237,10 +1237,11 @@ static int ssl_tls13_postprocess_server_hello( mbedtls_ssl_context *ssl )
goto cleanup;
}
ret = mbedtls_ssl_tls13_set_handshake_transform( ssl );
ret = mbedtls_ssl_tls13_compute_handshake_transform( ssl );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_tls13_set_handshake_transform",
MBEDTLS_SSL_DEBUG_RET( 1,
"mbedtls_ssl_tls13_compute_handshake_transform",
ret );
goto cleanup;
}

View file

@ -1511,7 +1511,7 @@ int mbedtls_ssl_tls13_generate_application_keys(
return( ret );
}
int mbedtls_ssl_tls13_set_handshake_transform( mbedtls_ssl_context *ssl )
int mbedtls_ssl_tls13_compute_handshake_transform( mbedtls_ssl_context *ssl )
{
int ret;
mbedtls_ssl_key_set traffic_keys;
@ -1558,9 +1558,7 @@ int mbedtls_ssl_tls13_set_handshake_transform( mbedtls_ssl_context *ssl )
cleanup:
mbedtls_platform_zeroize( &traffic_keys, sizeof( traffic_keys ) );
if( ret != 0 )
{
mbedtls_free( transform_handshake );
}
return( ret );
}

View file

@ -641,13 +641,13 @@ int mbedtls_ssl_tls13_calculate_verify_data( mbedtls_ssl_context *ssl,
/**
* \brief Compute TLS 1.3 handshake transform
*
* \param ssl The SSL context to operate on. The early secrtet must have been
* \param ssl The SSL context to operate on. The early secret must have been
* computed.
*
* \returns \c 0 on success.
* \returns A negative error code on failure.
*/
int mbedtls_ssl_tls13_set_handshake_transform( mbedtls_ssl_context *ssl );
int mbedtls_ssl_tls13_compute_handshake_transform( mbedtls_ssl_context *ssl );
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */

View file

@ -1029,10 +1029,11 @@ static int ssl_tls13_write_server_hello_body( mbedtls_ssl_context *ssl,
static int ssl_tls13_finalize_write_server_hello( mbedtls_ssl_context *ssl )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
ret = mbedtls_ssl_tls13_set_handshake_transform( ssl );
ret = mbedtls_ssl_tls13_compute_handshake_transform( ssl );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_tls13_set_handshake_transform",
MBEDTLS_SSL_DEBUG_RET( 1,
"mbedtls_ssl_tls13_compute_handshake_transform",
ret );
return( ret );
}
@ -1040,7 +1041,7 @@ static int ssl_tls13_finalize_write_server_hello( mbedtls_ssl_context *ssl )
mbedtls_ssl_set_outbound_transform( ssl,
ssl->handshake->transform_handshake );
MBEDTLS_SSL_DEBUG_MSG(
3, ( "switching to new transform spec for outbound data" ) );
3, ( "switching to handshake transform for outbound data" ) );
return( ret );
}