1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Failure to set multipliers[NPRIMES] was rendering the input-modulus

feature (make sure your prime is not congruent to Foo mod Bar)
largely ineffective. As a result, RSA keys were being generated
every so often with at least one prime congruent to 1 mod 37,
causing modinv(37, phi(n)) to divide by zero, and rightly so. I
believe this fixes `puttygen-zero-div'.

[originally from svn r3316]
This commit is contained in:
Simon Tatham 2003-06-28 14:11:28 +00:00
parent f9ca6e8501
commit 61648131fb

View File

@ -1255,6 +1255,10 @@ Bignum primegen(int bits, int modulus, int residue, Bignum factor,
moduli[NPRIMES] = modulus;
residues[NPRIMES] = (bignum_mod_short(p, (unsigned short) modulus)
+ modulus - residue);
if (factor)
multipliers[NPRIMES] = bignum_mod_short(factor, modulus);
else
multipliers[NPRIMES] = 1;
delta = 0;
while (1) {
for (i = 0; i < (sizeof(moduli) / sizeof(*moduli)); i++)