Skip to content

Commit

Permalink
More optblocker usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Oct 23, 2024
1 parent b1f9c53 commit 1deb0b8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ slide_vartime(signed char *r, const unsigned char *a)
}

static volatile unsigned char optblocker_u8;
static volatile uint64_t optblocker_u64;

int
ge25519_frombytes(ge25519_p3 *h, const unsigned char *s)
Expand Down Expand Up @@ -619,11 +620,9 @@ static unsigned char
negative(signed char b)
{
/* 18446744073709551361..18446744073709551615: yes; 0..255: no */
uint64_t x = b;
const uint64_t x = (uint64_t) b;

x >>= 63; /* 1: yes; 0: no */

return x;
return ((x >> 61) ^ optblocker_u64) >> 2; /* 1: yes; 0: no */
}

static void
Expand Down

0 comments on commit 1deb0b8

Please sign in to comment.