Skip to content

Commit

Permalink
hydro_x25519_mul: don't specify the number of limbs in the prototype
Browse files Browse the repository at this point in the history
The ladder step requires a multiplication with (A-2)/4 which is small
enough to fit in a single limb, but the hydro_x25519_mul prototype
expected 5 limbs.

No code changes, but
fixes #123
  • Loading branch information
jedisct1 committed Mar 21, 2022
1 parent 4aaf273 commit 6da7fac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions impl/x25519.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,17 @@ hydro_x25519_swapout(uint8_t *out, hydro_x25519_limb_t *x)
}

static void
hydro_x25519_mul(hydro_x25519_fe out, const hydro_x25519_fe a, const hydro_x25519_fe b, int nb)
hydro_x25519_mul(hydro_x25519_fe out, const hydro_x25519_fe a, const hydro_x25519_limb_t b[],
const int nb)
{
hydro_x25519_limb_t accum[2 * hydro_x25519_NLIMBS] = { 0 };
hydro_x25519_limb_t carry2;
int i, j;

for (i = 0; i < nb; i++) {
carry2 = 0;
hydro_x25519_limb_t mand = b[i];
carry2 = 0;

for (j = 0; j < hydro_x25519_NLIMBS; j++) {
accum[i + j] = hydro_x25519_umaal(&carry2, accum[i + j], mand, a[j]);
}
Expand Down

0 comments on commit 6da7fac

Please sign in to comment.