From 94da855b8d28472ab08755defd59ec93585bbd63 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 24 Oct 2015 18:59:15 +0200 Subject: [PATCH] Add explicit signed/unsigned conversion --- .../curve25519/ref10/fe_cswap_curve25519_ref10.c | 2 +- src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c b/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c index f460674e..6bc2660f 100644 --- a/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c +++ b/src/libsodium/crypto_scalarmult/curve25519/ref10/fe_cswap_curve25519_ref10.c @@ -41,7 +41,7 @@ void fe_cswap(fe f,fe g,unsigned int b) crypto_int32 x7 = f7 ^ g7; crypto_int32 x8 = f8 ^ g8; crypto_int32 x9 = f9 ^ g9; - b = -b; + b = (unsigned int) (- (int) b); x0 &= b; x1 &= b; x2 &= b; diff --git a/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c b/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c index 8ca584fb..252adb9b 100644 --- a/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c +++ b/src/libsodium/crypto_sign/ed25519/ref10/fe_cmov.c @@ -39,7 +39,7 @@ void fe_cmov(fe f,const fe g,unsigned int b) crypto_int32 x7 = f7 ^ g7; crypto_int32 x8 = f8 ^ g8; crypto_int32 x9 = f9 ^ g9; - b = -b; + b = (unsigned int) (- (int) b); x0 &= b; x1 &= b; x2 &= b;