From 2ac04069b6a2699d2e7c10e09e5ae89b2cf96693 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Fri, 16 Oct 2009 16:40:49 -0700 Subject: [PATCH] If the context already have a EVP_MD_CTX allocated, don't make a new Patch from Derrick Pallas of Riverbed Techology --- lib/hcrypto/hmac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/hcrypto/hmac.c b/lib/hcrypto/hmac.c index 282dc3811..dcd836d0b 100644 --- a/lib/hcrypto/hmac.c +++ b/lib/hcrypto/hmac.c @@ -121,7 +121,8 @@ HMAC_Init_ex(HMAC_CTX *ctx, for (i = 0, p = ctx->opad; i < keylen; i++) p[i] ^= ((const unsigned char *)key)[i]; - ctx->ctx = EVP_MD_CTX_create(); + if (ctx->ctx == NULL) + ctx->ctx = EVP_MD_CTX_create(); EVP_DigestInit_ex(ctx->ctx, ctx->md, ctx->engine); EVP_DigestUpdate(ctx->ctx, ctx->ipad, EVP_MD_block_size(ctx->md));