Skip to content

Commit

Permalink
Make alert sending function re-entrant
Browse files Browse the repository at this point in the history
Fixes Mbed-TLS#1916

Signed-off-by: Dave Rodgman <[email protected]>
  • Loading branch information
Hanno Becker authored and daverodgman committed Apr 8, 2022
1 parent a91b685 commit 5e18f74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/ssl_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -4855,6 +4855,9 @@ int mbedtls_ssl_send_alert_message( mbedtls_ssl_context *ssl,
if( ssl == NULL || ssl->conf == NULL )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );

if( ssl->out_left != 0 )
return( mbedtls_ssl_flush_output( ssl ) );

MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> send alert message" ) );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "send alert level=%u message=%u", level, message ));

Expand Down Expand Up @@ -5714,9 +5717,6 @@ int mbedtls_ssl_close_notify( mbedtls_ssl_context *ssl )

MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write close notify" ) );

if( ssl->out_left != 0 )
return( mbedtls_ssl_flush_output( ssl ) );

if( mbedtls_ssl_is_handshake_over( ssl ) == 1 )
{
if( ( ret = mbedtls_ssl_send_alert_message( ssl,
Expand Down

0 comments on commit 5e18f74

Please sign in to comment.