summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/hcrypto/hmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/heimdal/lib/hcrypto/hmac.c')
-rw-r--r--source4/heimdal/lib/hcrypto/hmac.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/heimdal/lib/hcrypto/hmac.c b/source4/heimdal/lib/hcrypto/hmac.c
index 848b987a90..b8156e38d4 100644
--- a/source4/heimdal/lib/hcrypto/hmac.c
+++ b/source4/heimdal/lib/hcrypto/hmac.c
@@ -52,8 +52,10 @@ HMAC_Init_ex(HMAC_CTX *ctx,
if (ctx->md != md) {
ctx->md = md;
- if (ctx->buf)
+ if (ctx->buf) {
+ memset(ctx->buf, 0, ctx->key_length);
free (ctx->buf);
+ }
ctx->key_length = EVP_MD_size(ctx->md);
ctx->buf = malloc(ctx->key_length);
}
@@ -67,10 +69,14 @@ HMAC_Init_ex(HMAC_CTX *ctx,
keylen = EVP_MD_size(ctx->md);
}
- if (ctx->opad)
+ if (ctx->opad) {
+ memset(ctx->opad, 0, ctx->key_length);
free(ctx->opad);
- if (ctx->ipad)
+ }
+ if (ctx->ipad) {
+ memset(ctx->ipad, 0, ctx->key_length);
free(ctx->ipad);
+ }
ctx->opad = malloc(EVP_MD_block_size(ctx->md));
ctx->ipad = malloc(EVP_MD_block_size(ctx->md));