Skip to content

Commit

Permalink
Copy update callback across when copying EVP_MD_CTX.
Browse files Browse the repository at this point in the history
Remove unnecessary reference to EVP_MD_CTX in HMAC pkey method.
  • Loading branch information
snhenson committed Apr 12, 2007
1 parent 2022cfe commit 18327cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 2 additions & 0 deletions crypto/evp/digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions crypto/hmac/hm_pmeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 18327cd

Please sign in to comment.