Since GSSAPI is now on its own panel, we may as well have a full set of
[u/mdw/putty] / sshprime.c
index 8bbfb87..070eb98 100644 (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++)
@@ -1312,7 +1316,8 @@ Bignum primegen(int bits, int modulus, int residue, Bignum factor,
     /*
      * Next, write p-1 as q*2^k.
      */
-    for (k = 0; bignum_bit(p, k) == !k; k++);  /* find first 1 bit in p-1 */
+    for (k = 0; bignum_bit(p, k) == !k; k++)
+       continue;       /* find first 1 bit in p-1 */
     q = bignum_rshift(p, k);
     /* And store p-1 itself, which we'll need. */
     pm1 = copybn(p);
@@ -1377,6 +1382,7 @@ Bignum primegen(int bits, int modulus, int residue, Bignum factor,
         * It didn't. Therefore, w is a witness for the
         * compositeness of p.
         */
+       freebn(wqp);
        freebn(p);
        freebn(pm1);
        freebn(q);