Skip to content

Commit e1b1a2c

Browse files
committed
Merge remote-tracking branch 'upstream-public/pr/2181' into development
2 parents 9055a7d + f6d6e30 commit e1b1a2c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/ssl_tls.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3201,8 +3201,10 @@ int mbedtls_ssl_write_handshake_msg( mbedtls_ssl_context *ssl )
32013201
}
32023202
}
32033203

3204-
if( ssl->out_msgtype == MBEDTLS_SSL_MSG_HANDSHAKE &&
3205-
hs_type != MBEDTLS_SSL_HS_HELLO_REQUEST &&
3204+
/* Whenever we send anything different from a
3205+
* HelloRequest we should be in a handshake - double check. */
3206+
if( ! ( ssl->out_msgtype == MBEDTLS_SSL_MSG_HANDSHAKE &&
3207+
hs_type == MBEDTLS_SSL_HS_HELLO_REQUEST ) &&
32063208
ssl->handshake == NULL )
32073209
{
32083210
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
@@ -3296,8 +3298,8 @@ int mbedtls_ssl_write_handshake_msg( mbedtls_ssl_context *ssl )
32963298
/* Either send now, or just save to be sent (and resent) later */
32973299
#if defined(MBEDTLS_SSL_PROTO_DTLS)
32983300
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
3299-
( ssl->out_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE ||
3300-
hs_type != MBEDTLS_SSL_HS_HELLO_REQUEST ) )
3301+
! ( ssl->out_msgtype == MBEDTLS_SSL_MSG_HANDSHAKE &&
3302+
hs_type == MBEDTLS_SSL_HS_HELLO_REQUEST ) )
33013303
{
33023304
if( ( ret = ssl_flight_append( ssl ) ) != 0 )
33033305
{

0 commit comments

Comments
 (0)