From 1deb0b8812b18994a070ef8c5b23890a05325779 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 23 Oct 2024 18:54:54 +0200 Subject: [PATCH] More optblocker usage --- src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c index c522eb4629..66e8d89b94 100644 --- a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c +++ b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c @@ -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) @@ -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