tls13: Move state transition after sending CCS to ssl_tls13_client.c
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
a55c5a1152
commit
d4c64027a5
2 changed files with 20 additions and 23 deletions
|
@ -1628,6 +1628,7 @@ static int ssl_tls13_process_certificate_verify( mbedtls_ssl_context *ssl )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
#endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handler for MBEDTLS_SSL_SERVER_FINISHED
|
* Handler for MBEDTLS_SSL_SERVER_FINISHED
|
||||||
*/
|
*/
|
||||||
|
@ -1650,6 +1651,24 @@ static int ssl_tls13_process_server_finished( mbedtls_ssl_context *ssl )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handler for MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED
|
||||||
|
*/
|
||||||
|
#if defined(MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE)
|
||||||
|
static int ssl_tls13_write_change_cipher_spec( mbedtls_ssl_context *ssl )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = mbedtls_ssl_tls13_write_change_cipher_spec( ssl );
|
||||||
|
if( ret != 0 )
|
||||||
|
return( ret );
|
||||||
|
|
||||||
|
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_FINISHED );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handler for MBEDTLS_SSL_CLIENT_FINISHED
|
* Handler for MBEDTLS_SSL_CLIENT_FINISHED
|
||||||
*/
|
*/
|
||||||
|
@ -1754,7 +1773,7 @@ int mbedtls_ssl_tls13_handshake_client_step( mbedtls_ssl_context *ssl )
|
||||||
*/
|
*/
|
||||||
#if defined(MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE)
|
#if defined(MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE)
|
||||||
case MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED:
|
case MBEDTLS_SSL_CLIENT_CCS_AFTER_SERVER_FINISHED:
|
||||||
ret = mbedtls_ssl_tls13_write_change_cipher_spec( ssl );
|
ret = ssl_tls13_write_change_cipher_spec( ssl );
|
||||||
break;
|
break;
|
||||||
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
#endif /* MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE */
|
||||||
|
|
||||||
|
|
|
@ -1169,26 +1169,6 @@ static int ssl_tls13_write_change_cipher_spec_body( mbedtls_ssl_context *ssl,
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssl_tls13_finalize_change_cipher_spec( mbedtls_ssl_context *ssl )
|
|
||||||
{
|
|
||||||
#if defined(MBEDTLS_SSL_SRV_C)
|
|
||||||
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER )
|
|
||||||
{
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
|
|
||||||
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_SSL_SRV_C */
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_CLI_C)
|
|
||||||
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT )
|
|
||||||
{
|
|
||||||
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_CLIENT_FINISHED );
|
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_SSL_CLI_C */
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
int mbedtls_ssl_tls13_write_change_cipher_spec( mbedtls_ssl_context *ssl )
|
int mbedtls_ssl_tls13_write_change_cipher_spec( mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
|
@ -1205,8 +1185,6 @@ int mbedtls_ssl_tls13_write_change_cipher_spec( mbedtls_ssl_context *ssl )
|
||||||
|
|
||||||
ssl->out_msgtype = MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC;
|
ssl->out_msgtype = MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC;
|
||||||
|
|
||||||
MBEDTLS_SSL_PROC_CHK( ssl_tls13_finalize_change_cipher_spec( ssl ) );
|
|
||||||
|
|
||||||
/* Dispatch message */
|
/* Dispatch message */
|
||||||
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_write_record( ssl, 1 ) );
|
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_write_record( ssl, 1 ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue