Skip to content

Commit

Permalink
Decrement and shift in separate steps
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Oct 23, 2024
1 parent 409b3a7 commit 96d115c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,10 @@ static unsigned char
equal(signed char b, signed char c)
{
const unsigned char x = (unsigned char) b ^ (unsigned char) c; /* 0: yes; 1..255: no */
const uint32_t y = (uint32_t) x; /* 0: yes; 1..255: no */
uint32_t y = (uint32_t) x; /* 0: yes; 1..255: no */

return (((y - 1) >> 29) ^ optblocker_u8) >> 2; /* 1: yes; 0: no */
y--;
return ((y >> 29) ^ optblocker_u8) >> 2; /* 1: yes; 0: no */
}

static unsigned char
Expand Down

0 comments on commit 96d115c

Please sign in to comment.