Browse code

Fix for CVE-2018-0737

Change-Id: I58670cb384b10e8ea97a36d7f4d28a413018d90d
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5401
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

Ankit Jain authored on 2018/07/26 02:46:34
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,27 @@
0
+From: Billy Brumley <bbrumley@gmail.com>
1
+Date: Wed, 11 Apr 2018 07:10:58 +0000 (+0300)
2
+Subject: RSA key generation: ensure BN_mod_inverse and BN_mod_exp_mont both get called with... 
3
+X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=349a41da1ad88ad87825414752a8ff5fdd6a6c3f
4
+
5
+RSA key generation: ensure BN_mod_inverse and BN_mod_exp_mont both get called with BN_FLG_CONSTTIME flag set.
6
+
7
+CVE-2018-0737
8
+
9
+Reviewed-by: Rich Salz <rsalz@openssl.org>
10
+Reviewed-by: Matt Caswell <matt@openssl.org>
11
+(cherry picked from commit 6939eab03a6e23d2bd2c3f5e34fe1d48e542e787)
12
+---
13
+
14
+diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c
15
+index 9ca5dfe..42b89a8 100644
16
+--- a/crypto/rsa/rsa_gen.c
17
+@@ -156,6 +156,8 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
18
+     if (BN_copy(rsa->e, e_value) == NULL)
19
+         goto err;
20
+ 
21
++    BN_set_flags(rsa->p, BN_FLG_CONSTTIME);
22
++    BN_set_flags(rsa->q, BN_FLG_CONSTTIME);
23
+     BN_set_flags(r2, BN_FLG_CONSTTIME);
24
+     /* generate p and q */
25
+     for (;;) {
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        Management tools and libraries relating to cryptography
2 2
 Name:           openssl
3 3
 Version:        1.0.2o
4
-Release:        1%{?dist}
4
+Release:        2%{?dist}
5 5
 License:        OpenSSL
6 6
 URL:            http://www.openssl.org
7 7
 Group:          System Environment/Security
... ...
@@ -14,6 +14,7 @@ Patch0:         c_rehash.patch
14 14
 Patch1:         openssl-1.0.2n-ipv6apps.patch
15 15
 Patch2:         openssl-init-conslidate.patch
16 16
 Patch3:         openssl-drbg-default-read-system-fips.patch
17
+Patch4:         CVE-2018-0737.patch
17 18
 %if %{with_check}
18 19
 BuildRequires: zlib-devel
19 20
 %endif
... ...
@@ -57,6 +58,7 @@ Perl scripts that convert certificates and keys to various formats.
57 57
 %patch1 -p1
58 58
 %patch2 -p1
59 59
 %patch3 -p1
60
+%patch4 -p1
60 61
 
61 62
 %build
62 63
 export CFLAGS="%{optflags}"
... ...
@@ -118,6 +120,8 @@ rm -rf %{buildroot}/*
118 118
 /%{_bindir}/rehash_ca_certificates.sh
119 119
 
120 120
 %changelog
121
+*   Wed Jul 25 2018 Ankit Jain <ankitja@vmware.com> 1.0.2o-2
122
+-   Fix of CVE-2018-0737
121 123
 *   Tue Apr 03 2018 Anish Swaminathan <anishs@vmware.com> 1.0.2o-1
122 124
 -   Upgrade to 1.0.2o- Fixes CVE-2017-3738, CVE-2018-0733, CVE-2018-0739
123 125
 *   Wed Mar 21 2018 Dheeraj Shetty <dheerajs@vmware.com> 1.0.2n-2