Maintenance: Prime

When returning a result from mp_prime_is_prime for normal math, the
result should be MP_YES or MP_NO, not a bare number (1 or 0).
This commit is contained in:
John Safranek
2019-11-26 15:44:30 -08:00
parent 3432a8a1fc
commit 2de52c7666

View File

@@ -4716,14 +4716,14 @@ int mp_prime_is_prime (mp_int * a, int t, int *result)
}
if (mp_isone(a)) {
*result = 0;
*result = MP_NO;
return MP_OKAY;
}
/* is the input equal to one of the primes in the table? */
for (ix = 0; ix < PRIME_SIZE; ix++) {
if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) {
*result = 1;
*result = MP_YES;
return MP_OKAY;
}
}