From be17ed59d678a12180ab56626900bd304832e7d1 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Sun, 29 Oct 2017 17:53:52 +0200 Subject: [PATCH] Address PR review comments set `cache->chain` to NULL, instead of setting the whole structure to zero. --- library/ssl_cache.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/library/ssl_cache.c b/library/ssl_cache.c index 47107b6a0..14e350e54 100644 --- a/library/ssl_cache.c +++ b/library/ssl_cache.c @@ -43,15 +43,6 @@ #define mbedtls_free free #endif -#include "mbedtls/ssl_cache.h" - -#include - -/* Implementation that should never be optimized out by the compiler */ -static void mbedtls_zeroize( void *v, size_t n ) { - volatile unsigned char *p = v; while( n-- ) *p++ = 0; -} - void mbedtls_ssl_cache_init( mbedtls_ssl_cache_context *cache ) { memset( cache, 0, sizeof( mbedtls_ssl_cache_context ) ); @@ -330,8 +321,7 @@ void mbedtls_ssl_cache_free( mbedtls_ssl_cache_context *cache ) #if defined(MBEDTLS_THREADING_C) mbedtls_mutex_free( &cache->mutex ); #endif - - mbedtls_zeroize( cache, sizeof(mbedtls_ssl_cache_context) ); + cache->chain = NULL; } #endif /* MBEDTLS_SSL_CACHE_C */