Rename fe25519_scalar_product, use it for all multiplications by A

This commit is contained in:
Frank Denis 2020-04-23 11:16:05 +02:00
parent 73aa0ebad2
commit 9786e40501
4 changed files with 5 additions and 5 deletions

View File

@ -2540,13 +2540,13 @@ ge25519_elligator2(unsigned char s[32], const fe25519 r, const unsigned char x_s
fe25519_sq2(rr2, r); fe25519_sq2(rr2, r);
rr2[0]++; rr2[0]++;
fe25519_invert(rr2, rr2); fe25519_invert(rr2, rr2);
fe25519_mul(x, curve25519_A, rr2); fe25519_mul32(x, curve25519_A[0], rr2);
fe25519_neg(x, x); fe25519_neg(x, x);
fe25519_sq(x2, x); fe25519_sq(x2, x);
fe25519_mul(x3, x, x2); fe25519_mul(x3, x, x2);
fe25519_add(e, x3, x); fe25519_add(e, x3, x);
fe25519_mul(x2, x2, curve25519_A); fe25519_mul32(x2, x2, curve25519_A[0]);
fe25519_add(e, x2, e); fe25519_add(e, x2, e);
chi25519(e, e); chi25519(e, e);

View File

@ -123,7 +123,7 @@ crypto_scalarmult_curve25519_ref10(unsigned char *q,
fe25519_mul(x2, tmp1, tmp0); fe25519_mul(x2, tmp1, tmp0);
fe25519_sub(tmp1, tmp1, tmp0); fe25519_sub(tmp1, tmp1, tmp0);
fe25519_sq(z2, z2); fe25519_sq(z2, z2);
fe25519_scalar_product(z3, tmp1, 121666); fe25519_mul32(z3, tmp1, 121666);
fe25519_sq(x3, x3); fe25519_sq(x3, x3);
fe25519_add(tmp0, tmp0, z3); fe25519_add(tmp0, tmp0, z3);
fe25519_mul(z3, x1, z2); fe25519_mul(z3, x1, z2);

View File

@ -979,7 +979,7 @@ fe25519_sq2(fe25519 h, const fe25519 f)
} }
static void static void
fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) fe25519_mul32(fe25519 h, const fe25519 f, uint32_t n)
{ {
int64_t sn = (int64_t) n; int64_t sn = (int64_t) n;
int32_t f0 = f[0]; int32_t f0 = f[0];

View File

@ -490,7 +490,7 @@ fe25519_sq2(fe25519 h, const fe25519 f)
} }
static void static void
fe25519_scalar_product(fe25519 h, const fe25519 f, uint32_t n) fe25519_mul32(fe25519 h, const fe25519 f, uint32_t n)
{ {
const uint64_t mask = 0x7ffffffffffffULL; const uint64_t mask = 0x7ffffffffffffULL;
uint128_t a; uint128_t a;