diff options
author | Niels Möller <nisse@lysator.liu.se> | 2019-12-14 10:00:23 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2019-12-14 10:00:23 +0100 |
commit | b33eea3b4a3eb5ea07c9615f195f84d43cda5178 (patch) | |
tree | 31418e79b695a373688f2a674a245b53e56ff0d0 /ecc-internal.h | |
parent | 39af4a6ad4245aefe1e39e75972ec7d542fcde9f (diff) | |
download | nettle-b33eea3b4a3eb5ea07c9615f195f84d43cda5178.tar.gz |
New function ecc_mul_m.
* curve25519-mul.c (curve25519_mul): Use ecc_mul_m.
* curve448-mul.c (curve448_mul): Likewise.
* ecc-mul-m.c (ecc_mul_m): New file and function. Implements
multipliction for curves in Montgomery representation, as used for
curve25519 and curve448. Extracted from curve25519_mul.
* ecc-internal.h (ecc_mul_m): Declare.
(ECC_MUL_M_ITCH): New macro.
* Makefile.in (hogweed_SOURCES): Add ecc-mul-m.c.
Diffstat (limited to 'ecc-internal.h')
-rw-r--r-- | ecc-internal.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ecc-internal.h b/ecc-internal.h index a7c7fa15..cd1a1573 100644 --- a/ecc-internal.h +++ b/ecc-internal.h @@ -69,6 +69,7 @@ #define ecc_mul_a _nettle_ecc_mul_a #define ecc_mul_g_eh _nettle_ecc_mul_g_eh #define ecc_mul_a_eh _nettle_ecc_mul_a_eh +#define ecc_mul_m _nettle_ecc_mul_m #define cnd_copy _nettle_cnd_copy #define sec_add_1 _nettle_sec_add_1 #define sec_sub_1 _nettle_sec_sub_1 @@ -394,6 +395,13 @@ ecc_mul_a_eh (const struct ecc_curve *ecc, mp_limb_t *scratch); void +ecc_mul_m (const struct ecc_modulo *m, + mp_limb_t a24, + unsigned bit_low, unsigned bit_high, + mp_limb_t *qx, const uint8_t *n, const mp_limb_t *px, + mp_limb_t *scratch); + +void cnd_copy (int cnd, mp_limb_t *rp, const mp_limb_t *ap, mp_size_t n); mp_limb_t @@ -439,6 +447,7 @@ curve448_eh_to_x (mp_limb_t *xp, const mp_limb_t *p, #define ECC_MUL_A_EH_ITCH(size) \ (((3 << ECC_MUL_A_EH_WBITS) + 10) * (size)) #endif +#define ECC_MUL_M_ITCH(size) (11*(size)) #define ECC_ECDSA_SIGN_ITCH(size) (12*(size)) #define ECC_MOD_RANDOM_ITCH(size) (size) #define ECC_HASH_ITCH(size) (1+(size)) |