Skip to content

Commit

Permalink
Do not zeroize the ssl context if a key exporting function is set
Browse files Browse the repository at this point in the history
Signed-off-by: Andrzej Kurek <[email protected]>
  • Loading branch information
Andrzej Kurek committed Sep 29, 2021
1 parent 324f72e commit a72fe64
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions library/ssl_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,11 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,

#if !defined(MBEDTLS_DEBUG_C) && \
!defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
ssl = NULL; /* make sure we don't use it except for these cases */
(void) ssl;
if( ssl->f_export_keys == NULL )
{
ssl = NULL; /* make sure we don't use it except for these cases */
(void) ssl;
}
#endif

/*
Expand Down Expand Up @@ -959,7 +962,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
((void) mac_dec);
((void) mac_enc);

if( ssl->f_export_keys != NULL )
if( ssl != NULL && ssl->f_export_keys != NULL )
{
ssl->f_export_keys( ssl->p_export_keys,
MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET,
Expand Down

0 comments on commit a72fe64

Please sign in to comment.