X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/898a4e2555438ff8adb08b4d82690d08715e1048..b817bfc642225b8c3c0b6a7e42d1fb949b61a606:/mp-modsqrt.c diff --git a/mp-modsqrt.c b/mp-modsqrt.c index df60aba..f9e4b0f 100644 --- a/mp-modsqrt.c +++ b/mp-modsqrt.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mp-modsqrt.c,v 1.4 2001/06/16 12:56:38 mdw Exp $ + * $Id: mp-modsqrt.c,v 1.5 2004/04/08 01:36:15 mdw Exp $ * * Compute square roots modulo a prime * @@ -27,24 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: mp-modsqrt.c,v $ - * Revision 1.4 2001/06/16 12:56:38 mdw - * Fixes for interface change to @mpmont_expr@ and @mpmont_mexpr@. - * - * Revision 1.3 2001/02/03 12:00:29 mdw - * Now @mp_drop@ checks its argument is non-NULL before attempting to free - * it. Note that the macro version @MP_DROP@ doesn't do this. - * - * Revision 1.2 2000/10/08 12:02:21 mdw - * Use @MP_EQ@ instead of @MP_CMP@. - * - * Revision 1.1 2000/06/22 19:01:31 mdw - * Compute square roots in a prime field. - * - */ - /*----- Header files ------------------------------------------------------*/ #include "fibrand.h" @@ -103,8 +85,7 @@ mp *mp_modsqrt(mp *d, mp *a, mp *p) /* --- Find the inverse of %$a$% --- */ - ainv = MP_NEW; - mp_gcd(0, &ainv, 0, a, p); + ainv = mp_modinv(MP_NEW, a, p); /* --- Split %$p - 1$% into a power of two and an odd number --- */