347681c
From 3f9deff30ae6efbfe979043b00cdf649b39793c0 Mon Sep 17 00:00:00 2001
347681c
From: Tomas Mraz <tmraz@fedoraproject.org>
347681c
Date: Thu, 24 Sep 2020 09:51:34 +0200
347681c
Subject: Disable signature verification with totally unsafe hash algorithms
347681c
347681c
(was openssl-1.1.1-no-weak-verify.patch)
347681c
---
347681c
 crypto/asn1/a_verify.c | 5 +++++
347681c
 1 file changed, 5 insertions(+)
347681c
347681c
diff --git a/crypto/asn1/a_verify.c b/crypto/asn1/a_verify.c
347681c
index b7eed914b0..af62f0ef08 100644
347681c
--- a/crypto/asn1/a_verify.c
347681c
+++ b/crypto/asn1/a_verify.c
347681c
@@ -152,6 +152,11 @@ int ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg,
347681c
             ERR_raise(ERR_LIB_ASN1, ERR_R_EVP_LIB);
347681c
         if (ret <= 1)
347681c
             goto err;
347681c
+    } else if ((mdnid == NID_md5
347681c
+               && ossl_safe_getenv("OPENSSL_ENABLE_MD5_VERIFY") == NULL) ||
347681c
+               mdnid == NID_md4 || mdnid == NID_md2 || mdnid == NID_sha) {
347681c
+        ERR_raise(ERR_LIB_ASN1, ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
347681c
+        goto err;
347681c
     } else {
347681c
         const EVP_MD *type = NULL;
347681c
 
347681c
-- 
347681c
2.26.2
347681c