summaryrefslogtreecommitdiff
path: root/ecc-pp1-redc.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2020-10-30 15:01:39 +0100
committerNiels Möller <nisse@lysator.liu.se>2020-10-30 20:22:40 +0100
commitf4f5625edb7d899972431b838ac19ced9288f68a (patch)
treebc18e9bd95b9f940bc6d4229e012c063562e8c9e /ecc-pp1-redc.c
parentcbf217b15f66a73041e6fe1a108453efd0297d27 (diff)
downloadnettle-f4f5625edb7d899972431b838ac19ced9288f68a.tar.gz
Add separate result argument to all mod functions.
* ecc-internal.h (typedef ecc_mod_func): Add separate result argument. Updated all C implementations and callers.
Diffstat (limited to 'ecc-pp1-redc.c')
-rw-r--r--ecc-pp1-redc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ecc-pp1-redc.c b/ecc-pp1-redc.c
index 9f643d97..b088c4c5 100644
--- a/ecc-pp1-redc.c
+++ b/ecc-pp1-redc.c
@@ -42,7 +42,7 @@
/* Use that 1 = p + 1 (mod p), and that at least one low limb of p + 1
is zero. */
void
-ecc_pp1_redc (const struct ecc_modulo *m, mp_limb_t *rp)
+ecc_pp1_redc (const struct ecc_modulo *m, mp_limb_t *rp, mp_limb_t *xp)
{
unsigned i;
mp_limb_t hi, cy;
@@ -50,9 +50,9 @@ ecc_pp1_redc (const struct ecc_modulo *m, mp_limb_t *rp)
mp_size_t k = m->redc_size;
for (i = 0; i < m->size; i++)
- rp[i] = mpn_addmul_1 (rp + i + k,
- m->redc_mpm1, m->size - k, rp[i]);
- hi = mpn_add_n (rp, rp, rp + m->size, m->size);
+ xp[i] = mpn_addmul_1 (xp + i + k,
+ m->redc_mpm1, m->size - k, xp[i]);
+ hi = mpn_add_n (rp, xp, xp + m->size, m->size);
if (shift > 0)
{
hi = (hi << shift) | (rp[m->size - 1] >> (GMP_NUMB_BITS - shift));