X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/574d8527d1cc983cf96cda236113363b8f07837f..97490e68d1ecc95b6e61a993114df7110e061c95:/mpmont.c diff --git a/mpmont.c b/mpmont.c index 2371de8..c644801 100644 --- a/mpmont.c +++ b/mpmont.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mpmont.c,v 1.15 2001/06/16 13:00:20 mdw Exp $ + * $Id: mpmont.c,v 1.16 2002/01/13 13:40:31 mdw Exp $ * * Montgomery reduction * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mpmont.c,v $ + * Revision 1.16 2002/01/13 13:40:31 mdw + * Avoid trashing arguments before we've used them. + * * Revision 1.15 2001/06/16 13:00:20 mdw * Use the generic exponentiation functions. * @@ -408,9 +411,11 @@ mp *mpmont_expr(mpmont *mm, mp *d, mp *a, mp *e) mp *mpmont_exp(mpmont *mm, mp *d, mp *a, mp *e) { + e = MP_COPY(e); d = mpmont_mul(mm, d, a, mm->r2); d = mpmont_expr(mm, d, d, e); d = mpmont_reduce(mm, d, d); + MP_DROP(e); return (d); }