Small primes are primes too.
authorAdam Langley <agl@google.com>
Thu, 20 Apr 2017 16:20:50 +0000 (09:20 -0700)
committerRich Salz <rsalz@openssl.org>
Thu, 20 Apr 2017 20:10:10 +0000 (16:10 -0400)
commit6e64c560663f5542fdc2580bb7b030c19b6919e4
treecab54406234402d95b8f1fae5ad7b57db7f7cd28
parentc0452248ea1a59a41023a4765ef7d9825e80a62b
Small primes are primes too.

Previously, BN_is_prime_fasttest_ex, when doing trial-division, would
check whether the candidate is a multiple of a number of small primes
and, if so, reject it. However, three is a multiple of three yet is
still a prime number.

This change accepts small primes as prime when doing trial-division.

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3264)
crypto/bn/bn_prime.c
test/bntest.c