Introduce polarssl_zeroize() instead of memset() for zeroization
diff --git a/library/pk.c b/library/pk.c
index 8000c10..e923d79 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -44,6 +44,11 @@
 #include "polarssl/ecdsa.h"
 #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;
+}
+
 /*
  * Initialise a pk_context
  */
@@ -65,9 +70,8 @@
         return;
 
     ctx->pk_info->ctx_free_func( ctx->pk_ctx );
-    ctx->pk_ctx = NULL;
 
-    ctx->pk_info = NULL;
+    polarssl_zeroize( ctx, sizeof( pk_context ) );
 }
 
 /*