Blame SOURCES/openssl-1.0.1e-cc-reqs.patch
|
|
83c29f |
diff -up openssl-1.0.1e/crypto/rsa/rsa_gen.c.cc-reqs openssl-1.0.1e/crypto/rsa/rsa_gen.c
|
|
|
83c29f |
--- openssl-1.0.1e/crypto/rsa/rsa_gen.c.cc-reqs 2015-01-13 12:45:51.000000000 +0100
|
|
|
83c29f |
+++ openssl-1.0.1e/crypto/rsa/rsa_gen.c 2015-01-15 17:35:04.649697922 +0100
|
|
|
83c29f |
@@ -438,6 +438,10 @@ static int rsa_builtin_keygen(RSA *rsa,
|
|
|
83c29f |
if(!rsa->dmq1 && ((rsa->dmq1=BN_new()) == NULL)) goto err;
|
|
|
83c29f |
if(!rsa->iqmp && ((rsa->iqmp=BN_new()) == NULL)) goto err;
|
|
|
83c29f |
|
|
|
83c29f |
+ /* prepare minimum p and q difference */
|
|
|
83c29f |
+ if (!BN_one(r3)) goto err;
|
|
|
83c29f |
+ if (bitsp > 100 && !BN_lshift(r3, r3, bitsp - 100)) goto err;
|
|
|
83c29f |
+
|
|
|
83c29f |
BN_copy(rsa->e, e_value);
|
|
|
83c29f |
|
|
|
83c29f |
/* generate p and q */
|
|
|
83c29f |
@@ -463,7 +467,9 @@ static int rsa_builtin_keygen(RSA *rsa,
|
|
|
83c29f |
{
|
|
|
83c29f |
if(!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb))
|
|
|
83c29f |
goto err;
|
|
|
83c29f |
- } while((BN_cmp(rsa->p, rsa->q) == 0) && (++degenerate < 3));
|
|
|
83c29f |
+ if (!BN_sub(r2, rsa->q, rsa->p))
|
|
|
83c29f |
+ goto err;
|
|
|
83c29f |
+ } while((BN_ucmp(r2, r3) <= 0) && (++degenerate < 3));
|
|
|
83c29f |
if(degenerate == 3)
|
|
|
83c29f |
{
|
|
|
83c29f |
ok = 0; /* we set our own err */
|