summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-17 12:55:37 +1000
committerPauli <ppzgs1@gmail.com>2021-03-20 10:18:32 +1000
commit28c21fa048db0f1850e533c82a13d01c98de7ea1 (patch)
tree3b2e0110dc054a1c3b9c5d0670e2a394db127b06 /crypto
parent07aa88cccf506c6143ec882a5dd93cd97483ecc2 (diff)
evp: fix coverity 1445872 - dereference after null check
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14589)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/digest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index d256cbe140..494e0f5646 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -457,7 +457,12 @@ int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, size_t size)
OSSL_PARAM params[2];
size_t i = 0;
- if (ctx->digest == NULL || ctx->digest->prov == NULL)
+ if (ctx->digest == NULL) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_NULL_ALGORITHM);
+ return 0;
+ }
+
+ if (ctx->digest->prov == NULL)
goto legacy;
if (ctx->digest->dfinal == NULL) {