X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/19d1256d02e22184d5f140ebf213f265a7e6a17f..47b4109534706a8de4ddcbfb2fa377de6b5b95ea:/dh-limlee.c diff --git a/dh-limlee.c b/dh-limlee.c index 422cf96..3787305 100644 --- a/dh-limlee.c +++ b/dh-limlee.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: dh-limlee.c,v 1.1 2000/07/29 10:01:31 mdw Exp $ + * $Id: dh-limlee.c,v 1.3 2004/04/08 01:36:15 mdw Exp $ * * Generate Diffie-Hellman parameters from Lim-Lee primes * @@ -27,14 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: dh-limlee.c,v $ - * Revision 1.1 2000/07/29 10:01:31 mdw - * Diffie-Hellman parameter generation based on Lim-Lee primes. - * - */ - /*----- Header files ------------------------------------------------------*/ #include "dh.h" @@ -89,19 +81,20 @@ int dh_limlee(dh_param *dp, unsigned ql, unsigned pl, if ((dp->p = limlee("p", MP_NEW, MP_NEW, ql, pl, r, steps, oev, oec, iev, iec, &nff, &ff)) == 0) - return (PGEN_FAIL); - dp->q = mp_copy(ff[0]); + return (PGEN_ABORT); /* --- Now find a primitive element --- */ mpmont_create(&pc.mm, dp->p); pp = mp_sub(MP_NEW, dp->p, MP_ONE); if (flags & DH_SUBGROUP) { + dp->q = mp_copy(ff[0]); pc.exp = MP_NEW; mp_div(&pc.exp, 0, pp, dp->q); pc.n = 0; pc.f = 0; } else { + dp->q = mp_lsr(MP_NEW, dp->p, 1); pc.exp = MP_TWO; pc.n = nff; pc.f = xmalloc(nff * sizeof(mp *)); @@ -139,7 +132,7 @@ int dh_limlee(dh_param *dp, unsigned ql, unsigned pl, if (!dp->g) { mp_drop(dp->p); mp_drop(dp->q); - return (PGEN_FAIL); + return (PGEN_ABORT); } return (PGEN_DONE); }