Use fewer primes for the trial division
authorKurt Roeckx <kurt@roeckx.be>
Sun, 6 Oct 2019 11:48:10 +0000 (13:48 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Mon, 14 Oct 2019 20:53:34 +0000 (22:53 +0200)
commit6c4ae41f1ca857254fc9e27edead81ff2fd3f3fe
tree8b8e73f750858783fa242dd74346d8c6b6facbc8
parent3103a616dc6b3150eaec0000af767f268a647f6d
Use fewer primes for the trial division

When using Miller-Rabin to test for primes, it's can be faster to first
do trial divisions, but when doing too many trial divisions it gets
slower again. We reduce the number of trial divisions to a point that
gives better performance.

Based on research by Jake Massimo and Kenneth Paterson

Reviewed-by: Paul Dale <paul.dale@oracle.com>
GH: #9272
crypto/bn/bn_prime.c