vendor/libsodium/src/libsodium/sodium/utils.c in rbnacl-libsodium-1.0.5 vs vendor/libsodium/src/libsodium/sodium/utils.c in rbnacl-libsodium-1.0.6
- old
+ new
@@ -143,11 +143,13 @@
size_t i;
#if HAVE_WEAK_SYMBOLS
_sodium_dummy_symbol_to_prevent_compare_lto(b1, b2, len);
#endif
- for (i = (size_t) 0U; i < len; i++) {
+ i = len;
+ while (i != 0U) {
+ i--;
gt |= ((b2[i] - b1[i]) >> 8) & eq;
eq &= ((b2[i] ^ b1[i]) - 1) >> 8;
}
return (int) (gt + gt + eq) - 1;
}
@@ -389,10 +391,10 @@
# error Bug
# endif
}
static unsigned char *
-_unprotected_ptr_from_user_ptr(const void *ptr)
+_unprotected_ptr_from_user_ptr(void * const ptr)
{
uintptr_t unprotected_ptr_u;
unsigned char *canary_ptr;
size_t page_mask;