diff options
author | Niels Möller <nisse@lysator.liu.se> | 2014-09-23 14:04:25 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2014-09-23 14:04:25 +0200 |
commit | 8b6cd994fe5a4d88a467fa93ab1596e1b445582a (patch) | |
tree | ac1beb8e28ae7aae35344312f6896777db8af06c /ecc-eh-to-a.c | |
parent | bf52911d41f394f69edd3ae8acf8d9d261e16d27 (diff) | |
download | nettle-8b6cd994fe5a4d88a467fa93ab1596e1b445582a.tar.gz |
curve25519: Use powering to compute modp inverses, 5.5 times faster than ecc_mod_inv.
Diffstat (limited to 'ecc-eh-to-a.c')
-rw-r--r-- | ecc-eh-to-a.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ecc-eh-to-a.c b/ecc-eh-to-a.c index 4cfcad3b..3b7aff22 100644 --- a/ecc-eh-to-a.c +++ b/ecc-eh-to-a.c @@ -41,10 +41,11 @@ mp_size_t ecc_eh_to_a_itch (const struct ecc_curve *ecc) { - /* Needs ecc->p.size + scratch for ecc_modq_inv */ - return ECC_EH_TO_A_ITCH (ecc->p.size); + /* Needs 2*ecc->p.size + scratch for ecc_modq_inv */ + return ECC_EH_TO_A_ITCH (ecc->p.size, ecc->p.invert_itch); } + /* Convert from homogeneous coordinates on the Edwards curve to affine coordinates. */ void @@ -63,7 +64,7 @@ ecc_eh_to_a (const struct ecc_curve *ecc, mp_limb_t cy; - /* Needs 2*size scratch */ + /* Needs 2*size + scratch for the invert call. */ ecc->p.invert (&ecc->p, izp, zp, tp + ecc->p.size); ecc_modp_mul (ecc, tp, xp, izp); |