Update fp_isprime_ex.c

removed failure due to trivial case where a is in primes
This commit is contained in:
twanmal 2020-02-06 19:39:06 +01:00 committed by GitHub
parent 55863ae1d9
commit 771fe2354f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,6 +53,10 @@ int fp_isprime_ex(fp_int *a, int t)
/* do trial division */
for (r = 0; r < 256; r++) {
if (fp_cmp_d(a,primes[r])== FP_EQ) {
printf("a is in the table\n");
return FP_YES;
}
fp_mod_d(a, primes[r], &d);
if (d == 0) {
return FP_NO;