Blame openssl-1.1.0-cc-reqs.patch
|
Paolo Bonzini |
7ae6f1 |
--- a/CryptoPkg/Library/OpensslLib/openssl/crypto/rsa/rsa_gen.c
|
|
Paolo Bonzini |
7ae6f1 |
+++ b/CryptoPkg/Library/OpensslLib/openssl/crypto/rsa/rsa_gen.c
|
|
Paolo Bonzini |
7ae6f1 |
@@ -86,6 +86,12 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
|
|
Paolo Bonzini |
91c79a |
if (!rsa->iqmp && ((rsa->iqmp = BN_secure_new()) == NULL))
|
|
Paolo Bonzini |
91c79a |
goto err;
|
|
Paolo Bonzini |
91c79a |
|
|
Paolo Bonzini |
91c79a |
+ /* prepare minimum p and q difference */
|
|
Paolo Bonzini |
91c79a |
+ if (!BN_one(r3))
|
|
Paolo Bonzini |
91c79a |
+ goto err;
|
|
Paolo Bonzini |
91c79a |
+ if (bitsp > 100 && !BN_lshift(r3, r3, bitsp - 100))
|
|
Paolo Bonzini |
91c79a |
+ goto err;
|
|
Paolo Bonzini |
91c79a |
+
|
|
Paolo Bonzini |
91c79a |
if (BN_copy(rsa->e, e_value) == NULL)
|
|
Paolo Bonzini |
91c79a |
goto err;
|
|
Paolo Bonzini |
91c79a |
|
|
Paolo Bonzini |
7ae6f1 |
@@ -118,7 +124,9 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
|
|
Paolo Bonzini |
91c79a |
do {
|
|
Paolo Bonzini |
91c79a |
if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb))
|
|
Paolo Bonzini |
91c79a |
goto err;
|
|
Paolo Bonzini |
7ae6f1 |
- } while (BN_cmp(rsa->p, rsa->q) == 0);
|
|
Paolo Bonzini |
91c79a |
+ if (!BN_sub(r2, rsa->q, rsa->p))
|
|
Paolo Bonzini |
91c79a |
+ goto err;
|
|
Paolo Bonzini |
7ae6f1 |
+ } while (BN_ucmp(r2, r3) <= 0);
|
|
Paolo Bonzini |
7ae6f1 |
if (!BN_sub(r2, rsa->q, BN_value_one()))
|
|
Paolo Bonzini |
7ae6f1 |
goto err;
|
|
Paolo Bonzini |
7ae6f1 |
ERR_set_mark();
|
|
Paolo Bonzini |
7ae6f1 |
--
|
|
Paolo Bonzini |
7ae6f1 |
2.17.0
|
|
Paolo Bonzini |
7ae6f1 |
|