Browse code

Fix for CVE-2018-0737 in openssl to address issue with RSA Key generation algorithm's vulnerability towards a cache timing side channel attack. [PR 2127247]

Change-Id: I27e0f75687b10e5435fc2d97324b2c2c224326b6
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5259
Reviewed-by: Sharath George
Tested-by: Sharath George

dweepadvani authored on 2018/06/14 10:37: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
... ...
@@ -13,6 +13,7 @@ Patch0:     c_rehash.patch
13 13
 Patch1:     openssl-1.0.2n-ipv6apps.patch
14 14
 Patch2:     openssl-init-conslidate.patch
15 15
 Patch3:     openssl-drbg-default-read-system-fips.patch
16
+Patch4:     CVE-2018-0737.patch
16 17
 Requires:   bash glibc libgcc 
17 18
 
18 19
 %description
... ...
@@ -53,6 +54,7 @@ Perl scripts that convert certificates and keys to various formats.
53 53
 %patch1 -p1
54 54
 %patch2 -p1
55 55
 %patch3 -p1
56
+%patch4 -p1
56 57
 
57 58
 %build
58 59
 export CFLAGS="%{optflags}"
... ...
@@ -112,6 +114,8 @@ rm -rf %{buildroot}/*
112 112
 /%{_bindir}/c_rehash
113 113
 
114 114
 %changelog
115
+*   Wed Jun 13 2018 Dweep Advani <dadvani@vmware.com> 1.0.2o-2
116
+-   Fix of CVE CVE-2018-0737
115 117
 *   Tue Apr 03 2018 Anish Swaminathan <anishs@vmware.com> 1.0.2o-1
116 118
 -   Upgrade to 1.0.2o - Fixes CVE-2017-3738, CVE-2018-0733, CVE-2018-0739
117 119
 *   Tue Jan 02 2018 Xiaolin Li <xiaolinl@vmware.com> 1.0.2n-1