Convert mp_find_prime to use mp_prime_is_prime
Modify the signature of mp_find_prime() to permit the number of Miller-Rabin rounds to be specified. In addition, valid responses now include MP_NO, MP_YES, and MP_VAL which is returned when mp_prime_is_prime() fails. Change-Id: I0195129a4dd75875e6dddb6d49a5ceb30afb1a17
This commit is contained in:
@@ -528,7 +528,7 @@ ltm_rsa_generate_key(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb)
|
||||
do {
|
||||
BN_GENCB_call(cb, 2, counter++);
|
||||
CHECK(random_num(&p, bitsp), 0);
|
||||
CHECK(mp_find_prime(&p), MP_YES);
|
||||
CHECK(mp_find_prime(&p,128), MP_YES);
|
||||
|
||||
mp_sub_d(&p, 1, &t1);
|
||||
mp_gcd(&t1, &el, &t2);
|
||||
@@ -540,7 +540,7 @@ ltm_rsa_generate_key(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb)
|
||||
do {
|
||||
BN_GENCB_call(cb, 2, counter++);
|
||||
CHECK(random_num(&q, bits - bitsp), 0);
|
||||
CHECK(mp_find_prime(&q), MP_YES);
|
||||
CHECK(mp_find_prime(&q,128), MP_YES);
|
||||
|
||||
if (mp_cmp(&p, &q) == 0) /* don't let p and q be the same */
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user