diff options
author | Daiki Ueno <dueno@redhat.com> | 2017-08-05 09:43:46 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2017-09-18 21:48:26 +0200 |
commit | 9ae25aaa1cfc2749d1376ce52a68048263003e8c (patch) | |
tree | 795503b495a3b976468d5b70f0d6b6552cc249c9 /ecc-mul-a-eh.c | |
parent | ecfc1125c8dc7c0866e21d92f9e177e52b1aa5a1 (diff) | |
download | nettle-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-mul-a-eh.c')
-rw-r--r-- | ecc-mul-a-eh.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ecc-mul-a-eh.c b/ecc-mul-a-eh.c index cf743236..e9b22cd4 100644 --- a/ecc-mul-a-eh.c +++ b/ecc-mul-a-eh.c @@ -75,8 +75,8 @@ ecc_mul_a_eh (const struct ecc_curve *ecc, { int digit; - ecc_dup_eh (ecc, r, r, scratch_out); - ecc_add_ehh (ecc, tp, r, pe, scratch_out); + ecc->dup (ecc, r, r, scratch_out); + ecc->add_hhh (ecc, tp, r, pe, scratch_out); digit = (w & bit) > 0; /* If we had a one-bit, use the sum. */ @@ -107,8 +107,8 @@ table_init (const struct ecc_curve *ecc, for (j = 2; j < size; j += 2) { - ecc_dup_eh (ecc, TABLE(j), TABLE(j/2), scratch); - ecc_add_ehh (ecc, TABLE(j+1), TABLE(j), TABLE(1), scratch); + ecc->dup (ecc, TABLE(j), TABLE(j/2), scratch); + ecc->add_hhh (ecc, TABLE(j+1), TABLE(j), TABLE(1), scratch); } } @@ -163,11 +163,11 @@ ecc_mul_a_eh (const struct ecc_curve *ecc, bits |= w >> shift; } for (j = 0; j < ECC_MUL_A_EH_WBITS; j++) - ecc_dup_eh (ecc, r, r, scratch_out); + ecc->dup (ecc, r, r, scratch_out); bits &= TABLE_MASK; sec_tabselect (tp, 3*ecc->p.size, table, TABLE_SIZE, bits); - ecc_add_ehh (ecc, r, tp, r, scratch_out); + ecc->add_hhh (ecc, r, tp, r, scratch_out); } #undef table #undef tp |