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.
This commit is contained in:
Hanno Becker 2018-08-24 09:34:47 +01:00
parent b309b92ee8
commit 283f5efe7d

View file

@ -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,