aboutsummaryrefslogtreecommitdiffstats
path: root/main/libressl/fix-CVE-2017-8301.patch
blob: c6684b25d01abced68da93403dfbab18b70d85bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Thu, 27 Apr 2017 20:02:00 +0200
Subject: [PATCH] Fix CVE-2017-8301

This patch reverts commit ddd98f8ea741a122952185a36c1396c14c2fda74
that introduced the vulnerability.

See also:

* http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8301
* https://github.com/libressl-portable/portable/issues/307
* https://github.com/libressl-portable/openbsd/commit/ddd98f8ea741a122952185a36c1396c14c2fda74

--- a/crypto/x509/x509_vfy.c
+++ b/crypto/x509/x509_vfy.c
@@ -541,15 +541,7 @@
 	/* Safety net, error returns must set ctx->error */
 	if (ok <= 0 && ctx->error == X509_V_OK)
 		ctx->error = X509_V_ERR_UNSPECIFIED;
-
-	/*
-	 * Safety net, if user provided verify callback indicates sucess
-	 * make sure they have set error to X509_V_OK
-	 */
-	if (ctx->verify_cb != null_callback && ok == 1)
-		ctx->error = X509_V_OK;
-
-	return(ctx->error == X509_V_OK);
+	return ok;
 }
 
 /* Given a STACK_OF(X509) find the issuer of cert (if any)