From 2bf497ba4d6acc6f352bca015837fad33008565c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Thu, 11 Mar 2021 19:37:41 +0100 Subject: New functions ecc_mod_mul_canonical and ecc_mod_sqr_canonical. * ecc-mod-arith.c (ecc_mod_mul_canonical, ecc_mod_sqr_canonical): New functions. * ecc-internal.h: Declare and document new functions. * curve448-eh-to-x.c (curve448_eh_to_x): Use ecc_mod_sqr_canonical. * curve25519-eh-to-x.c (curve25519_eh_to_x): Use ecc_mod_mul_canonical. * ecc-eh-to-a.c (ecc_eh_to_a): Likewise. * ecc-j-to-a.c (ecc_j_to_a): Likewise. * ecc-mul-m.c (ecc_mul_m): Likewise. --- curve448-eh-to-x.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'curve448-eh-to-x.c') diff --git a/curve448-eh-to-x.c b/curve448-eh-to-x.c index 8f3f8c45..3b9bf3ec 100644 --- a/curve448-eh-to-x.c +++ b/curve448-eh-to-x.c @@ -52,7 +52,6 @@ curve448_eh_to_x (mp_limb_t *xp, const mp_limb_t *p, mp_limb_t *scratch) #define tp (scratch + ecc->p.size) const struct ecc_curve *ecc = &_nettle_curve448; - mp_limb_t cy; /* If u = U/W and v = V/W are the coordinates of the point on edwards448 we get the curve448 x coordinate as @@ -62,10 +61,8 @@ curve448_eh_to_x (mp_limb_t *xp, const mp_limb_t *p, mp_limb_t *scratch) /* Needs a total of 5*size storage. */ ecc->p.invert (&ecc->p, t0, up, tp); ecc_mod_mul (&ecc->p, t0, t0, vp, tp); - ecc_mod_sqr (&ecc->p, t0, t0, tp); + ecc_mod_sqr_canonical (&ecc->p, xp, t0, tp); - cy = mpn_sub_n (xp, t0, ecc->p.m, ecc->p.size); - cnd_copy (cy, xp, t0, ecc->p.size); #undef up #undef vp #undef t0 -- cgit v1.2.1