diff --git a/library/ssl_misc.h b/library/ssl_misc.h index 4d8c479d4..941e79674 100644 --- a/library/ssl_misc.h +++ b/library/ssl_misc.h @@ -1631,7 +1631,7 @@ static inline int mbedtls_ssl_conf_is_hybrid_tls12_tls13( const mbedtls_ssl_conf #endif /* MBEDTLS_SSL_PROTO_TLS1_2 && MBEDTLS_SSL_PROTO_TLS1_3 */ #if defined(MBEDTLS_SSL_PROTO_TLS1_3) - +extern const uint8_t mbedtls_ssl_tls13_hello_retry_request_magic[32]; int mbedtls_ssl_tls13_process_finished_message( mbedtls_ssl_context *ssl ); int mbedtls_ssl_tls13_write_finished_message( mbedtls_ssl_context *ssl ); void mbedtls_ssl_tls13_handshake_wrapup( mbedtls_ssl_context *ssl ); diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c index 59e42c868..320c5b4b2 100644 --- a/library/ssl_tls13_client.c +++ b/library/ssl_tls13_client.c @@ -750,11 +750,6 @@ static int ssl_server_hello_is_hrr( mbedtls_ssl_context *ssl, const unsigned char *buf, const unsigned char *end ) { - static const unsigned char magic_hrr_string[MBEDTLS_SERVER_HELLO_RANDOM_LEN] = - { 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, - 0xBE, 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91, - 0xC2, 0xA2, 0x11, 0x16, 0x7A, 0xBB, 0x8C, 0x5E, - 0x07, 0x9E, 0x09, 0xE2, 0xC8, 0xA8, 0x33 ,0x9C }; /* Check whether this message is a HelloRetryRequest ( HRR ) message. * @@ -771,9 +766,11 @@ static int ssl_server_hello_is_hrr( mbedtls_ssl_context *ssl, * } ServerHello; * */ - MBEDTLS_SSL_CHK_BUF_READ_PTR( buf, end, 2 + sizeof( magic_hrr_string ) ); + MBEDTLS_SSL_CHK_BUF_READ_PTR( buf, end, + 2 + sizeof( mbedtls_ssl_tls13_hello_retry_request_magic ) ); - if( memcmp( buf + 2, magic_hrr_string, sizeof( magic_hrr_string ) ) == 0 ) + if( memcmp( buf + 2, mbedtls_ssl_tls13_hello_retry_request_magic, + sizeof( mbedtls_ssl_tls13_hello_retry_request_magic ) ) == 0 ) { return( SSL_SERVER_HELLO_COORDINATE_HRR ); } diff --git a/library/ssl_tls13_generic.c b/library/ssl_tls13_generic.c index f5d791f1b..4332a1d0c 100644 --- a/library/ssl_tls13_generic.c +++ b/library/ssl_tls13_generic.c @@ -34,6 +34,12 @@ #include "ssl_tls13_keys.h" #include "ssl_debug_helpers.h" +const uint8_t mbedtls_ssl_tls13_hello_retry_request_magic[32] = + { 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, 0xBE, + 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91, 0xC2, 0xA2, + 0x11, 0x16, 0x7A, 0xBB, 0x8C, 0x5E, 0x07, 0x9E, 0x09, + 0xE2, 0xC8, 0xA8, 0x33 ,0x9C }; + int mbedtls_ssl_tls13_fetch_handshake_msg( mbedtls_ssl_context *ssl, unsigned hs_type, unsigned char **buf,