Merge pull request #2358 from ejohnstown/rsa-keygen-speedup

RSA Key Generation Speedup
This commit is contained in:
toddouska
2019-07-17 18:01:38 -07:00
committed by GitHub

View File

@ -3749,8 +3749,10 @@ int mp_prime_is_prime_ex(mp_int* a, int t, int* result, WC_RNG* rng)
/* do trial division */ /* do trial division */
for (r = 0; r < FP_PRIME_SIZE; r++) { for (r = 0; r < FP_PRIME_SIZE; r++) {
if (fp_mod_d(a, primes[r], &d) == MP_OKAY) { if (fp_mod_d(a, primes[r], &d) == MP_OKAY) {
if (d == 0) if (d == 0) {
ret = FP_NO; *result = FP_NO;
return FP_OKAY;
}
} }
else else
return FP_VAL; return FP_VAL;