Add dummy state for client_certifiate

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu 2022-01-26 15:41:22 +08:00
parent 960bc28bcc
commit 566c781290
2 changed files with 47 additions and 3 deletions

View file

@ -1916,8 +1916,13 @@ static int ssl_tls13_process_server_finished( mbedtls_ssl_context *ssl )
ssl, ssl,
MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED ); MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED );
#else #else
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
if( ssl->handshake->client_auth )
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_CERTIFICATE );
else
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_FINISHED ); mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_FINISHED );
#endif #endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
return( 0 ); return( 0 );
} }
@ -1938,6 +1943,25 @@ static int ssl_tls13_write_change_cipher_spec( mbedtls_ssl_context *ssl )
} }
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */ #endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
/*
* Handler for MBEDTLS_SSL_CLIENT_CERTIFICATE
*/
static int ssl_tls13_write_client_certificate( mbedtls_ssl_context *ssl )
{
mbedtls_ssl_set_outbound_transform( ssl, ssl->handshake->transform_handshake );
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY );
return( 0 );
}
/*
* Handler for MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY
*/
static int ssl_tls13_write_client_certificate_verify( mbedtls_ssl_context *ssl )
{
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_FINISHED );
return( 0 );
}
/* /*
* Handler for MBEDTLS_SSL_CLIENT_FINISHED * Handler for MBEDTLS_SSL_CLIENT_FINISHED
*/ */
@ -2027,6 +2051,15 @@ int mbedtls_ssl_tls13_handshake_client_step( mbedtls_ssl_context *ssl )
ret = ssl_tls13_process_server_finished( ssl ); ret = ssl_tls13_process_server_finished( ssl );
break; break;
case MBEDTLS_SSL_CLIENT_CERTIFICATE:
ret = ssl_tls13_write_client_certificate( ssl );
break;
case MBEDTLS_SSL_CLIENT_CERTIFICATE_VERIFY:
ret = ssl_tls13_write_client_certificate_verify( ssl );
break;
case MBEDTLS_SSL_CLIENT_FINISHED: case MBEDTLS_SSL_CLIENT_FINISHED:
ret = ssl_tls13_write_client_finished( ssl ); ret = ssl_tls13_write_client_finished( ssl );
break; break;

View file

@ -1142,7 +1142,18 @@ static int ssl_tls13_finalize_change_cipher_spec( mbedtls_ssl_context* ssl )
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_HELLO ); mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_HELLO );
break; break;
case MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED: case MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED:
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_FINISHED ); #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
if( ssl->handshake->client_auth )
{
mbedtls_ssl_handshake_set_state( ssl,
MBEDTLS_SSL_CLIENT_CERTIFICATE );
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
{
mbedtls_ssl_handshake_set_state( ssl,
MBEDTLS_SSL_CLIENT_FINISHED );
}
break; break;
default: default:
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );