mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Stronger types for >= 16 bits shifts
This commit is contained in:
@@ -180,7 +180,7 @@ static const char *from_base64(void *dst, size_t *dst_len, const char *src) {
|
||||
* otherwise, only 0, 2 or 4 bits are buffered. The buffered
|
||||
* bits must also all be zero.
|
||||
*/
|
||||
if (acc_len > 4 || (acc & (((unsigned)1 << acc_len) - 1)) != 0) {
|
||||
if (acc_len > 4 || (acc & ((1U << acc_len) - 1)) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
*dst_len = len;
|
||||
|
||||
+1
-1
@@ -275,7 +275,7 @@ escrypt_kdf_nosse(escrypt_local_t * local,
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) {
|
||||
if ((uint64_t)(r) * (uint64_t)(p) >= ((uint64_t) 1 << 30)) {
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -324,7 +324,7 @@ escrypt_kdf_sse(escrypt_local_t * local,
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if ((uint64_t)(r) * (uint64_t)(p) >= (1 << 30)) {
|
||||
if ((uint64_t)(r) * (uint64_t)(p) >= ((uint64_t) 1 << 30)) {
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user