summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/digest.c4
-rw-r--r--crypto/evp/evp_lib.c4
-rw-r--r--crypto/evp/evp_locl.h1
3 files changed, 7 insertions, 2 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 7b4972553b..89f8e54a91 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -83,6 +83,7 @@ void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
EVP_MD_meth_free(ctx->fetched_digest);
ctx->fetched_digest = NULL;
ctx->digest = NULL;
+ ctx->reqdigest = NULL;
OPENSSL_free(ctx);
return;
@@ -106,6 +107,9 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
+ if (type != NULL)
+ ctx->reqdigest = type;
+
/* TODO(3.0): Legacy work around code below. Remove this */
#ifndef OPENSSL_NO_ENGINE
/*
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index 219ae532d1..f99e905e42 100644
--- a/crypto/evp/evp_lib.c
+++ b/crypto/evp/evp_lib.c
@@ -479,9 +479,9 @@ int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
{
- if (!ctx)
+ if (ctx == NULL)
return NULL;
- return ctx->digest;
+ return ctx->reqdigest;
}
EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)
diff --git a/crypto/evp/evp_locl.h b/crypto/evp/evp_locl.h
index 936824a851..2453effe1d 100644
--- a/crypto/evp/evp_locl.h
+++ b/crypto/evp/evp_locl.h
@@ -10,6 +10,7 @@
/* EVP_MD_CTX related stuff */
struct evp_md_ctx_st {
+ const EVP_MD *reqdigest; /* The original requested digest */
const EVP_MD *digest;
ENGINE *engine; /* functional reference if 'digest' is
* ENGINE-provided */