Revert "Replace internal usage of mbedtls_ssl_is_handshake_over"
This reverts commit 1d3ed2975e7ef0d84050a3aece02eec1f890dec3. Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
e219c11b4e
commit
6848a61922
2 changed files with 20 additions and 20 deletions
|
@ -1883,7 +1883,7 @@ int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want )
|
|||
{
|
||||
len = in_buf_len - ( ssl->in_hdr - ssl->in_buf );
|
||||
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
timeout = ssl->handshake->retransmit_timeout;
|
||||
else
|
||||
timeout = ssl->conf->read_timeout;
|
||||
|
@ -1907,7 +1907,7 @@ int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want )
|
|||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "timeout" ) );
|
||||
mbedtls_ssl_set_timer( ssl, 0 );
|
||||
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
{
|
||||
if( ssl_double_retransmit_timeout( ssl ) != 0 )
|
||||
{
|
||||
|
@ -2343,7 +2343,7 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
|
|||
return( ret );
|
||||
|
||||
/* Update state and set timer */
|
||||
if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 1 )
|
||||
ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_FINISHED;
|
||||
else
|
||||
{
|
||||
|
@ -2936,9 +2936,9 @@ int mbedtls_ssl_prepare_handshake_record( mbedtls_ssl_context *ssl )
|
|||
}
|
||||
|
||||
if( ssl->handshake != NULL &&
|
||||
( ( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER &&
|
||||
( ( mbedtls_ssl_is_handshake_over( ssl ) == 0 &&
|
||||
recv_msg_seq != ssl->handshake->in_msg_seq ) ||
|
||||
( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER &&
|
||||
( mbedtls_ssl_is_handshake_over( ssl ) == 1 &&
|
||||
ssl->in_msg[0] != MBEDTLS_SSL_HS_CLIENT_HELLO ) ) )
|
||||
{
|
||||
if( recv_msg_seq > ssl->handshake->in_msg_seq )
|
||||
|
@ -3004,7 +3004,7 @@ void mbedtls_ssl_update_handshake_status( mbedtls_ssl_context *ssl )
|
|||
{
|
||||
mbedtls_ssl_handshake_params * const hs = ssl->handshake;
|
||||
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER && hs != NULL )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 && hs != NULL )
|
||||
{
|
||||
ssl->handshake->update_checksum( ssl, ssl->in_msg, ssl->in_hslen );
|
||||
}
|
||||
|
@ -3651,7 +3651,7 @@ static int ssl_check_client_reconnect( mbedtls_ssl_context *ssl )
|
|||
*/
|
||||
if( rec_epoch == 0 &&
|
||||
ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER &&
|
||||
ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER &&
|
||||
mbedtls_ssl_is_handshake_over( ssl ) == 1 &&
|
||||
ssl->in_msgtype == MBEDTLS_SSL_MSG_HANDSHAKE &&
|
||||
ssl->in_left > 13 &&
|
||||
ssl->in_buf[13] == MBEDTLS_SSL_HS_CLIENT_HELLO )
|
||||
|
@ -4821,7 +4821,7 @@ int mbedtls_ssl_handle_message_type( mbedtls_ssl_context *ssl )
|
|||
/* Drop unexpected ApplicationData records,
|
||||
* except at the beginning of renegotiations */
|
||||
if( ssl->in_msgtype == MBEDTLS_SSL_MSG_APPLICATION_DATA &&
|
||||
ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER
|
||||
mbedtls_ssl_is_handshake_over( ssl ) == 0
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
&& ! ( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS &&
|
||||
ssl->state == MBEDTLS_SSL_SERVER_HELLO )
|
||||
|
@ -4833,7 +4833,7 @@ int mbedtls_ssl_handle_message_type( mbedtls_ssl_context *ssl )
|
|||
}
|
||||
|
||||
if( ssl->handshake != NULL &&
|
||||
ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
mbedtls_ssl_is_handshake_over( ssl ) == 1 )
|
||||
{
|
||||
mbedtls_ssl_handshake_wrapup_free_hs_transform( ssl );
|
||||
}
|
||||
|
@ -5258,7 +5258,7 @@ static int ssl_check_ctr_renegotiate( mbedtls_ssl_context *ssl )
|
|||
int in_ctr_cmp;
|
||||
int out_ctr_cmp;
|
||||
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER ||
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 ||
|
||||
ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_PENDING ||
|
||||
ssl->conf->disable_renegotiation == MBEDTLS_SSL_RENEGOTIATION_DISABLED )
|
||||
{
|
||||
|
@ -5502,7 +5502,7 @@ int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len )
|
|||
}
|
||||
#endif
|
||||
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
{
|
||||
ret = mbedtls_ssl_handshake( ssl );
|
||||
if( ret != MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO &&
|
||||
|
@ -5613,7 +5613,7 @@ int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len )
|
|||
|
||||
/* We're going to return something now, cancel timer,
|
||||
* except if handshake (renegotiation) is in progress */
|
||||
if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 1 )
|
||||
mbedtls_ssl_set_timer( ssl, 0 );
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||
|
@ -5758,7 +5758,7 @@ int mbedtls_ssl_write( mbedtls_ssl_context *ssl, const unsigned char *buf, size_
|
|||
}
|
||||
#endif
|
||||
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
{
|
||||
if( ( ret = mbedtls_ssl_handshake( ssl ) ) != 0 )
|
||||
{
|
||||
|
@ -5786,7 +5786,7 @@ int mbedtls_ssl_close_notify( mbedtls_ssl_context *ssl )
|
|||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write close notify" ) );
|
||||
|
||||
if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 1 )
|
||||
{
|
||||
if( ( ret = mbedtls_ssl_send_alert_message( ssl,
|
||||
MBEDTLS_SSL_ALERT_LEVEL_WARNING,
|
||||
|
|
|
@ -168,7 +168,7 @@ int mbedtls_ssl_get_peer_cid( mbedtls_ssl_context *ssl,
|
|||
*enabled = MBEDTLS_SSL_CID_DISABLED;
|
||||
|
||||
if( ssl->conf->transport != MBEDTLS_SSL_TRANSPORT_DATAGRAM ||
|
||||
ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
{
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
}
|
||||
|
@ -3602,7 +3602,7 @@ int mbedtls_ssl_handshake_step( mbedtls_ssl_context *ssl )
|
|||
if( ssl == NULL ||
|
||||
ssl->conf == NULL ||
|
||||
ssl->handshake == NULL ||
|
||||
ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
mbedtls_ssl_is_handshake_over( ssl ) == 1 )
|
||||
{
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
}
|
||||
|
@ -3706,7 +3706,7 @@ int mbedtls_ssl_handshake( mbedtls_ssl_context *ssl )
|
|||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> handshake" ) );
|
||||
|
||||
/* Main handshake loop */
|
||||
while( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
while( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
{
|
||||
ret = mbedtls_ssl_handshake_step( ssl );
|
||||
|
||||
|
@ -3807,7 +3807,7 @@ int mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl )
|
|||
/* On server, just send the request */
|
||||
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER )
|
||||
{
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
||||
ssl->renego_status = MBEDTLS_SSL_RENEGOTIATION_PENDING;
|
||||
|
@ -3827,7 +3827,7 @@ int mbedtls_ssl_renegotiate( mbedtls_ssl_context *ssl )
|
|||
*/
|
||||
if( ssl->renego_status != MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS )
|
||||
{
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
||||
if( ( ret = mbedtls_ssl_start_renegotiation( ssl ) ) != 0 )
|
||||
|
@ -4130,7 +4130,7 @@ int mbedtls_ssl_context_save( mbedtls_ssl_context *ssl,
|
|||
* (only DTLS) but are currently used to simplify the implementation.
|
||||
*/
|
||||
/* The initial handshake must be over */
|
||||
if( ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
|
||||
if( mbedtls_ssl_is_handshake_over( ssl ) == 0 )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "Initial handshake isn't over" ) );
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
|
Loading…
Reference in a new issue