From 18327cd0e455afa1f2590fff9a922cfaf235968d Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Thu, 12 Apr 2007 13:02:31 +0000 Subject: [PATCH] Copy update callback across when copying EVP_MD_CTX. Remove unnecessary reference to EVP_MD_CTX in HMAC pkey method. --- crypto/evp/digest.c | 2 ++ crypto/hmac/hm_pmeth.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 095774bf62..ec4d1779da 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -292,6 +292,8 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) memcpy(out->md_data,in->md_data,out->digest->ctx_size); } + out->update = in->update; + if (in->pctx) { out->pctx = EVP_PKEY_CTX_dup(in->pctx); diff --git a/crypto/hmac/hm_pmeth.c b/crypto/hmac/hm_pmeth.c index 3e5f4a1d68..53a3f00f2f 100644 --- a/crypto/hmac/hm_pmeth.c +++ b/crypto/hmac/hm_pmeth.c @@ -68,7 +68,6 @@ typedef struct { const EVP_MD *md; /* MD for HMAC use */ - EVP_MD_CTX *mctx; /* Parent EVP_MD_CTX */ ASN1_OCTET_STRING ktmp; /* Temp storage for key */ HMAC_CTX ctx; } HMAC_PKEY_CTX; @@ -80,7 +79,6 @@ static int pkey_hmac_init(EVP_PKEY_CTX *ctx) if (!hctx) return 0; hctx->md = NULL; - hctx->mctx = NULL; hctx->ktmp.data = NULL; HMAC_CTX_init(&hctx->ctx); @@ -145,8 +143,6 @@ static int int_update(EVP_MD_CTX *ctx,const void *data,size_t count) static int hmac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx) { - HMAC_PKEY_CTX *hctx = ctx->data; - hctx->mctx = mctx; EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT); mctx->update = int_update; return 1; -- 2.25.1