From 172448b05931e791ce3470b45afe8de4cdffaaad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Sun, 1 Nov 2020 10:22:48 +0100 Subject: Separate result area for ecc_mod_mul and ecc_mod_sqr. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ecc-mod-arith.c (ecc_mod_mul, ecc_mod_sqr): Separate argument for scratch area, reducing required size of result area. Update all callers to naïvely keep using result in scratch area. (ecc_mod_pow_2k, ecc_mod_pow_2k_mul): Simplified, also reducing required size of result area. --- ecc-eh-to-a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ecc-eh-to-a.c') diff --git a/ecc-eh-to-a.c b/ecc-eh-to-a.c index 869e8ad5..ce71e93f 100644 --- a/ecc-eh-to-a.c +++ b/ecc-eh-to-a.c @@ -61,11 +61,11 @@ ecc_eh_to_a (const struct ecc_curve *ecc, /* Needs 2*size + scratch for the invert call. */ ecc->p.invert (&ecc->p, izp, zp, tp + ecc->p.size); - ecc_mod_mul (&ecc->p, tp, xp, izp); + ecc_mod_mul (&ecc->p, tp, xp, izp, tp); cy = mpn_sub_n (r, tp, ecc->p.m, ecc->p.size); cnd_copy (cy, r, tp, ecc->p.size); - ecc_mod_mul (&ecc->p, tp, yp, izp); + ecc_mod_mul (&ecc->p, tp, yp, izp, tp); cy = mpn_sub_n (r + ecc->p.size, tp, ecc->p.m, ecc->p.size); cnd_copy (cy, r + ecc->p.size, tp, ecc->p.size); } -- cgit v1.2.1