Introduce polarssl_zeroize() instead of memset() for zeroization
diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c
index 619b446..30307b0 100644
--- a/library/hmac_drbg.c
+++ b/library/hmac_drbg.c
@@ -49,6 +49,11 @@
 #define polarssl_printf printf
 #endif
 
+/* Implementation that should never be optimized out by the compiler */
+static void polarssl_zeroize( void *v, size_t n ) {
+    volatile unsigned char *p = v; while( n-- ) *p++ = 0;
+}
+
 /*
  * HMAC_DRBG update, using optional additional data (10.1.2.2)
  */
@@ -305,7 +310,7 @@
 
     md_free_ctx( &ctx->md_ctx );
 
-    memset( ctx, 0, sizeof( hmac_drbg_context ) );
+    polarssl_zeroize( ctx, sizeof( hmac_drbg_context ) );
 }
 
 #if defined(POLARSSL_FS_IO)