mpmul.[ch]: Move internal `HWM' and `LWM' constants to implementation.
[u/mdw/catacomb] / bbs-gen.c
index 9afa245..c668b21 100644 (file)
--- a/bbs-gen.c
+++ b/bbs-gen.c
@@ -7,7 +7,7 @@
  * (c) 1999 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of Catacomb.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * Catacomb is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with Catacomb; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -53,7 +53,7 @@
  * Returns:    If it worked OK, @PGEN_DONE@, otherwise @PGEN_ABORT@.
  *
  * Use:                Finds two prime numbers %$p'$% and %$q'$% such that both are
- *             congruent to %$3 \bmod 4$%, and  $(p - 1)/2$% and
+ *             congruent to %$3 \bmod 4$%, and  $(p - 1)/2$% and
  *             %$(q - 1)/2$% have no common factors.  The product %$n = pq$%
  *             is eminently suitable for use as a modulus in a Blum-Blum-
  *             Shub pseudorandom bit generator.
@@ -63,7 +63,8 @@ int bbs_gen(bbs_priv *bp, unsigned nbits, grand *r, unsigned n,
            pgen_proc *event, void *ectx)
 {
   rabin rb;
-  pgen_safejumpctx j;
+  pfilt jp;
+  pgen_jumpctx j;
   pgen_gcdstepctx g;
   unsigned nb = nbits/2;
   mp *x = MP_NEW;
@@ -71,11 +72,12 @@ int bbs_gen(bbs_priv *bp, unsigned nbits, grand *r, unsigned n,
   /* --- Generate @p@ --- */
 
 again:
-  if ((x = strongprime_setup("p", x, &j.jq, nb, r, n, event, ectx)) == 0)
+  if ((x = strongprime_setup("p", x, &jp, nb, r, n, event, ectx)) == 0)
     goto fail_x;
-  bp->p = pgen("p", MP_NEW, x, event, ectx, n, pgen_safejump, &j,
+  j.j = &jp;
+  bp->p = pgen("p", MP_NEW, x, event, ectx, n, pgen_jump, &j,
               rabin_iters(nb), pgen_test, &rb);
-  pfilt_destroy(&j.jq);
+  pfilt_destroy(&jp);
   if (!bp->p) {
     if (n)
       goto fail_p;