1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00

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
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;