Extract message-consuming code-path to separate function
The first part of the function ssl_read_record_layer() was to mark the previous message as consumed. This commit moves the corresponding code-path to a separate static function ssl_consume_current_message().
This commit is contained in:
parent
4162b11eb4
commit
1097b34022
1 changed files with 23 additions and 5 deletions
|
@ -4283,6 +4283,9 @@ static void ssl_handshake_wrapup_free_hs_transform( mbedtls_ssl_context *ssl );
|
|||
* RFC 6347 4.1.2.7) and continue reading until a valid record is found.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Helper functions for mbedtls_ssl_read_record(). */
|
||||
static int ssl_consume_current_message( mbedtls_ssl_context *ssl );
|
||||
static int ssl_read_record_layer( mbedtls_ssl_context *ssl );
|
||||
|
||||
int mbedtls_ssl_read_record( mbedtls_ssl_context *ssl,
|
||||
|
@ -4334,13 +4337,9 @@ int mbedtls_ssl_read_record( mbedtls_ssl_context *ssl,
|
|||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_read_record_layer( mbedtls_ssl_context *ssl )
|
||||
static int ssl_consume_current_message( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Step A
|
||||
*
|
||||
* Consume last content-layer message and potentially
|
||||
* update in_msglen which keeps track of the contents'
|
||||
* consumption state.
|
||||
|
@ -4422,6 +4421,25 @@ static int ssl_read_record_layer( mbedtls_ssl_context *ssl )
|
|||
ssl->in_msglen = 0;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static int ssl_read_record_layer( mbedtls_ssl_context *ssl )
|
||||
{
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Step A
|
||||
*
|
||||
* Consume last content-layer message and potentially
|
||||
* update in_msglen which keeps track of the contents'
|
||||
* consumption state.
|
||||
*/
|
||||
|
||||
ret = ssl_consume_current_message( ssl );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
|
||||
/*
|
||||
* Step B
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue