mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-04 13:19:41 +00:00
Merge pull request #5717 from daverodgman/backport_2.28-alert_reentrant
Backport 2.28 - make mbedtls_ssl_send_alert_message() reentrant
This commit is contained in:
commit
d81b5ae238
5
ChangeLog.d/alert_reentrant.txt
Normal file
5
ChangeLog.d/alert_reentrant.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
Bugfix
|
||||
* Fix bug in the alert sending function mbedtls_ssl_send_alert_message()
|
||||
potentially leading to corrupted alert messages being sent in case
|
||||
the function needs to be re-called after initially returning
|
||||
MBEDTLS_SSL_WANT_WRITE. Fixes #1916.
|
|
@ -4918,6 +4918,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 ));
|
||||
|
||||
|
@ -5790,9 +5793,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,
|
||||
|
|
Loading…
Reference in a new issue