projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid trashing arguments before we've used them.
[u/mdw/catacomb]
/
mpmont.c
diff --git
a/mpmont.c
b/mpmont.c
index
2371de8
..
c644801
100644
(file)
--- a/
mpmont.c
+++ b/
mpmont.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: mpmont.c,v 1.1
5 2001/06/16 13:00:20
mdw Exp $
+ * $Id: mpmont.c,v 1.1
6 2002/01/13 13:40:31
mdw Exp $
*
* Montgomery reduction
*
*
* Montgomery reduction
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mpmont.c,v $
/*----- 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.
*
* 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)
{
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);
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);
}
return (d);
}