From 2f3c633e94f09cd03a94ffd8f7ddac4020da81e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Wed, 28 Oct 2020 21:48:10 +0100 Subject: Use GMP functions mpn_cnd_add_n, mpn_cnd_sub_n and mpn_cnd_swap. --- ecc-mod-arith.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ecc-mod-arith.c') diff --git a/ecc-mod-arith.c b/ecc-mod-arith.c index 0b315552..34a28544 100644 --- a/ecc-mod-arith.c +++ b/ecc-mod-arith.c @@ -48,8 +48,8 @@ ecc_mod_add (const struct ecc_modulo *m, mp_limb_t *rp, { mp_limb_t cy; cy = mpn_add_n (rp, ap, bp, m->size); - cy = cnd_add_n (cy, rp, m->B, m->size); - cy = cnd_add_n (cy, rp, m->B, m->size); + cy = mpn_cnd_add_n (cy, rp, rp, m->B, m->size); + cy = mpn_cnd_add_n (cy, rp, rp, m->B, m->size); assert (cy == 0); } @@ -59,8 +59,8 @@ ecc_mod_sub (const struct ecc_modulo *m, mp_limb_t *rp, { mp_limb_t cy; cy = mpn_sub_n (rp, ap, bp, m->size); - cy = cnd_sub_n (cy, rp, m->B, m->size); - cy = cnd_sub_n (cy, rp, m->B, m->size); + cy = mpn_cnd_sub_n (cy, rp, rp, m->B, m->size); + cy = mpn_cnd_sub_n (cy, rp, rp, m->B, m->size); assert (cy == 0); } @@ -74,7 +74,7 @@ ecc_mod_mul_1 (const struct ecc_modulo *m, mp_limb_t *rp, hi = mpn_mul_1 (rp, ap, m->size, b); hi = mpn_addmul_1 (rp, m->B, m->size, hi); assert (hi <= 1); - hi = cnd_add_n (hi, rp, m->B, m->size); + hi = mpn_cnd_add_n (hi, rp, rp, m->B, m->size); /* Sufficient if b < B^size / p */ assert (hi == 0); } @@ -89,7 +89,7 @@ ecc_mod_addmul_1 (const struct ecc_modulo *m, mp_limb_t *rp, hi = mpn_addmul_1 (rp, ap, m->size, b); hi = mpn_addmul_1 (rp, m->B, m->size, hi); assert (hi <= 1); - hi = cnd_add_n (hi, rp, m->B, m->size); + hi = mpn_cnd_add_n (hi, rp, rp, m->B, m->size); /* Sufficient roughly if b < B^size / p */ assert (hi == 0); } @@ -104,7 +104,7 @@ ecc_mod_submul_1 (const struct ecc_modulo *m, mp_limb_t *rp, hi = mpn_submul_1 (rp, ap, m->size, b); hi = mpn_submul_1 (rp, m->B, m->size, hi); assert (hi <= 1); - hi = cnd_sub_n (hi, rp, m->B, m->size); + hi = mpn_cnd_sub_n (hi, rp, rp, m->B, m->size); /* Sufficient roughly if b < B^size / p */ assert (hi == 0); } -- cgit v1.2.1