From 27fbb5dbf4d373447f2091dc666f48636e31b1f5 Mon Sep 17 00:00:00 2001 From: Nils Larsch Date: Fri, 13 Jan 2006 23:29:31 +0000 Subject: [PATCH] 2 is a prime number ... PR: 1266 --- crypto/bn/bn_prime.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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++) -- 2.25.1