2020-11-03 Niels Möller <nisse@lysator.liu.se>
+ * ecc-internal.h (ecc_add_func): Document in-place operation.
+ * ecc-mul-a-eh.c (ecc_mul_a_eh): Fix call to ecc->add_hhh accordingly.
+ * testsuite/ecc-add-test.c (test_main): Likewise.
+
* ecc-add-eh.c (ecc_add_eh): Reduce scratch need.
* ecc-add-th.c (ecc_add_th): Analogous changes.
* ecc-internal.h (ECC_ADD_EH_ITCH, ECC_ADD_TH_ITCH): Now 4*size.
const mp_limb_t *up, const mp_limb_t *vp,
mp_limb_t *scratch);
+/* Allows in-place operation with r == p, but not r == q */
typedef void ecc_add_func (const struct ecc_curve *ecc,
mp_limb_t *r,
const mp_limb_t *p, const mp_limb_t *q,
bits &= TABLE_MASK;
sec_tabselect (tp, 3*ecc->p.size, table, TABLE_SIZE, bits);
- ecc->add_hhh (ecc, r, tp, r, scratch_out);
+ ecc->add_hhh (ecc, r, r, tp, scratch_out);
}
#undef table
#undef tp
ecc->add_hh (ecc, p, z, z, scratch);
test_ecc_mul_h (i, 0, p);
- ecc->add_hhh (ecc, p, g, p, scratch);
+ ecc->add_hhh (ecc, p, p, g, scratch);
test_ecc_mul_h (i, 1, p);
ecc->add_hh (ecc, p, z, g, scratch);