summaryrefslogtreecommitdiff
path: root/ecc-internal.h
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-08-05 09:43:46 +0200
committerNiels Möller <nisse@lysator.liu.se>2017-09-18 21:48:26 +0200
commit9ae25aaa1cfc2749d1376ce52a68048263003e8c (patch)
tree795503b495a3b976468d5b70f0d6b6552cc249c9 /ecc-internal.h
parentecfc1125c8dc7c0866e21d92f9e177e52b1aa5a1 (diff)
downloadnettle-9ae25aaa1cfc2749d1376ce52a68048263003e8c.tar.gz
ecc: Add add_hh and dup members to ecc_curve
This makes it possible to share the same code for curve25519 and curve448 primitives, which use different underlying formulas for addition and doubling. Signed-off-by: Daiki Ueno <dueno@redhat.com>
Diffstat (limited to 'ecc-internal.h')
-rw-r--r--ecc-internal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/ecc-internal.h b/ecc-internal.h
index ce1e34fb..643277c0 100644
--- a/ecc-internal.h
+++ b/ecc-internal.h
@@ -112,6 +112,10 @@ typedef void ecc_add_func (const struct ecc_curve *ecc,
const mp_limb_t *p, const mp_limb_t *q,
mp_limb_t *scratch);
+typedef void ecc_dup_func (const struct ecc_curve *ecc,
+ mp_limb_t *r, const mp_limb_t *p,
+ 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);
@@ -168,12 +172,16 @@ struct ecc_curve
unsigned short pippenger_k;
unsigned short pippenger_c;
+ unsigned short add_hh_itch;
unsigned short add_hhh_itch;
+ unsigned short dup_itch;
unsigned short mul_itch;
unsigned short mul_g_itch;
unsigned short h_to_a_itch;
+ ecc_add_func *add_hh;
ecc_add_func *add_hhh;
+ ecc_dup_func *dup;
ecc_mul_func *mul;
ecc_mul_g_func *mul_g;
ecc_h_to_a_func *h_to_a;