forked from pool/openssl
021091d55f
- resume reading from /dev/urandom when interrupted by a signal (bsc#995075) * add openssl-randfile_fread_interrupt.patch - add FIPS changes from SP2: - fix problems with locking in FIPS mode (bsc#992120) * duplicates: bsc#991877, bsc#991193, bsc#990392, bsc#990428 and bsc#990207 * bring back openssl-fipslocking.patch - drop openssl-fips_RSA_compute_d_with_lcm.patch (upstream) (bsc#984323) - don't check for /etc/system-fips (bsc#982268) * add openssl-fips-dont_run_FIPS_module_installed.patch - refresh openssl-fips-rsagen-d-bits.patch (forwarded request 431508 from vitezslav_cizek) OBS-URL: https://build.opensuse.org/request/show/433063 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openssl?expand=0&rev=134
40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
Index: openssl-1.0.2h/crypto/rsa/rsa_gen.c
|
|
===================================================================
|
|
--- openssl-1.0.2h.orig/crypto/rsa/rsa_gen.c 2016-07-14 15:25:28.640174922 +0200
|
|
+++ openssl-1.0.2h/crypto/rsa/rsa_gen.c 2016-07-14 15:27:41.330349764 +0200
|
|
@@ -234,6 +234,12 @@ static int FIPS_rsa_builtin_keygen(RSA *
|
|
goto err;
|
|
}
|
|
|
|
+ BN_copy(rsa->e, e_value);
|
|
+
|
|
+ if (!BN_is_zero(rsa->p) && !BN_is_zero(rsa->q))
|
|
+ test = 1;
|
|
+
|
|
+retry:
|
|
/* prepare approximate minimum p and q */
|
|
if (!BN_set_word(r0, 0xB504F334))
|
|
goto err;
|
|
@@ -246,12 +252,6 @@ static int FIPS_rsa_builtin_keygen(RSA *
|
|
if (!BN_lshift(r3, r3, pbits - 100))
|
|
goto err;
|
|
|
|
- BN_copy(rsa->e, e_value);
|
|
-
|
|
- if (!BN_is_zero(rsa->p) && !BN_is_zero(rsa->q))
|
|
- test = 1;
|
|
-
|
|
- retry:
|
|
/* generate p and q */
|
|
for (i = 0; i < 5 * pbits; i++) {
|
|
ploop:
|
|
@@ -375,6 +375,8 @@ static int FIPS_rsa_builtin_keygen(RSA *
|
|
if (!BN_mod_inverse(rsa->d, rsa->e, pr0, ctx))
|
|
goto err; /* d */
|
|
|
|
+ /* test 2^(bits/2) < d < LCM((p-1)*(q-1)) */
|
|
+ /* the LCM part is covered due to the generation by modulo above */
|
|
if (BN_num_bits(rsa->d) < pbits)
|
|
goto retry; /* d is too small */
|
|
|