Browse Source

new gcc thinks some arrays get overrun, they don't, change

slightly so it won't warn..

The [5] change is the biggest question, and not sure how to
fix it better than this..
main
John-Mark Gurney 1 year ago
parent
commit
4f1ee9b7c4
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      strobe/x25519.c

+ 5
- 5
strobe/x25519.c View File

@@ -117,7 +117,7 @@ swapout(uint8_t *out, limb_t *x) {
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. */
limb_t accum[2*NLIMBS] = {0};
unsigned i,j;
@@ -188,9 +188,9 @@ static limb_t canon(fe x) {
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];
add(t1,x2,z2); // t1 = A
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
}

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;
#if X25519_MEMCPY_PARAMS
fe x1i;
@@ -312,7 +312,7 @@ const uint8_t X25519_BASE_POINT[X25519_BYTES] = {9};

#if X25519_SUPPORT_VERIFY
static limb_t x25519_verify_core(
fe xs[5],
fe xs[],
const limb_t *other1,
const uint8_t other2[X25519_BYTES]
) {


Loading…
Cancel
Save