diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index b41c858c..609820cf 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -515,11 +515,11 @@ void sodium_increment(unsigned char *n, const size_t nlen) { size_t i; - unsigned int c = 1U; + unsigned int c = 1U << 8; for (i = (size_t) 0U; i < nlen; i++) { + c >>= 8; c += n[i]; n[i] = (unsigned char) c; - c >>= 8; } }