diff options
author | Niels Möller <nisse@lysator.liu.se> | 2021-10-23 20:39:15 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2021-10-23 20:39:15 +0200 |
commit | 26b0f47b458767ec5a3a4d7980498b03a4e8ded7 (patch) | |
tree | 37da5c2d5cc0419ae338d001e65d012eac072b57 /ecc-curve25519.c | |
parent | 45028ff232dd90fd2afce6e1550a4ca3b0844612 (diff) | |
download | nettle-26b0f47b458767ec5a3a4d7980498b03a4e8ded7.tar.gz |
New function sec_zero_p.
Diffstat (limited to 'ecc-curve25519.c')
-rw-r--r-- | ecc-curve25519.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/ecc-curve25519.c b/ecc-curve25519.c index 7182b2ff..3a85f07e 100644 --- a/ecc-curve25519.c +++ b/ecc-curve25519.c @@ -175,8 +175,6 @@ static int ecc_curve25519_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) { mp_limb_t cy; - mp_limb_t w; - mp_size_t i; #if PHIGH_BITS > 0 mp_limb_t hi = xp[ECC_LIMB_SIZE-1]; xp[ECC_LIMB_SIZE-1] = (hi & (GMP_NUMB_MASK >> PHIGH_BITS)) @@ -185,9 +183,7 @@ ecc_curve25519_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) cy = mpn_sub_n (xp, xp, p->m, ECC_LIMB_SIZE); mpn_cnd_add_n (cy, xp, xp, p->m, ECC_LIMB_SIZE); - for (i = 0, w = 0; i < ECC_LIMB_SIZE; i++) - w |= xp[i]; - return w == 0; + return sec_zero_p (xp, ECC_LIMB_SIZE); } /* Compute x such that x^2 = u/v (mod p). Returns one on success, zero |