From 2d7945c92d9c0584a64888e2cc059ef6210fd74a Mon Sep 17 00:00:00 2001 From: Andrew Tridge Date: Thu, 18 Mar 2010 10:59:51 -0700 Subject: [PATCH] memset the right length of the {i,o}pad data, memset opad not ipad in the opad case (typo) Signed-off-by: Love Hornquist Astrand --- lib/hcrypto/hmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hcrypto/hmac.c b/lib/hcrypto/hmac.c index dcd836d0b..d11bd9876 100644 --- a/lib/hcrypto/hmac.c +++ b/lib/hcrypto/hmac.c @@ -52,12 +52,12 @@ HMAC_CTX_cleanup(HMAC_CTX *ctx) ctx->buf = NULL; } if (ctx->opad) { - memset(ctx->ipad, 0, ctx->key_length); + memset(ctx->opad, 0, EVP_MD_block_size(ctx->md)); free(ctx->opad); ctx->opad = NULL; } if (ctx->ipad) { - memset(ctx->ipad, 0, ctx->key_length); + memset(ctx->ipad, 0, EVP_MD_block_size(ctx->md)); free(ctx->ipad); ctx->ipad = NULL; } -- 2.11.4.GIT