summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crypto/evp/digest.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 386a3f73bc..2e202c8fe0 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -191,9 +191,12 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
ctx->engine = impl;
} else
ctx->engine = NULL;
- } else if (!ctx->digest) {
- EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
- return 0;
+ } else {
+ if (!ctx->digest) {
+ EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);
+ return 0;
+ }
+ type = ctx->digest;
}
#endif
if (ctx->digest != type) {