Use plain memset() in context init functions
We call xxx_init() on a structure when it has been freshly allocated (on the
stack or heap).
At this point it contains random-looking data none of which should be
sensitive, as all sensitive data is wiped using mbedtls_platform_zeroize()
when we're done using it and the memory area is going to be reclaimed (by
exiting the function or free()ing the buffer).
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 0aebb39..5919303 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -292,7 +292,7 @@
static void x509_crt_cache_init( mbedtls_x509_crt_cache *cache )
{
- mbedtls_platform_memset( cache, 0, sizeof( *cache ) );
+ memset( cache, 0, sizeof( *cache ) );
#if defined(MBEDTLS_THREADING_C)
mbedtls_mutex_init( &cache->frame_mutex );
mbedtls_mutex_init( &cache->pk_mutex );
@@ -3834,7 +3834,7 @@
*/
void mbedtls_x509_crt_init( mbedtls_x509_crt *crt )
{
- mbedtls_platform_memset( crt, 0, sizeof(mbedtls_x509_crt) );
+ memset( crt, 0, sizeof(mbedtls_x509_crt) );
}
/*