diff options
author | Niels Möller <nisse@lysator.liu.se> | 2021-03-11 19:37:41 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2021-03-11 19:37:41 +0100 |
commit | 2bf497ba4d6acc6f352bca015837fad33008565c (patch) | |
tree | d19e4e6928212dd6eb5d87f32f23abb599fd9710 /curve25519-eh-to-x.c | |
parent | fe7ae87d1b837e82f7c7968b068bca7d853a4cec (diff) | |
download | nettle-2bf497ba4d6acc6f352bca015837fad33008565c.tar.gz |
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.
Diffstat (limited to 'curve25519-eh-to-x.c')
-rw-r--r-- | curve25519-eh-to-x.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/curve25519-eh-to-x.c b/curve25519-eh-to-x.c index f0f1920d..d90defda 100644 --- a/curve25519-eh-to-x.c +++ b/curve25519-eh-to-x.c @@ -53,7 +53,6 @@ curve25519_eh_to_x (mp_limb_t *xp, const mp_limb_t *p, #define tp (scratch + 2*ecc->p.size) const struct ecc_curve *ecc = &_nettle_curve25519; - mp_limb_t cy; /* If u = U/W and v = V/W are the coordinates of the point on the Edwards curve we get the curve25519 x coordinate as @@ -69,10 +68,7 @@ curve25519_eh_to_x (mp_limb_t *xp, const mp_limb_t *p, ecc->p.invert (&ecc->p, t1, t0, tp); ecc_mod_add (&ecc->p, t0, wp, vp); - ecc_mod_mul (&ecc->p, t0, t0, t1, tp); - - cy = mpn_sub_n (xp, t0, ecc->p.m, ecc->p.size); - cnd_copy (cy, xp, t0, ecc->p.size); + ecc_mod_mul_canonical (&ecc->p, xp, t0, t1, tp); #undef vp #undef wp #undef t0 |