From 96d115cf29d0d4e1b900b46b9bdff865e5d5ff17 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 23 Oct 2024 19:44:58 +0200 Subject: [PATCH] Decrement and shift in separate steps --- src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c index 04b73479..9e66b43b 100644 --- a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c +++ b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c @@ -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