math/: Implement Grantham's Frobenius (primality) test.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 17 Nov 2018 19:21:43 +0000 (19:21 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 25 Nov 2018 11:37:22 +0000 (11:37 +0000)
commit6001a9ffafa1e77b2d192938d79e6da80febdc43
treea006307c1e0c01f907f354bb558ffb8bccde1fa3
parent925ff94a516478164fdd01d53332637455e0074d
math/: Implement Grantham's Frobenius (primality) test.

This is a rather heavyweight test which is effective when checking
possibly adversarial numbers.

There are no known composites which pass both this test and the
Miller--Rabin test with witness 2 (although infinitely many are
conjectured to exist); the combination is called the `Baillie--PSW'
test (after Baillie, Pomerance, Selfridge, and Wagstaff).  Modify
`pgen_primep' to use Baillie--PSW.

Since Baillie--PSW is somewhat faster than the many rounds of Miller--
Rabin which `pgen_primep' used to use, celebrate by raising the `keen'
threshold in the `dh-param.c' test.

This work was prompted by the paper `Prime and Prejudice', by Martin
R. Albrecht, Jake Massimo, Kenneth G. Paterson, and Juraj Somorovsky;
though, since Catacomb already used 32 iterations of Miller--Rabin with
random witnesses, I can confidently state that the previous
implementation was inefficient but secure when used with a good
randomness source.
math/Makefile.am
math/pgen-granfrob.c [new file with mode: 0644]
math/pgen.c
math/pgen.h
math/t/pgen
pub/dh-param.c