Blame SOURCES/openssl-1.0.2k-cc-reqs.patch
|
|
e62613 |
diff -up openssl-1.0.2k/crypto/rsa/rsa_gen.c.cc-reqs openssl-1.0.2k/crypto/rsa/rsa_gen.c
|
|
|
e62613 |
--- openssl-1.0.2k/crypto/rsa/rsa_gen.c.cc-reqs 2017-02-06 16:42:47.313963001 +0100
|
|
|
e62613 |
+++ openssl-1.0.2k/crypto/rsa/rsa_gen.c 2017-02-06 16:46:54.453628783 +0100
|
|
|
e62613 |
@@ -474,6 +474,12 @@ static int rsa_builtin_keygen(RSA *rsa,
|
|
|
e62613 |
if (!rsa->iqmp && ((rsa->iqmp = BN_new()) == NULL))
|
|
|
e62613 |
goto err;
|
|
|
e62613 |
|
|
|
e62613 |
+ /* prepare minimum p and q difference */
|
|
|
e62613 |
+ if (!BN_one(r3))
|
|
|
e62613 |
+ goto err;
|
|
|
e62613 |
+ if (bitsp > 100 && !BN_lshift(r3, r3, bitsp - 100))
|
|
|
e62613 |
+ goto err;
|
|
|
e62613 |
+
|
|
|
e62613 |
if (BN_copy(rsa->e, e_value) == NULL)
|
|
|
e62613 |
goto err;
|
|
|
e62613 |
|
|
|
e62613 |
@@ -502,7 +508,9 @@ static int rsa_builtin_keygen(RSA *rsa,
|
|
|
e62613 |
do {
|
|
|
e62613 |
if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb))
|
|
|
e62613 |
goto err;
|
|
|
e62613 |
- } while ((BN_cmp(rsa->p, rsa->q) == 0) && (++degenerate < 3));
|
|
|
e62613 |
+ if (!BN_sub(r2, rsa->q, rsa->p))
|
|
|
e62613 |
+ goto err;
|
|
|
e62613 |
+ } while ((BN_ucmp(r2, r3) <= 0) && (++degenerate < 3));
|
|
|
e62613 |
if (degenerate == 3) {
|
|
|
e62613 |
ok = 0; /* we set our own err */
|
|
|
e62613 |
RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, RSA_R_KEY_SIZE_TOO_SMALL);
|