From: Nils Larsch Date: Fri, 13 Jan 2006 23:27:59 +0000 (+0000) Subject: 2 is a prime X-Git-Tag: OpenSSL_0_9_8k^2~1588 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2c5fadbce376f8edaa275e317da36f3a43576427;p=oweals%2Fopenssl.git 2 is a prime 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++)