summaryrefslogtreecommitdiff
path: root/ecc-mod-arith.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2020-10-28 21:48:10 +0100
committerNiels Möller <nisse@lysator.liu.se>2020-10-28 21:48:10 +0100
commit2f3c633e94f09cd03a94ffd8f7ddac4020da81e7 (patch)
treededc83ac498c670e493e7df26f7b2fae90dc6c2b /ecc-mod-arith.c
parent1cbc9e094eae458ff83b0a59c33a929520c51a63 (diff)
downloadnettle-2f3c633e94f09cd03a94ffd8f7ddac4020da81e7.tar.gz
Use GMP functions mpn_cnd_add_n, mpn_cnd_sub_n and mpn_cnd_swap.use-mpn_cnd-functions
Diffstat (limited to 'ecc-mod-arith.c')
-rw-r--r--ecc-mod-arith.c14
1 files changed, 7 insertions, 7 deletions
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);
}