X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/02b1cf937aed3e951e96a955e56a1cc071c332d8..80be023065ced106a4078a36371c135a60d2bd6c:/bbs-gen.c diff --git a/bbs-gen.c b/bbs-gen.c index 1c2d035..3b419af 100644 --- a/bbs-gen.c +++ b/bbs-gen.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: bbs-gen.c,v 1.4 2000/06/17 10:43:57 mdw Exp $ + * $Id: bbs-gen.c,v 1.6 2004/04/08 01:36:15 mdw Exp $ * * Generate Blum integers * @@ -27,23 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: bbs-gen.c,v $ - * Revision 1.4 2000/06/17 10:43:57 mdw - * Move GCD filter to separate file. Handle failures from pgen_jump. - * - * Revision 1.3 2000/02/12 18:21:02 mdw - * Overhaul of key management (again). - * - * Revision 1.2 1999/12/22 15:52:28 mdw - * Reworking for new prime-search system. - * - * Revision 1.1 1999/12/10 23:14:59 mdw - * Blum-Blum-Shub generator, and Blum-Goldwasser encryption. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -60,7 +43,7 @@ /* --- @bbs_gen@ --- * * - * Arguments: @bbs_param *bp@ = pointer to parameter block + * Arguments: @bbs_priv *bp@ = pointer to parameter block * @unsigned nbits@ = number of bits in the modulus * @grand *r@ = pointer to random number source * @unsigned n@ = number of attempts to make @@ -76,11 +59,12 @@ * Shub pseudorandom bit generator. */ -int bbs_gen(bbs_param *bp, unsigned nbits, grand *r, unsigned n, +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; @@ -88,11 +72,12 @@ int bbs_gen(bbs_param *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;