fix various issues

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-05-18 13:59:24 +08:00
parent 36becb1b81
commit d6e253ded9
3 changed files with 9 additions and 19 deletions

View file

@ -1186,7 +1186,6 @@ static int ssl_tls13_postprocess_finished_message( mbedtls_ssl_context *ssl )
int ret; int ret;
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER ) if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER )
{ {
/* Compute resumption_master_secret */
ret = mbedtls_ssl_tls13_generate_resumption_master_secret( ssl ); ret = mbedtls_ssl_tls13_generate_resumption_master_secret( ssl );
if( ret != 0 ) if( ret != 0 )
{ {
@ -1271,7 +1270,6 @@ static int ssl_tls13_finalize_finished_message( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_CLI_C) #if defined(MBEDTLS_SSL_CLI_C)
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT ) if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT )
{ {
/* Compute resumption_master_secret */
ret = mbedtls_ssl_tls13_generate_resumption_master_secret( ssl ); ret = mbedtls_ssl_tls13_generate_resumption_master_secret( ssl );
if( ret != 0 ) if( ret != 0 )
{ {

View file

@ -621,7 +621,7 @@ int mbedtls_ssl_tls13_generate_application_keys(
* \returns A negative error code on failure. * \returns A negative error code on failure.
*/ */
int mbedtls_ssl_tls13_generate_resumption_master_secret( int mbedtls_ssl_tls13_generate_resumption_master_secret(
mbedtls_ssl_context* ssl ); mbedtls_ssl_context *ssl );
/** /**
* \brief Calculate the verify_data value for the client or server TLS 1.3 * \brief Calculate the verify_data value for the client or server TLS 1.3

View file

@ -1477,11 +1477,11 @@ static int ssl_tls13_write_certificate_verify( mbedtls_ssl_context *ssl )
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */ #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
/* /*
* State Handler: MBEDTLS_SSL_SERVER_FINISHED * Handler for MBEDTLS_SSL_SERVER_FINISHED
*/ */
static int ssl_tls13_write_server_finished( mbedtls_ssl_context *ssl ) static int ssl_tls13_write_server_finished( mbedtls_ssl_context *ssl )
{ {
int ret; int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
ret = mbedtls_ssl_tls13_write_finished_message( ssl ); ret = mbedtls_ssl_tls13_write_finished_message( ssl );
if( ret != 0 ) if( ret != 0 )
@ -1492,34 +1492,26 @@ static int ssl_tls13_write_server_finished( mbedtls_ssl_context *ssl )
} }
/* /*
* State Handler: MBEDTLS_SSL_CLIENT_FINISHED * Handler for MBEDTLS_SSL_CLIENT_FINISHED
*/ */
static int ssl_tls13_process_client_finished( mbedtls_ssl_context *ssl ) static int ssl_tls13_process_client_finished( mbedtls_ssl_context *ssl )
{ {
int ret; int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
MBEDTLS_SSL_DEBUG_MSG( 1, MBEDTLS_SSL_DEBUG_MSG( 1,
( "Switch to handshake traffic keys for outbound traffic" ) ); ( "Switch to handshake traffic keys for inbound traffic" ) );
mbedtls_ssl_set_inbound_transform( ssl, ssl->handshake->transform_handshake ); mbedtls_ssl_set_inbound_transform( ssl, ssl->handshake->transform_handshake );
ret = mbedtls_ssl_tls13_process_finished_message( ssl ); ret = mbedtls_ssl_tls13_process_finished_message( ssl );
if( ret != 0 ) if( ret != 0 )
return( ret ); return( ret );
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_HANDSHAKE_WRAPUP ); mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_HANDSHAKE_WRAPUP );
return( 0 ); return( 0 );
} }
/* /*
* State Handler: MBEDTLS_SSL_FLUSH_BUFFERS * Handler for MBEDTLS_SSL_HANDSHAKE_WRAPUP
*/
static int ssl_tls13_flush_buffers( mbedtls_ssl_context *ssl )
{
((void) ssl);
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
}
/*
* State Handler: MBEDTLS_SSL_HANDSHAKE_WRAPUP
*/ */
static int ssl_tls13_handshake_wrapup( mbedtls_ssl_context *ssl ) static int ssl_tls13_handshake_wrapup( mbedtls_ssl_context *ssl )
{ {