diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index 9c844c6e..0ef05abd 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -108,14 +108,14 @@ sodium_bin2hex(char * const hex, const size_t hex_maxlen, while (i < bin_len) { c = bin[i] & 0xf; b = bin[i] >> 4; - x = (unsigned char) (87 + c + (((c - 10) >> 31) & -39)) << 8 | - (unsigned char) (87 + b + (((b - 10) >> 31) & -39)); + x = (unsigned char) (87U + c + (((c - 10U) >> 8) & ~38U)) << 8 | + (unsigned char) (87U + b + (((b - 10U) >> 8) & ~38U)); hex[i * 2U] = (char) x; x >>= 8; hex[i * 2U + 1U] = (char) x; i++; } - hex[i * 2U] = 0; + hex[i * 2U] = 0U; return hex; }