Refine the state change after write client hello

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
Xiaokang Qian 2023-02-02 06:57:26 +00:00
parent 7892b6caad
commit 44051f6376

View file

@ -963,17 +963,18 @@ int mbedtls_ssl_write_client_hello(mbedtls_ssl_context *ssl)
buf_len,
msg_len));
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
if (mbedtls_ssl_conf_is_tls12_only(ssl->conf)) {
mbedtls_ssl_handshake_set_state(ssl, MBEDTLS_SSL_SERVER_HELLO);
} else
#endif
{
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
mbedtls_ssl_tls13_finalize_write_client_hello(ssl);
#endif
}
/*
* Set next state. Note that if TLS 1.3 is proposed, this may be
* overwritten by mbedtls_ssl_tls13_finalize_write_client_hello().
*/
mbedtls_ssl_handshake_set_state(ssl, MBEDTLS_SSL_SERVER_HELLO);
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
if (ssl->handshake->min_tls_version <= MBEDTLS_SSL_VERSION_TLS1_3 &&
MBEDTLS_SSL_VERSION_TLS1_3 <= ssl->tls_version) {
ret = mbedtls_ssl_tls13_finalize_write_client_hello(ssl);
}
#endif
}
cleanup: