Add conf parameter to mbedtls_ssl_handshake_free

This function is declared in ssl_internal.h, so this is not a public
API change.

This is in preparation for mbedtls_ssl_handshake_free needing to call
methods from the config structure.
This commit is contained in:
Gilles Peskine 2018-01-05 21:08:15 +01:00
parent fe1c0937d7
commit 59e83d96db
2 changed files with 9 additions and 5 deletions

View file

@ -385,9 +385,11 @@ void mbedtls_ssl_transform_free( mbedtls_ssl_transform *transform );
* \brief Free referenced items in an SSL handshake context and clear
* memory
*
* \param conf SSL configuration
* \param handshake SSL handshake context
*/
void mbedtls_ssl_handshake_free( mbedtls_ssl_handshake_params *handshake );
void mbedtls_ssl_handshake_free( const mbedtls_ssl_config *conf,
mbedtls_ssl_handshake_params *handshake );
int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl );
int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl );

View file

@ -5153,7 +5153,7 @@ static void ssl_handshake_wrapup_free_hs_transform( mbedtls_ssl_context *ssl )
/*
* Free our handshake params
*/
mbedtls_ssl_handshake_free( ssl->handshake );
mbedtls_ssl_handshake_free( ssl->conf, ssl->handshake );
mbedtls_free( ssl->handshake );
ssl->handshake = NULL;
@ -5508,7 +5508,7 @@ static int ssl_handshake_init( mbedtls_ssl_context *ssl )
if( ssl->session_negotiate )
mbedtls_ssl_session_free( ssl->session_negotiate );
if( ssl->handshake )
mbedtls_ssl_handshake_free( ssl->handshake );
mbedtls_ssl_handshake_free( ssl->conf, ssl->handshake );
/*
* Either the pointers are now NULL or cleared properly and can be freed.
@ -7263,10 +7263,12 @@ static void ssl_key_cert_free( mbedtls_ssl_key_cert *key_cert )
}
#endif /* MBEDTLS_X509_CRT_PARSE_C */
void mbedtls_ssl_handshake_free( mbedtls_ssl_handshake_params *handshake )
void mbedtls_ssl_handshake_free( const mbedtls_ssl_config *conf,
mbedtls_ssl_handshake_params *handshake )
{
if( handshake == NULL )
return;
(void) conf; /*unused in some compile-time configurations*/
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_1)
@ -7397,7 +7399,7 @@ void mbedtls_ssl_free( mbedtls_ssl_context *ssl )
if( ssl->handshake )
{
mbedtls_ssl_handshake_free( ssl->handshake );
mbedtls_ssl_handshake_free( ssl->conf, ssl->handshake );
mbedtls_ssl_transform_free( ssl->transform_negotiate );
mbedtls_ssl_session_free( ssl->session_negotiate );