summaryrefslogtreecommitdiff
path: root/library/ssl_tls.c
diff options
context:
space:
mode:
authorHanno Becker <hanno.becker@arm.com>2018-08-24 09:34:47 +0100
committerHanno Becker <hanno.becker@arm.com>2018-08-24 09:34:47 +0100
commit283f5efe7dac73a6ed0e12f495dfb10b3bdef846 (patch)
tree07174a9c3fbadd4845725c8b8b12ea71f558fbd8 /library/ssl_tls.c
parentb309b92ee83a2f852f886815dae963ce2ab3bb36 (diff)
Buffering: Free future record epoch after each flight
The function ssl_free_buffered_record() frees a future epoch record, if such is present. Previously, it was called in mbedtls_handshake_free(), i.e. an unused buffered record would be cleared at the end of the handshake. This commit moves the call to the function ssl_buffering_free() responsible for freeing all buffering-related data, and which is called not only at the end of the handshake, but at the end of every flight. In particular, future record epochs won't be buffered across flight boundaries anymore, and they shouldn't.
Diffstat (limited to 'library/ssl_tls.c')
-rw-r--r--library/ssl_tls.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 41803b60..d8d25637 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -8672,6 +8672,8 @@ static void ssl_buffering_free( mbedtls_ssl_context *ssl )
if( hs == NULL )
return;
+ ssl_free_buffered_record( ssl );
+
for( offset = 0; offset < MBEDTLS_SSL_MAX_BUFFERED_HS; offset++ )
ssl_buffering_free_slot( ssl, offset );
}
@@ -8776,7 +8778,6 @@ void mbedtls_ssl_handshake_free( mbedtls_ssl_context *ssl )
mbedtls_free( handshake->verify_cookie );
ssl_flight_free( handshake->flight );
ssl_buffering_free( ssl );
- ssl_free_buffered_record( ssl );
#endif
mbedtls_platform_zeroize( handshake,