summaryrefslogtreecommitdiff
path: root/ecc-secp256r1.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-secp256r1.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-secp256r1.c')
-rw-r--r--ecc-secp256r1.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ecc-secp256r1.c b/ecc-secp256r1.c
index adab8d90..4b153327 100644
--- a/ecc-secp256r1.c
+++ b/ecc-secp256r1.c
@@ -127,7 +127,7 @@ ecc_secp256r1_modp (const struct ecc_modulo *p, mp_limb_t *rp)
shifts rather than mul.
*/
t = mpn_submul_1 (rp + n - 4, p->m, 2, q1);
- t += cnd_sub_n (q2, rp + n - 3, p->m, 1);
+ t += mpn_cnd_sub_n (q2, rp + n - 3, rp + n - 3, p->m, 1);
t += (-q2) & 0xffffffff;
u0 = rp[n-2];
@@ -136,7 +136,7 @@ ecc_secp256r1_modp (const struct ecc_modulo *p, mp_limb_t *rp)
t = (u1 < cy);
u1 -= cy;
- cy = cnd_add_n (t, rp + n - 4, p->m, 2);
+ cy = mpn_cnd_add_n (t, rp + n - 4, rp + n - 4, p->m, 2);
u0 += cy;
u1 += (u0 < cy);
u1 -= (-t) & 0xffffffff;
@@ -210,7 +210,7 @@ ecc_secp256r1_modq (const struct ecc_modulo *q, mp_limb_t *rp)
assert (q2 < 2);
- c0 = cnd_sub_n (q2, rp + n - 3, q->m, 1);
+ c0 = mpn_cnd_sub_n (q2, rp + n - 3, rp + n - 3, q->m, 1);
c0 += (-q2) & q->m[1];
t = mpn_submul_1 (rp + n - 4, q->m, 2, q1);
c0 += t;
@@ -227,7 +227,7 @@ ecc_secp256r1_modq (const struct ecc_modulo *q, mp_limb_t *rp)
u1 += t;
u2 += (t<<32) + (u1 < t);
- t = cnd_add_n (t, rp + n - 4, q->m, 2);
+ t = mpn_cnd_add_n (t, rp + n - 4, rp + n - 4, q->m, 2);
u1 += t;
u2 += (u1 < t);
}