|
@@ -117,7 +117,7 @@ swapout(uint8_t *out, limb_t *x) { |
|
|
memcpy(out,x,sizeof(fe)); |
|
|
memcpy(out,x,sizeof(fe)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void mul(fe out, const fe a, const fe b, unsigned nb) { |
|
|
|
|
|
|
|
|
static void mul(fe out, const fe a, const limb_t b[], unsigned nb) { |
|
|
/* GCC at least produces pretty decent asm for this, so don't need to have dedicated asm. */ |
|
|
/* GCC at least produces pretty decent asm for this, so don't need to have dedicated asm. */ |
|
|
limb_t accum[2*NLIMBS] = {0}; |
|
|
limb_t accum[2*NLIMBS] = {0}; |
|
|
unsigned i,j; |
|
|
unsigned i,j; |
|
@@ -188,9 +188,9 @@ static limb_t canon(fe x) { |
|
|
return ((dlimb_t)res - 1) >> X25519_WBITS; |
|
|
return ((dlimb_t)res - 1) >> X25519_WBITS; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static const limb_t a24[1]={121665}; |
|
|
|
|
|
|
|
|
static const limb_t a24[1] = { 121665 }; |
|
|
|
|
|
|
|
|
static void ladder_part1(fe xs[5]) { |
|
|
|
|
|
|
|
|
static void ladder_part1(fe xs[]) { |
|
|
limb_t *x2 = xs[0], *z2=xs[1],*x3=xs[2],*z3=xs[3],*t1=xs[4]; |
|
|
limb_t *x2 = xs[0], *z2=xs[1],*x3=xs[2],*z3=xs[3],*t1=xs[4]; |
|
|
add(t1,x2,z2); // t1 = A |
|
|
add(t1,x2,z2); // t1 = A |
|
|
sub(z2,x2,z2); // z2 = B |
|
|
sub(z2,x2,z2); // z2 = B |
|
@@ -216,7 +216,7 @@ static void ladder_part2(fe xs[5], const fe x1) { |
|
|
mul1(x2,t1); // x2 = AA*BB |
|
|
mul1(x2,t1); // x2 = AA*BB |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void x25519_core(fe xs[5], const uint8_t scalar[X25519_BYTES], const uint8_t *x1, int clamp) { |
|
|
|
|
|
|
|
|
static void x25519_core(fe xs[], const uint8_t scalar[X25519_BYTES], const uint8_t *x1, int clamp) { |
|
|
int i; |
|
|
int i; |
|
|
#if X25519_MEMCPY_PARAMS |
|
|
#if X25519_MEMCPY_PARAMS |
|
|
fe x1i; |
|
|
fe x1i; |
|
@@ -312,7 +312,7 @@ const uint8_t X25519_BASE_POINT[X25519_BYTES] = {9}; |
|
|
|
|
|
|
|
|
#if X25519_SUPPORT_VERIFY |
|
|
#if X25519_SUPPORT_VERIFY |
|
|
static limb_t x25519_verify_core( |
|
|
static limb_t x25519_verify_core( |
|
|
fe xs[5], |
|
|
|
|
|
|
|
|
fe xs[], |
|
|
const limb_t *other1, |
|
|
const limb_t *other1, |
|
|
const uint8_t other2[X25519_BYTES] |
|
|
const uint8_t other2[X25519_BYTES] |
|
|
) { |
|
|
) { |
|
|