Add SSL "assertion" to help static analysis

This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-24 22:59:30 +02:00
parent 1cf7b30dc8
commit dba460f2f3
2 changed files with 2 additions and 4 deletions

View File

@ -2919,7 +2919,7 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl )
{ {
int ret = 0; int ret = 0;
if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER ) if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER || ssl->handshake == NULL )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
MBEDTLS_SSL_DEBUG_MSG( 2, ( "client state: %d", ssl->state ) ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "client state: %d", ssl->state ) );
@ -2929,7 +2929,6 @@ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_PROTO_DTLS) #if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM && if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
ssl->handshake != NULL &&
ssl->handshake->retransmit_state == MBEDTLS_SSL_RETRANS_SENDING ) ssl->handshake->retransmit_state == MBEDTLS_SSL_RETRANS_SENDING )
{ {
if( ( ret = mbedtls_ssl_resend( ssl ) ) != 0 ) if( ( ret = mbedtls_ssl_resend( ssl ) ) != 0 )

View File

@ -3580,7 +3580,7 @@ int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl )
{ {
int ret = 0; int ret = 0;
if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER ) if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER || ssl->handshake == NULL )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
MBEDTLS_SSL_DEBUG_MSG( 2, ( "server state: %d", ssl->state ) ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "server state: %d", ssl->state ) );
@ -3590,7 +3590,6 @@ int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_PROTO_DTLS) #if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM && if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
ssl->handshake != NULL &&
ssl->handshake->retransmit_state == MBEDTLS_SSL_RETRANS_SENDING ) ssl->handshake->retransmit_state == MBEDTLS_SSL_RETRANS_SENDING )
{ {
if( ( ret = mbedtls_ssl_resend( ssl ) ) != 0 ) if( ( ret = mbedtls_ssl_resend( ssl ) ) != 0 )