X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/3563e36580c7dad68cd6d3f7eb82eef570fc0c76..02d7884df1f33c9c7dc3a14c4b1a5f520ebe090a:/mpmont.c diff --git a/mpmont.c b/mpmont.c index 926fde8..bfede63 100644 --- a/mpmont.c +++ b/mpmont.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mpmont.c,v 1.17 2004/04/01 12:50:09 mdw Exp $ + * $Id: mpmont.c,v 1.18 2004/04/03 03:32:05 mdw Exp $ * * Montgomery reduction * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mpmont.c,v $ + * Revision 1.18 2004/04/03 03:32:05 mdw + * General robustification. + * * Revision 1.17 2004/04/01 12:50:09 mdw * Add cyclic group abstraction, with test code. Separate off exponentation * functions for better static linking. Fix a buttload of bugs on the way. @@ -144,15 +147,9 @@ void mpmont_create(mpmont *mm, mp *m) mp *r2 = mp_new(2 * n + 1, 0); mp r; - /* --- Validate the arguments --- */ - - assert(((void)"Montgomery modulus must be positive", - (m->f & MP_NEG) == 0)); - assert(((void)"Montgomery modulus must be odd", m->v[0] & 1)); - /* --- Take a copy of the modulus --- */ - mp_shrink(m); + assert(MP_ISPOS(m) && MP_ISODD(m)); mm->m = MP_COPY(m); /* --- Determine %$R^2$% --- */