freebsd-nq/sys/crypto
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
..
aesni aesni: Ensure that key schedules are aligned 2021-01-18 17:07:56 -05:00
armv8 armv8crypto: note derivation in armv8_crypto_wrap.c 2021-03-19 10:53:49 -03:00
blake2 Add a <machine/fpu.h> for i386 that includes <machine/npx.h>. 2020-10-13 17:26:12 +00:00
camellia
ccp Revert r366943. It did not work as expected. 2020-12-11 00:42:53 +00:00
chacha20 Consistently use C99 fixed-width types in the in-kernel crypto code. 2020-11-03 22:27:54 +00:00
des Add CFI start/end proc directives to arm64, i386, and ppc 2020-12-05 00:33:28 +00:00
libsodium Bring in compatibility glue for libsodium 2018-08-17 00:27:56 +00:00
openssl ossl: Don't encryt/decrypt too much data for chacha20. 2021-04-01 15:49:07 -07:00
rc4
rijndael Consistently use C99 fixed-width types in the in-kernel crypto code. 2020-11-03 22:27:54 +00:00
sha2 libmd: Always erase context in _Final method, and when doing 2018-07-20 07:01:28 +00:00
siphash
skein Consistently use C99 fixed-width types in the in-kernel crypto code. 2020-11-03 22:27:54 +00:00
via Add a <machine/fpu.h> for i386 that includes <machine/npx.h>. 2020-10-13 17:26:12 +00:00
intake.h
sha1.c Replace some K&R function definitions with ANSI C. 2020-11-03 22:32:30 +00:00
sha1.h Consistently use C99 fixed-width types in the in-kernel crypto code. 2020-11-03 22:27:54 +00:00