diff --git a/crypto_kem/sntrup653/clean/crypto_core_invsntrup653.c b/crypto_kem/sntrup653/clean/crypto_core_invsntrup653.c index 572abb39..98705b0f 100644 --- a/crypto_kem/sntrup653/clean/crypto_core_invsntrup653.c +++ b/crypto_kem/sntrup653/clean/crypto_core_invsntrup653.c @@ -15,7 +15,7 @@ static int int16_nonzero_mask(int16 x) { uint16 u = (uint16) x; /* 0, else 1...65535 */ uint32 v = u; /* 0, else 1...65535 */ - v = -v; /* 0, else 2^32-65535...2^32-1 */ + v = ~v + 1; /* 0, else 2^32-65535...2^32-1 */ v >>= 31; /* 0, else 1 */ return -(int) v; /* 0, else -1 */ } diff --git a/crypto_kem/sntrup761/clean/crypto_core_invsntrup761.c b/crypto_kem/sntrup761/clean/crypto_core_invsntrup761.c index 16afe697..dab970d4 100644 --- a/crypto_kem/sntrup761/clean/crypto_core_invsntrup761.c +++ b/crypto_kem/sntrup761/clean/crypto_core_invsntrup761.c @@ -15,7 +15,7 @@ static int int16_nonzero_mask(int16 x) { uint16 u = (uint16) x; /* 0, else 1...65535 */ uint32 v = u; /* 0, else 1...65535 */ - v = -v; /* 0, else 2^32-65535...2^32-1 */ + v = ~v + 1; /* 0, else 2^32-65535...2^32-1 */ v >>= 31; /* 0, else 1 */ return -(int) v; /* 0, else -1 */ } diff --git a/crypto_kem/sntrup857/clean/crypto_core_invsntrup857.c b/crypto_kem/sntrup857/clean/crypto_core_invsntrup857.c index 383f2951..a8737a97 100644 --- a/crypto_kem/sntrup857/clean/crypto_core_invsntrup857.c +++ b/crypto_kem/sntrup857/clean/crypto_core_invsntrup857.c @@ -15,7 +15,7 @@ static int int16_nonzero_mask(int16 x) { uint16 u = (uint16) x; /* 0, else 1...65535 */ uint32 v = u; /* 0, else 1...65535 */ - v = -v; /* 0, else 2^32-65535...2^32-1 */ + v = ~v + 1; /* 0, else 2^32-65535...2^32-1 */ v >>= 31; /* 0, else 1 */ return -(int) v; /* 0, else -1 */ }