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 /curve448-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 'curve448-eh-to-x.c')
-rw-r--r-- | curve448-eh-to-x.c | 5 |
1 files changed, 1 insertions, 4 deletions
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 |