linux-stable/lib/crypto
Jason A. Donenfeld c9cc0517bb crypto: chacha20poly1305 - prevent integer overflow on large input
This code assigns src_len (size_t) to sl (int), which causes problems
when src_len is very large. Probably nobody in the kernel should be
passing this much data to chacha20poly1305 all in one go anyway, so I
don't think we need to change the algorithm or introduce larger types
or anything. But we should at least error out early in this case and
print a warning so that we get reports if this does happen and can look
into why anybody is possibly passing it that much data or if they're
accidently passing -1 or similar.

Fixes: d95312a3cc ("crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine")
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: stable@vger.kernel.org # 5.5+
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-02-14 14:48:37 +08:00
..
Kconfig crypto: x86/poly1305 - wire up faster implementations for kernel 2020-01-16 15:18:12 +08:00
Makefile crypto: curve25519 - Fix selftest build error 2020-01-16 15:18:13 +08:00
aes.c crypto: aes - helper function to validate key length for AES algorithms 2019-08-09 15:11:43 +10:00
arc4.c
blake2s-generic.c crypto: blake2s - generic C library implementation and selftest 2019-11-17 09:02:42 +08:00
blake2s-selftest.c crypto: blake2s - generic C library implementation and selftest 2019-11-17 09:02:42 +08:00
blake2s.c crypto: blake2s - generic C library implementation and selftest 2019-11-17 09:02:42 +08:00
chacha.c crypto: chacha - move existing library code into lib/crypto 2019-11-17 09:02:39 +08:00
chacha20poly1305-selftest.c crypto: chacha20poly1305 - add back missing test vectors and test chunking 2020-01-22 16:21:11 +08:00
chacha20poly1305.c crypto: chacha20poly1305 - prevent integer overflow on large input 2020-02-14 14:48:37 +08:00
curve25519-fiat32.c crypto: lib/curve25519 - work around Clang stack spilling issue 2019-11-17 09:02:43 +08:00
curve25519-generic.c crypto: curve25519 - Fix selftest build error 2020-01-16 15:18:13 +08:00
curve25519-hacl64.c crypto: curve25519 - generic C library implementations 2019-11-17 09:02:43 +08:00
curve25519-selftest.c crypto: lib/curve25519 - re-add selftests 2019-12-27 18:18:03 +08:00
curve25519.c crypto: curve25519 - Fix selftest build error 2020-01-16 15:18:13 +08:00
des.c crypto: des - split off DES library from generic DES cipher driver 2019-08-22 14:57:33 +10:00
libchacha.c crypto: chacha - move existing library code into lib/crypto 2019-11-17 09:02:39 +08:00
poly1305-donna32.c crypto: poly1305 - add new 32 and 64-bit generic versions 2020-01-16 15:18:12 +08:00
poly1305-donna64.c crypto: poly1305 - add new 32 and 64-bit generic versions 2020-01-16 15:18:12 +08:00
poly1305.c crypto: poly1305 - add new 32 and 64-bit generic versions 2020-01-16 15:18:12 +08:00
sha256.c crypto: sha256 - Remove sha256/224_init code duplication 2019-09-05 14:54:54 +10:00