Fix CID 1467068 : Null pointer dereference in self_test.c
authorShane Lontis <shane.lontis@oracle.com>
Mon, 21 Sep 2020 00:47:03 +0000 (10:47 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Wed, 23 Sep 2020 07:16:19 +0000 (17:16 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12930)

providers/fips/self_test.c

index 81f475e90090fb016edf68e5492d17918c3eece8..4bc562f822d78bcbad8f537b4fce3e63ebda2de2 100644 (file)
@@ -174,8 +174,10 @@ static int verify_integrity(OSSL_CORE_BIO *bio, OSSL_FUNC_BIO_read_ex_fn read_ex
     OSSL_SELF_TEST_onbegin(ev, event_type, OSSL_SELF_TEST_DESC_INTEGRITY_HMAC);
 
     mac = EVP_MAC_fetch(libctx, MAC_NAME, NULL);
+    if (mac == NULL)
+        goto err;
     ctx = EVP_MAC_CTX_new(mac);
-    if (mac == NULL || ctx == NULL)
+    if (ctx == NULL)
         goto err;
 
     *p++ = OSSL_PARAM_construct_utf8_string("digest", DIGEST_NAME,