If the context already have a EVP_MD_CTX allocated, don't make a new

Patch from Derrick Pallas of Riverbed Techology
This commit is contained in:
Love Hornquist Astrand
2009-10-16 16:40:49 -07:00
parent 290255ee0b
commit 2ac04069b6

View File

@@ -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));