summaryrefslogtreecommitdiff
path: root/ecc-point-mul.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2014-08-25 21:22:40 +0200
committerNiels Möller <nisse@lysator.liu.se>2014-08-25 21:23:20 +0200
commitcc86df70d98be60a5a299d22a37623a61b5ed0b0 (patch)
treee49fb80c8b1ad74098fd909fbb9ddb0f9afd817c /ecc-point-mul.c
parenta45118aa18568472d7fb7a614b8ea5721f89d1ef (diff)
downloadnettle-cc86df70d98be60a5a299d22a37623a61b5ed0b0.tar.gz
curve25519 support for ecc_point_mul, ecc_point_mul_g, and ecdh-test.
Diffstat (limited to 'ecc-point-mul.c')
-rw-r--r--ecc-point-mul.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ecc-point-mul.c b/ecc-point-mul.c
index 09d4f642..2080b608 100644
--- a/ecc-point-mul.c
+++ b/ecc-point-mul.c
@@ -44,14 +44,15 @@ void
ecc_point_mul (struct ecc_point *r, const struct ecc_scalar *n,
const struct ecc_point *p)
{
- mp_limb_t size = p->ecc->size;
- mp_size_t itch = 3*size + ECC_MUL_A_ITCH (size);
+ const struct ecc_curve *ecc = r->ecc;
+ mp_limb_t size = ecc->size;
+ mp_size_t itch = 3*size + ecc->mul_itch;
mp_limb_t *scratch = gmp_alloc_limbs (itch);
- assert (n->ecc == p->ecc);
- assert (r->ecc == p->ecc);
+ assert (n->ecc == ecc);
+ assert (p->ecc == ecc);
- ecc_mul_a (p->ecc, scratch, n->p, p->p, scratch + 3*size);
- ecc_j_to_a (r->ecc, 1, r->p, scratch, scratch + 3*size);
+ ecc->mul (ecc, scratch, n->p, p->p, scratch + 3*size);
+ ecc->h_to_a (ecc, 1, r->p, scratch, scratch + 3*size);
gmp_free_limbs (scratch, itch);
}