1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Update mbedtls_ssl_handshake_free()

Signed-off-by: Xiaofei Bai <xiaofei.bai@arm.com>
This commit is contained in:
Xiaofei Bai
2022-01-28 08:52:13 +00:00
parent f5b4d25cfa
commit 6d42bb430c
3 changed files with 28 additions and 14 deletions

View File

@ -1473,7 +1473,7 @@ static int ssl_tls13_parse_certificate_request( mbedtls_ssl_context *ssl,
mbedtls_ssl_handshake_params *handshake = ssl->handshake;
handshake->certificate_request_context =
mbedtls_calloc( 1, certificate_request_context_len);
mbedtls_calloc( 1, certificate_request_context_len );
if( handshake->certificate_request_context == NULL )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "buffer too small" ) );
@ -1523,7 +1523,11 @@ static int ssl_tls13_parse_certificate_request( mbedtls_ssl_context *ssl,
{
MBEDTLS_SSL_DEBUG_MSG( 3,
( "Duplicate signature algorithms extensions found" ) );
goto error;
MBEDTLS_SSL_PEND_FATAL_ALERT(
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR,
MBEDTLS_ERR_SSL_DECODE_ERROR );
mbedtls_ssl_handshake_free( ssl );
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
}
break;
@ -1541,24 +1545,27 @@ static int ssl_tls13_parse_certificate_request( mbedtls_ssl_context *ssl,
{
MBEDTLS_SSL_DEBUG_MSG( 1,
( "Signature algorithms extension length misaligned" ) );
goto error;
MBEDTLS_SSL_PEND_FATAL_ALERT( MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR,
MBEDTLS_ERR_SSL_DECODE_ERROR );
mbedtls_ssl_handshake_free( ssl );
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
}
/* Check that we found signature algorithms extension */
if( ! sig_alg_ext_found )
{
MBEDTLS_SSL_DEBUG_MSG( 3,
( "no signature algorithms extension found" ) );
goto error;
MBEDTLS_SSL_DEBUG_MSG( 3,
( "no signature algorithms extension found" ) );
MBEDTLS_SSL_DEBUG_MSG( 1,
( "Signature algorithms extension length misaligned" ) );
MBEDTLS_SSL_PEND_FATAL_ALERT( MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR,
MBEDTLS_ERR_SSL_DECODE_ERROR );
mbedtls_ssl_handshake_free( ssl );
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
}
ssl->client_auth = 1;
return( 0 );
error:
MBEDTLS_SSL_PEND_FATAL_ALERT( MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR,
MBEDTLS_ERR_SSL_DECODE_ERROR );
mbedtls_free( ssl->handshake->certificate_request_context );
return( MBEDTLS_ERR_SSL_DECODE_ERROR );
}
/*