diff options
author | Niels Möller <nisse@lysator.liu.se> | 2014-09-22 12:39:19 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2014-09-22 12:39:19 +0200 |
commit | a78c9459fda9204b870350a3e075cd78d448fca2 (patch) | |
tree | 5570986a3a7ee931bc4a43b47b6fa62b6133e8cc /curve25519-mul-g.c | |
parent | 2b552abd4edc775de854014c7b0135902ca2ecd3 (diff) | |
download | nettle-a78c9459fda9204b870350a3e075cd78d448fca2.tar.gz |
Introduced struct ecc_modulo.
Diffstat (limited to 'curve25519-mul-g.c')
-rw-r--r-- | curve25519-mul-g.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/curve25519-mul-g.c b/curve25519-mul-g.c index 9aec180b..f2d39f78 100644 --- a/curve25519-mul-g.c +++ b/curve25519-mul-g.c @@ -49,23 +49,23 @@ curve25519_mul_g (uint8_t *r, const uint8_t *n) mp_limb_t *scratch; mp_size_t itch; -#define p scratch -#define x (scratch + 3*ecc->size) -#define scratch_out (scratch + 4*ecc->size) +#define ng scratch +#define x (scratch + 3*ecc->p.size) +#define scratch_out (scratch + 4*ecc->p.size) memcpy (t, n, sizeof(t)); t[0] &= ~7; t[CURVE25519_SIZE-1] = (t[CURVE25519_SIZE-1] & 0x3f) | 0x40; - itch = 4*ecc->size + ecc->mul_g_itch; + itch = 4*ecc->p.size + ecc->mul_g_itch; scratch = gmp_alloc_limbs (itch); - mpn_set_base256_le (x, ecc->size, t, CURVE25519_SIZE); + mpn_set_base256_le (x, ecc->p.size, t, CURVE25519_SIZE); - ecc_mul_g_eh (ecc, p, x, scratch_out); - curve25519_eh_to_x (x, p, scratch_out); + ecc_mul_g_eh (ecc, ng, x, scratch_out); + curve25519_eh_to_x (x, ng, scratch_out); - mpn_get_base256_le (r, CURVE25519_SIZE, x, ecc->size); + mpn_get_base256_le (r, CURVE25519_SIZE, x, ecc->p.size); gmp_free_limbs (scratch, itch); #undef p #undef x |