1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-02 21:06:37 +03:00

ssl_read() stops returning non-application data

This commit is contained in:
Manuel Pégourié-Gonnard
2014-08-19 12:28:50 +02:00
parent 55e4ff2ace
commit f26a1e8602
2 changed files with 16 additions and 3 deletions

View File

@ -4357,9 +4357,10 @@ int ssl_read( ssl_context *ssl, unsigned char *buf, size_t len )
SSL_DEBUG_RET( 1, "ssl_start_renegotiation", ret );
return( ret );
}
return( POLARSSL_ERR_NET_WANT_READ );
}
/* Tell the user to call ssl_read() again */
return( POLARSSL_ERR_NET_WANT_READ );
}
else if( ssl->renegotiation == SSL_RENEGOTIATION_PENDING )
{
@ -4373,7 +4374,15 @@ int ssl_read( ssl_context *ssl, unsigned char *buf, size_t len )
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );
}
}
else if( ssl->in_msgtype != SSL_MSG_APPLICATION_DATA )
/* Fatal and closure alerts handled by ssl_read_record() */
if( ssl->in_msgtype == SSL_MSG_ALERT )
{
SSL_DEBUG_MSG( 2, ( "ignoring non-fatal non-closure alert" ) );
return( POLARSSL_ERR_NET_WANT_READ );
}
if( ssl->in_msgtype != SSL_MSG_APPLICATION_DATA )
{
SSL_DEBUG_MSG( 1, ( "bad application data message" ) );
return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE );