From 43909c1ffb9685636cefaccf469e0b5a1906201a Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 12 Sep 2018 08:40:22 +0200 Subject: [PATCH] Allow ic + mlen to overflow a size_t in chacha20_ietf_xor_ic() --- src/libsodium/crypto_stream/chacha20/stream_chacha20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsodium/crypto_stream/chacha20/stream_chacha20.c b/src/libsodium/crypto_stream/chacha20/stream_chacha20.c index be1577f3..c98d6090 100644 --- a/src/libsodium/crypto_stream/chacha20/stream_chacha20.c +++ b/src/libsodium/crypto_stream/chacha20/stream_chacha20.c @@ -133,7 +133,7 @@ crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m, const unsigned char *k) { if ((unsigned long long) ic > - crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX / 64ULL - (mlen + 63ULL) / 64ULL) { + (64ULL * (1ULL << 32)) / 64ULL - (mlen + 63ULL) / 64ULL) { sodium_misuse(); } return crypto_stream_chacha20_ietf_ext_xor_ic(c, m, mlen, n, ic, k);