X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/ef5f48103e83977bda6ef4d7d1aacbb66a629b10..e7dc130f304bb10854e4b38488fabd258c99dcab:/mpmont-mexp.c diff --git a/mpmont-mexp.c b/mpmont-mexp.c index b541f8c..c0ede4d 100644 --- a/mpmont-mexp.c +++ b/mpmont-mexp.c @@ -1,8 +1,8 @@ /* -*-c-*- * - * $Id: mpmont-mexp.c,v 1.3 1999/12/10 23:18:39 mdw Exp $ + * $Id: mpmont-mexp.c,v 1.5 2000/10/08 12:11:22 mdw Exp $ * - * Multiplle simultaneous exponentiations + * Multiple simultaneous exponentiations * * (c) 1999 Straylight/Edgeware */ @@ -30,6 +30,14 @@ /*----- Revision history --------------------------------------------------* * * $Log: mpmont-mexp.c,v $ + * Revision 1.5 2000/10/08 12:11:22 mdw + * Use @MP_EQ@ instead of @MP_CMP@. + * + * Revision 1.4 2000/06/17 11:45:09 mdw + * Major memory management overhaul. Added arena support. Use the secure + * arena for secret integers. Replace and improve the MP management macros + * (e.g., replace MP_MODIFY by MP_DEST). + * * Revision 1.3 1999/12/10 23:18:39 mdw * Change interface for suggested destinations. * @@ -121,6 +129,9 @@ mp *mpmont_mexpr(mpmont *mm, mp *d, mpmont_factor *f, size_t n) * * I must scan the exponents from left to right, which is a shame. It * means that I can't use the standard @mpscan@ stuff, in particular. + * + * If any of the exponents are considered secret then make the accumulator + * automatically set the secret bit. */ { @@ -132,6 +143,8 @@ mp *mpmont_mexpr(mpmont *mm, mp *d, mpmont_factor *f, size_t n) s[i].len = MP_LEN(f[i].exp); if (s[i].len > o) o = s[i].len; + if (f[i].exp->f & MP_BURN) + spare = MP_NEWSEC; } b = 0; } @@ -239,7 +252,7 @@ static int verify(size_t n, dstr *v) rr = *(mp **)v[j].buf; mpmont_create(&mm, m); r = mpmont_mexp(&mm, MP_NEW, f, n); - if (MP_CMP(r, !=, rr)) { + if (!MP_EQ(r, rr)) { fputs("\n*** mexp failed\n", stderr); fputs("m = ", stderr); mp_writefile(m, stderr, 10); for (i = 0; i < n; i++) {