Describe the behaviour of buffer resizing on an out-of-memory error

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2020-10-22 11:16:25 +02:00
parent cd9a6ff3c1
commit 2e49d079d6
No known key found for this signature in database
GPG Key ID: 89A90840DC388527
2 changed files with 9 additions and 1 deletions

View File

@ -1912,7 +1912,11 @@
/** /**
* \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH * \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
* *
* Enable modifying the maximum I/O buffer size. * Enable modifying the maximum I/O buffer size in runtime.
*
* If the library runs out of memory during the resizing of an I/O buffer,
* there is no error returned. The operation continues as usual on an
* unchanged buffer without any negative impact on the flow.
*/ */
//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH //#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH

View File

@ -685,6 +685,8 @@ static void handle_buffer_resizing( mbedtls_ssl_context *ssl, int downsizing,
{ {
if( resize_buffer( &ssl->in_buf, in_buf_new_len, &ssl->in_buf_len ) != 0 ) if( resize_buffer( &ssl->in_buf, in_buf_new_len, &ssl->in_buf_len ) != 0 )
{ {
/* No need to return an error here; The buffer will remain as
* is with no negative impact on the flow. */
MBEDTLS_SSL_DEBUG_MSG( 1, ( "input buffer resizing failed - out of memory" ) ); MBEDTLS_SSL_DEBUG_MSG( 1, ( "input buffer resizing failed - out of memory" ) );
} }
else else
@ -705,6 +707,8 @@ static void handle_buffer_resizing( mbedtls_ssl_context *ssl, int downsizing,
{ {
if( resize_buffer( &ssl->out_buf, out_buf_new_len, &ssl->out_buf_len ) != 0 ) if( resize_buffer( &ssl->out_buf, out_buf_new_len, &ssl->out_buf_len ) != 0 )
{ {
/* No need to return an error here; The buffer will remain as
* is with no negative impact on the flow. */
MBEDTLS_SSL_DEBUG_MSG( 1, ( "output buffer resizing failed - out of memory" ) ); MBEDTLS_SSL_DEBUG_MSG( 1, ( "output buffer resizing failed - out of memory" ) );
} }
else else