diff options
author | Nils Larsch <nils@openssl.org> | 2006-01-13 23:29:31 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2006-01-13 23:29:31 +0000 |
commit | 27fbb5dbf4d373447f2091dc666f48636e31b1f5 (patch) | |
tree | ed5709639d4ab6933d5efda686d77347a9324152 /crypto | |
parent | db8d9b7cf1f8abeaee93a39595e89c90b2dc1699 (diff) |
2 is a prime number ...
PR: 1266
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bn/bn_prime.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index d03403a600..d57f658211 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -258,7 +258,8 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, /* first look for small factors */ if (!BN_is_odd(a)) - return 0; + /* a is even => a is prime if and only if a == 2 */ + return BN_is_word(a, 2); if (do_trial_division) { for (i = 1; i < NUMPRIMES; i++) |