bugfix in mp_prime_is_prime for small input
This commit is contained in:
parent
fdaad99b1b
commit
fd876e4a7f
@ -275,8 +275,9 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
|
|||||||
fips_rand |= (unsigned int) b.dp[0];
|
fips_rand |= (unsigned int) b.dp[0];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
len = (int) ((fips_rand & mask)/ DIGIT_BIT);
|
// Ceil, because small numbers have a right to live, too,
|
||||||
// Unlikely, but still possible.
|
len = (int) ( ((fips_rand & mask) + DIGIT_BIT) / DIGIT_BIT);
|
||||||
|
// Unlikely.
|
||||||
if(len < 0){
|
if(len < 0){
|
||||||
ix--;
|
ix--;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user