summaryrefslogtreecommitdiff
path: root/ecc-curve448.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2021-10-23 20:39:15 +0200
committerNiels Möller <nisse@lysator.liu.se>2021-10-23 20:39:15 +0200
commit26b0f47b458767ec5a3a4d7980498b03a4e8ded7 (patch)
tree37da5c2d5cc0419ae338d001e65d012eac072b57 /ecc-curve448.c
parent45028ff232dd90fd2afce6e1550a4ca3b0844612 (diff)
downloadnettle-26b0f47b458767ec5a3a4d7980498b03a4e8ded7.tar.gz
New function sec_zero_p.
Diffstat (limited to 'ecc-curve448.c')
-rw-r--r--ecc-curve448.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/ecc-curve448.c b/ecc-curve448.c
index bd87c5b8..2c3d54ba 100644
--- a/ecc-curve448.c
+++ b/ecc-curve448.c
@@ -158,15 +158,10 @@ static void ecc_curve448_inv (const struct ecc_modulo *p,
static int
ecc_curve448_zero_p (const struct ecc_modulo *p, mp_limb_t *xp)
{
- mp_limb_t cy;
- mp_limb_t w;
- mp_size_t i;
- cy = mpn_sub_n (xp, xp, p->m, ECC_LIMB_SIZE);
+ mp_limb_t 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