chiark / gitweb /
math/, pub/: Generate primes with exactly the right size.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 24 Jun 2016 00:17:49 +0000 (01:17 +0100)
commit0b09aab8c8a83e618a2c5d00f716102fb8db13e4
treedd68e0b63cb7bcc7a348d6d9407c180b6b211613
parent0c4f06c08a965b4c07e4075d974808a6a266d534
math/, pub/: Generate primes with exactly the right size.

Previously, the `strongprime' and `limlee' machinery had a tendency to
generate primes which were a few bits shorter than actually requested.
Fix this unfortunate state of affairs by using a more careful analysis
of sizes of things.

The Lim--Lee prime generation has been changed quite a bit.  The large
factor now might not be suitable, so there's some new machinery for
tracking how useful it's being for generating numbers of the right size
and choosing a different one if it gets out of whack.  Unfortunately,
this means applying a rather unpleasant hack to the structure layout to
preserve ABI compatibility.
math/limlee.c
math/limlee.h
math/strongprime.c
pub/rsa-gen.c