Merge pull request #3075 from AndrzejKurek/variable-buffer-size

Variable buffer size
This commit is contained in:
Jaeden Amero 2020-03-10 21:46:35 +04:00 committed by GitHub
commit c31f970a46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 591 additions and 28 deletions

View file

@ -1838,7 +1838,10 @@ int main( int argc, char *argv[] )
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) );
#endif
#if defined(MBEDTLS_MEMORY_DEBUG)
size_t current_heap_memory, peak_heap_memory, heap_blocks;
#endif /* MBEDTLS_MEMORY_DEBUG */
#endif /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */
/*
* Make sure memory references are valid in case we exit early.
@ -3742,6 +3745,13 @@ handshake:
}
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_memory_buffer_alloc_cur_get( &current_heap_memory, &heap_blocks );
mbedtls_memory_buffer_alloc_max_get( &peak_heap_memory, &heap_blocks );
mbedtls_printf( "Heap memory usage after handshake: %lu bytes. Peak memory usage was %lu\n",
(unsigned long) current_heap_memory, (unsigned long) peak_heap_memory );
#endif /* MBEDTLS_MEMORY_DEBUG */
if( opt.exchanges == 0 )
goto close_notify;

View file

@ -1474,6 +1474,14 @@ int query_config( const char *config )
}
#endif /* MBEDTLS_SSL_TRUNCATED_HMAC */
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
if( strcmp( "MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH", config ) == 0 )
{
MACRO_EXPANSION_TO_STR( MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH );
return( 0 );
}
#endif /* MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH */
#if defined(MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT)
if( strcmp( "MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT", config ) == 0 )
{