freebsd-skq/sys/crypto/openssl
John Baldwin d2e076c37b ossl: Don't encryt/decrypt too much data for chacha20.
The loops for Chacha20 and Chacha20+Poly1305 which encrypted/decrypted
full blocks of data used the minimum of the input and output segment
lengths to determine the size of the next chunk ('todo') to pass to
Chacha20_ctr32().  However, the input and output segments could extend
past the end of the ciphertext region into the tag (e.g.  if a "plain"
single mbuf contained an entire TLS record).  If the length of the tag
plus the length of the last partial block together were at least as
large as a full Chacha20 block (64 bytes), then an extra block was
encrypted/decrypted overlapping with the tag.  Fix this by also
capping the amount of data to encrypt/decrypt by the amount of
remaining data in the ciphertext region ('resid').

Reported by:	gallatin
Reviewed by:	cem, gallatin, markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D29517
2021-04-01 15:49:07 -07:00
..
aarch64 Merge OpenSSL 1.1.1i. 2020-12-09 02:05:14 +00:00
amd64
arm OpenSSL: Regen assembly files for OpenSSL 1.1.1j 2021-02-17 00:35:11 -05:00
i386
ossl_aarch64.c ossl: port to arm64 2020-12-04 21:12:17 +00:00
ossl_chacha20.c ossl: Don't encryt/decrypt too much data for chacha20. 2021-04-01 15:49:07 -07:00
ossl_chacha.h ossl: Add ChaCha20 cipher support. 2021-03-03 15:20:57 -08:00
ossl_hash.h
ossl_poly1305.c ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439 2021-03-03 15:20:57 -08:00
ossl_poly1305.h ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439 2021-03-03 15:20:57 -08:00
ossl_sha1.c
ossl_sha256.c
ossl_sha512.c
ossl_sha.h
ossl_x86.c ossl: split out x86 bits to x86/ossl_cpuid.c 2020-12-04 20:54:20 +00:00
ossl.c ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439 2021-03-03 15:20:57 -08:00
ossl.h ossl: Add support for the ChaCha20 + Poly1305 AEAD cipher from RFC 8439 2021-03-03 15:20:57 -08:00