1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/test
Simon Tatham da3bc3d927 Refactor generation of candidate integers in primegen.
I've replaced the random number generation and small delta-finding
loop in primegen() with a much more elaborate system in its own source
file, with unit tests and everything.

Immediate benefits:

 - fixes a theoretical possibility of overflowing the target number of
   bits, if the random number was so close to the top of the range
   that the addition of delta * factor pushed it over. However, this
   only happened with negligible probability.

 - fixes a directional bias in delta-finding. The previous code
   incremented the number repeatedly until it found a value coprime to
   all the right things, which meant that a prime preceded by a
   particularly long sequence of numbers with tiny factors was more
   likely to be chosen. Now we select candidate delta values at
   random, that bias should be eliminated.

 - changes the semantics of the outermost primegen() function to make
   them easier to use, because now the caller specifies the 'bits' and
   'firstbits' values for the actual returned prime, rather than
   having to account for the factor you're multiplying it by in DSA.
   DSA client code is correspondingly adjusted.

Future benefits:

 - having the candidate generation in a separate function makes it
   easy to reuse in alternative prime generation strategies

 - the available constraints support applications such as Maurer's
   algorithm for generating provable primes, or strong primes for RSA
   in which both p-1 and p+1 have a large factor. So those become
   things we could experiment with in future.
2020-02-23 15:47:44 +00:00
..
sclog Formatting change to braces around one case of a switch. 2020-02-16 11:26:21 +00:00
agenttest.py New test script 'agenttest.py' for testing Pageant. 2020-01-09 19:57:35 +00:00
agenttestdata.py New test script 'agenttest.py' for testing Pageant. 2020-01-09 19:57:35 +00:00
agenttestgen.py New test script 'agenttest.py' for testing Pageant. 2020-01-09 19:57:35 +00:00
colours.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
cryptsuite.py Refactor generation of candidate integers in primegen. 2020-02-23 15:47:44 +00:00
desref.py Whitespace rationalisation of entire code base. 2019-09-08 20:29:21 +01:00
display.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
eccref.py eccref.py: add a couple more methods to ModP. 2019-01-03 16:56:02 +00:00
lattrs.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
scocols.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
ssh.py New test script 'agenttest.py' for testing Pageant. 2020-01-09 19:57:35 +00:00
testcrypt.py cmdgen: add a --dump option. 2020-02-22 18:42:13 +00:00
utf8.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00
vt100.txt Rename the 'testdata' subdirectory to 'test'. 2019-01-03 16:56:02 +00:00