]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
evp: fix coverity 1445872 - dereference after null check
authorPauli <ppzgs1@gmail.com>
Wed, 17 Mar 2021 02:55:37 +0000 (12:55 +1000)
committerPauli <ppzgs1@gmail.com>
Sat, 20 Mar 2021 00:18:32 +0000 (10:18 +1000)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14589)

crypto/evp/digest.c

index d256cbe140d9b6e479d644ee79263072e63b5df0..494e0f5646d7f43c74e410834dec47f30ba2d05d 100644 (file)
@@ -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) {