Skip to content

Commit

Permalink
Make alert sending function re-entrant
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanno Becker committed Aug 6, 2018
1 parent 2cbcdb6 commit 591b021
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/ssl_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -4474,6 +4474,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 @@ -7781,9 +7784,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( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER )
{
if( ( ret = mbedtls_ssl_send_alert_message( ssl,
Expand Down

0 comments on commit 591b021

Please sign in to comment.