e85d727
diff -up openssl-1.1.0g/crypto/asn1/a_verify.c.no-md5-verify openssl-1.1.0g/crypto/asn1/a_verify.c
e85d727
--- openssl-1.1.0g/crypto/asn1/a_verify.c.no-md5-verify	2017-11-02 15:29:02.000000000 +0100
e85d727
+++ openssl-1.1.0g/crypto/asn1/a_verify.c	2017-11-03 16:15:46.125801341 +0100
510bcc2
@@ -7,6 +7,9 @@
510bcc2
  * https://www.openssl.org/source/license.html
9caf868
  */
9caf868
 
9caf868
+/* for secure_getenv */
9caf868
+#define _GNU_SOURCE
9caf868
+
9caf868
 #include <stdio.h>
9caf868
 #include <time.h>
e85d727
 #include <sys/types.h>
e85d727
@@ -126,6 +129,12 @@ int ASN1_item_verify(const ASN1_ITEM *it
a1fb602
         if (ret != 2)
a1fb602
             goto err;
a1fb602
         ret = -1;
7b59577
+    } else if ((mdnid == NID_md5
7b59577
+               && secure_getenv("OPENSSL_ENABLE_MD5_VERIFY") == NULL) ||
7b59577
+               mdnid == NID_md4 || mdnid == NID_md2 || mdnid == NID_sha) {
a1fb602
+        ASN1err(ASN1_F_ASN1_ITEM_VERIFY,
a1fb602
+                ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
a1fb602
+        goto err;
a1fb602
     } else {
a1fb602
         const EVP_MD *type;
a1fb602
         type = EVP_get_digestbynid(mdnid);