From 79a4cff0f092cf8dc144fab0ad7128fb7744a8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Thu, 28 Aug 2014 13:55:36 +0200 Subject: [PATCH] New ecc_curve function pointer, add_hhh. --- ecc-192.c | 4 +++- ecc-224.c | 4 +++- ecc-25519.c | 3 ++- ecc-256.c | 4 +++- ecc-384.c | 4 +++- ecc-521.c | 4 +++- ecc-internal.h | 9 ++++++++- 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ecc-192.c b/ecc-192.c index 5253cc13..91659763 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 2de193fe..29aa2f3f 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 bf27b1c7..996e6bdd 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 6d413330..1d2a5ec7 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 99f07266..3145afe1 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 cebf3e98..b0c1ed92 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 1e0bb7ec..3da3f240 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; -- GitLab