memset the right length of the {i,o}pad data, memset opad not ipad in the opad case...
authorAndrew Tridge <tridge@samba.org>
Thu, 18 Mar 2010 17:59:51 +0000 (10:59 -0700)
committerLove Hornquist Astrand <lha@h5l.org>
Thu, 18 Mar 2010 17:59:51 +0000 (10:59 -0700)
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
lib/hcrypto/hmac.c

index dcd836d0be3b9c861089c6ca311dfd0b12fbdcb1..d11bd9876988332142290dd3dabcc45ac4bea57c 100644 (file)
@@ -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;
     }