diff --git a/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h index 9b5c2a8d..9f693e54 100644 --- a/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +++ b/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h @@ -54,7 +54,7 @@ size_t crypto_pwhash_scryptsalsa208sha256_opslimit_max(void); SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_memlimit_min(void); -#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX ((SIZE_MAX >= 68719476736U) ? : 68719476736U : SIZE_MAX) +#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX ((SIZE_MAX >= 68719476736U) ? 68719476736U : SIZE_MAX) SODIUM_EXPORT size_t crypto_pwhash_scryptsalsa208sha256_memlimit_max(void); diff --git a/src/libsodium/randombytes/randombytes.c b/src/libsodium/randombytes/randombytes.c index e1a109a3..dc0f81c3 100644 --- a/src/libsodium/randombytes/randombytes.c +++ b/src/libsodium/randombytes/randombytes.c @@ -169,9 +169,11 @@ randombytes_buf_deterministic(void * const buf, const size_t size, static const unsigned char zero[crypto_stream_chacha20_ietf_NONCEBYTES] = { 0 }; COMPILER_ASSERT(randombytes_SEEDBYTES == crypto_stream_chacha20_ietf_KEYBYTES); +#if SIZE_MAX > 0x4000000000ULL if (size > 0x4000000000ULL) { abort(); } +#endif crypto_stream_chacha20_ietf((unsigned char *) buf, (unsigned long long) size, zero, seed); }