diff --git a/ecc-192.c b/ecc-192.c index 5253cc13c6b9686fed5ebfabc5fb8d87560d7572..9165976346813d4505dfedb6cecb96ee17d1393f 100644 --- a/ecc-192.c +++ b/ecc-192.c @@ -2,7 +2,7 @@ Compile time constant (but machine dependent) tables. - Copyright (C) 2013 Niels Möller + Copyright (C) 2013, 2014 Niels Möller This file is part of GNU Nettle. @@ -122,6 +122,7 @@ const struct ecc_curve nettle_secp_192r1 = ECC_PIPPENGER_K, ECC_PIPPENGER_C, + ECC_ADD_JJJ_ITCH (ECC_LIMB_SIZE), ECC_MUL_A_ITCH (ECC_LIMB_SIZE), ECC_MUL_G_ITCH (ECC_LIMB_SIZE), ECC_J_TO_A_ITCH (ECC_LIMB_SIZE), @@ -131,6 +132,7 @@ const struct ecc_curve nettle_secp_192r1 = ecc_192_modp, ecc_generic_modq, + ecc_add_jjj, ecc_mul_a, ecc_mul_g, ecc_j_to_a, diff --git a/ecc-224.c b/ecc-224.c index 2de193fecbca4b98b4de56a23b201701db7fc672..29aa2f3f515266d68fa10403cd913c936aa2f944 100644 --- a/ecc-224.c +++ b/ecc-224.c @@ -2,7 +2,7 @@ Compile time constant (but machine dependent) tables. - Copyright (C) 2013 Niels Möller + Copyright (C) 2013, 2014 Niels Möller This file is part of GNU Nettle. @@ -74,6 +74,7 @@ const struct ecc_curve nettle_secp_224r1 = ECC_PIPPENGER_K, ECC_PIPPENGER_C, + ECC_ADD_JJJ_ITCH (ECC_LIMB_SIZE), ECC_MUL_A_ITCH (ECC_LIMB_SIZE), ECC_MUL_G_ITCH (ECC_LIMB_SIZE), ECC_J_TO_A_ITCH (ECC_LIMB_SIZE), @@ -83,6 +84,7 @@ const struct ecc_curve nettle_secp_224r1 = USE_REDC ? ecc_224_redc : ecc_224_modp, ecc_generic_modq, + ecc_add_jjj, ecc_mul_a, ecc_mul_g, ecc_j_to_a, diff --git a/ecc-25519.c b/ecc-25519.c index bf27b1c724e6a9ee2554785cb6e210542d98580c..996e6bdd4e5283850bcb461b16d0a4dd8d41f381 100644 --- a/ecc-25519.c +++ b/ecc-25519.c @@ -242,6 +242,7 @@ const struct ecc_curve nettle_curve25519 = ECC_PIPPENGER_K, ECC_PIPPENGER_C, + ECC_ADD_EHH_ITCH (ECC_LIMB_SIZE), ECC_MUL_A_EH_ITCH (ECC_LIMB_SIZE), ECC_MUL_G_EH_ITCH (ECC_LIMB_SIZE), ECC_EH_TO_A_ITCH (ECC_LIMB_SIZE), @@ -251,7 +252,7 @@ const struct ecc_curve nettle_curve25519 = ecc_25519_modp, ecc_25519_modq, - + ecc_add_ehh, ecc_mul_a_eh, ecc_mul_g_eh, ecc_eh_to_a, diff --git a/ecc-256.c b/ecc-256.c index 6d4133304c2a565dbf175a94a039e261cebda966..1d2a5ec7c7210ccc65ebcd18f264e0cdc5920152 100644 --- a/ecc-256.c +++ b/ecc-256.c @@ -2,7 +2,7 @@ Compile time constant (but machine dependent) tables. - Copyright (C) 2013 Niels Möller + Copyright (C) 2013, 2014 Niels Möller This file is part of GNU Nettle. @@ -237,6 +237,7 @@ const struct ecc_curve nettle_secp_256r1 = ECC_PIPPENGER_K, ECC_PIPPENGER_C, + ECC_ADD_JJJ_ITCH (ECC_LIMB_SIZE), ECC_MUL_A_ITCH (ECC_LIMB_SIZE), ECC_MUL_G_ITCH (ECC_LIMB_SIZE), ECC_J_TO_A_ITCH (ECC_LIMB_SIZE), @@ -246,6 +247,7 @@ const struct ecc_curve nettle_secp_256r1 = USE_REDC ? ecc_256_redc : ecc_256_modp, ecc_256_modq, + ecc_add_jjj, ecc_mul_a, ecc_mul_g, ecc_j_to_a, diff --git a/ecc-384.c b/ecc-384.c index 99f07266ac27916bdee82304ceb8137a7b50ed0c..3145afe1481ef2ef2f88e8fc434cf60f8d1c446b 100644 --- a/ecc-384.c +++ b/ecc-384.c @@ -2,7 +2,7 @@ Compile time constant (but machine dependent) tables. - Copyright (C) 2013 Niels Möller + Copyright (C) 2013, 2014 Niels Möller This file is part of GNU Nettle. @@ -159,6 +159,7 @@ const struct ecc_curve nettle_secp_384r1 = ECC_PIPPENGER_K, ECC_PIPPENGER_C, + ECC_ADD_JJJ_ITCH (ECC_LIMB_SIZE), ECC_MUL_A_ITCH (ECC_LIMB_SIZE), ECC_MUL_G_ITCH (ECC_LIMB_SIZE), ECC_J_TO_A_ITCH (ECC_LIMB_SIZE), @@ -168,6 +169,7 @@ const struct ecc_curve nettle_secp_384r1 = ecc_384_modp, ecc_generic_modq, + ecc_add_jjj, ecc_mul_a, ecc_mul_g, ecc_j_to_a, diff --git a/ecc-521.c b/ecc-521.c index cebf3e989a99dc972d7498feec97973dbfa4e0e1..b0c1ed92b1ca5c6c29b43259f8b27c53f803ff21 100644 --- a/ecc-521.c +++ b/ecc-521.c @@ -2,7 +2,7 @@ Compile time constant (but machine dependent) tables. - Copyright (C) 2013 Niels Möller + Copyright (C) 2013, 2014 Niels Möller This file is part of GNU Nettle. @@ -87,6 +87,7 @@ const struct ecc_curve nettle_secp_521r1 = ECC_PIPPENGER_K, ECC_PIPPENGER_C, + ECC_ADD_JJJ_ITCH (ECC_LIMB_SIZE), ECC_MUL_A_ITCH (ECC_LIMB_SIZE), ECC_MUL_G_ITCH (ECC_LIMB_SIZE), ECC_J_TO_A_ITCH (ECC_LIMB_SIZE), @@ -96,6 +97,7 @@ const struct ecc_curve nettle_secp_521r1 = ecc_521_modp, ecc_generic_modq, + ecc_add_jjj, ecc_mul_a, ecc_mul_g, ecc_j_to_a, diff --git a/ecc-internal.h b/ecc-internal.h index 1e0bb7ec2b280743c0d3e22fbd3473a3bef856a4..3da3f2403669ebe6d04d9fef5b5aa56750c65694 100644 --- a/ecc-internal.h +++ b/ecc-internal.h @@ -1,6 +1,6 @@ /* ecc-internal.h - Copyright (C) 2013 Niels Möller + Copyright (C) 2013, 2014 Niels Möller This file is part of GNU Nettle. @@ -82,6 +82,11 @@ modp_mul and modp_add. */ typedef void ecc_mod_func (const struct ecc_curve *ecc, mp_limb_t *rp); +typedef void ecc_add_func (const struct ecc_curve *ecc, + mp_limb_t *r, + const mp_limb_t *p, const mp_limb_t *q, + mp_limb_t *scratch); + typedef void ecc_mul_g_func (const struct ecc_curve *ecc, mp_limb_t *r, const mp_limb_t *np, mp_limb_t *scratch); @@ -116,6 +121,7 @@ struct ecc_curve unsigned short pippenger_k; unsigned short pippenger_c; + unsigned short add_hhh_itch; unsigned short mul_itch; unsigned short mul_g_itch; unsigned short h_to_a_itch; @@ -125,6 +131,7 @@ struct ecc_curve ecc_mod_func *reduce; ecc_mod_func *modq; + ecc_add_func *add_hhh; ecc_mul_func *mul; ecc_mul_g_func *mul_g; ecc_h_to_a_func *h_to_a;