mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Merge pull request #8697 from BensonLiou/random_bye_on_hrr
Do not generate new random number while receiving HRR
This commit is contained in:
3
ChangeLog.d/fix-new-rn-on-hrr.txt
Normal file
3
ChangeLog.d/fix-new-rn-on-hrr.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Bugfix
|
||||
* In TLS 1.3 clients, fix an interoperability problem due to the client
|
||||
generating a new random after a HelloRetryRequest. Fixes #8669.
|
@ -790,6 +790,10 @@ static int ssl_prepare_client_hello(mbedtls_ssl_context *ssl)
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
if ((ssl->conf->transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM) ||
|
||||
(ssl->handshake->cookie == NULL))
|
||||
#endif
|
||||
{
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
if (!ssl->handshake->hello_retry_request_flag)
|
||||
#endif
|
||||
{
|
||||
ret = ssl_generate_random(ssl);
|
||||
@ -798,6 +802,7 @@ static int ssl_prepare_client_hello(mbedtls_ssl_context *ssl)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare session identifier. At that point, the length of the session
|
||||
|
@ -3850,6 +3850,7 @@ void tls13_cli_early_data_state(int scenario)
|
||||
MBEDTLS_SSL_IANA_TLS_GROUP_SECP384R1,
|
||||
MBEDTLS_SSL_IANA_TLS_GROUP_NONE
|
||||
};
|
||||
uint8_t client_random[MBEDTLS_CLIENT_HELLO_RANDOM_LEN];
|
||||
|
||||
mbedtls_platform_zeroize(&client_ep, sizeof(client_ep));
|
||||
mbedtls_platform_zeroize(&server_ep, sizeof(server_ep));
|
||||
@ -3987,9 +3988,16 @@ void tls13_cli_early_data_state(int scenario)
|
||||
if (!client_ep.ssl.handshake->hello_retry_request_flag) {
|
||||
TEST_EQUAL(client_ep.ssl.early_data_state,
|
||||
MBEDTLS_SSL_EARLY_DATA_STATE_CAN_WRITE);
|
||||
memcpy(client_random,
|
||||
client_ep.ssl.handshake->randbytes,
|
||||
MBEDTLS_CLIENT_HELLO_RANDOM_LEN);
|
||||
} else {
|
||||
TEST_EQUAL(client_ep.ssl.early_data_state,
|
||||
MBEDTLS_SSL_EARLY_DATA_STATE_REJECTED);
|
||||
TEST_MEMORY_COMPARE(client_random,
|
||||
MBEDTLS_CLIENT_HELLO_RANDOM_LEN,
|
||||
client_ep.ssl.handshake->randbytes,
|
||||
MBEDTLS_CLIENT_HELLO_RANDOM_LEN);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user