From: Nils Larsch Date: Fri, 13 Jan 2006 23:29:31 +0000 (+0000) Subject: 2 is a prime number ... X-Git-Tag: OpenSSL_0_9_8b~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27fbb5dbf4d373447f2091dc666f48636e31b1f5;p=openssl 2 is a prime number ... PR: 1266 --- 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++)