Commit bef79bb9 authored by Eric Biggers's avatar Eric Biggers Committed by Ben Hutchings
Browse files

crypto: cts - fix crash on short inputs



In the CTS template, when the input length is <= one block cipher block
(e.g. <= 16 bytes for AES) pass the correct length to the underlying CBC
transform rather than one block.  This matches the upstream behavior and
makes the encryption/decryption operation correctly return -EINVAL when
1 <= nbytes < bsize or succeed when nbytes == 0, rather than crashing.

This was fixed upstream incidentally by a large refactoring,
commit 0605c41c ("crypto: cts - Convert to skcipher").  But
syzkaller easily trips over this when running on older kernels, as it's
easily reachable via AF_ALG.  Therefore, this patch makes the minimal
fix for older kernels.

Cc: linux-crypto@vger.kernel.org
Fixes: 76cb9521 ("[CRYPTO] cts: Add CTS mode required for Kerberos AES support")
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent b334b21e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment