HMAC_DRBG: clean stack buffers
Wipe stack buffers that may contain sensitive data (data that
contributes to the DRBG state.
diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c
index 24c609e..40e2b0a 100644
--- a/library/hmac_drbg.c
+++ b/library/hmac_drbg.c
@@ -93,6 +93,8 @@
mbedtls_md_hmac_update( &ctx->md_ctx, ctx->V, md_len );
mbedtls_md_hmac_finish( &ctx->md_ctx, ctx->V );
}
+
+ mbedtls_zeroize( K, sizeof( K ) );
}
/*
@@ -158,6 +160,7 @@
ctx->reseed_counter = 1;
/* 4. Done */
+ mbedtls_zeroize( seed, seedlen );
return( 0 );
}