secp256k1 will use the same code, but slightly different dup function. Use indirection to make it possible to support secp256k1 curve.
Signed-off-by: Dmitry Eremin-Solenikov dbaryshkov@gmail.com --- ecc-mul-a.c | 6 +++--- ecc-mul-g.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ecc-mul-a.c b/ecc-mul-a.c index cb9c7d418633..2ed9084cb829 100644 --- a/ecc-mul-a.c +++ b/ecc-mul-a.c @@ -76,7 +76,7 @@ ecc_mul_a (const struct ecc_curve *ecc, { int digit;
- ecc_dup_jj (ecc, r, r, scratch_out); + ecc->dup (ecc, r, r, scratch_out); ecc_add_jja (ecc, tp, r, pj, scratch_out);
digit = (w & bit) > 0; @@ -110,7 +110,7 @@ table_init (const struct ecc_curve *ecc,
for (j = 2; j < size; j += 2) { - ecc_dup_jj (ecc, TABLE(j), TABLE(j/2), scratch); + ecc->dup (ecc, TABLE(j), TABLE(j/2), scratch); ecc_add_jja (ecc, TABLE(j+1), TABLE(j), TABLE(1), scratch); } } @@ -168,7 +168,7 @@ ecc_mul_a (const struct ecc_curve *ecc, bits |= w >> shift; } for (j = 0; j < ECC_MUL_A_WBITS; j++) - ecc_dup_jj (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); diff --git a/ecc-mul-g.c b/ecc-mul-g.c index c4a1b5bbab19..c588ca10ae29 100644 --- a/ecc-mul-g.c +++ b/ecc-mul-g.c @@ -64,7 +64,7 @@ ecc_mul_g (const struct ecc_curve *ecc, mp_limb_t *r,
for (i = k, is_zero = 1; i-- > 0; ) { - ecc_dup_jj (ecc, r, r, scratch); + ecc->dup (ecc, r, r, scratch); for (j = 0; j * c < bit_rows; j++) { unsigned bits;