]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - crypto/cfb.c
crypto: cfb - add missing 'chunksize' property
authorEric Biggers <ebiggers@google.com>
Fri, 4 Jan 2019 04:16:10 +0000 (20:16 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 11 Jan 2019 06:16:57 +0000 (14:16 +0800)
commit394a9e044702e6a8958a5e89d2a291605a587a2a
treedf5baadd680fa2fe9f49839765d049086e210a8a
parent1bb64d867cfe84cc3c255d8fdeff0b4d86341519
crypto: cfb - add missing 'chunksize' property

Like some other block cipher mode implementations, the CFB
implementation assumes that while walking through the scatterlist, a
partial block does not occur until the end.  But the walk is incorrectly
being done with a blocksize of 1, as 'cra_blocksize' is set to 1 (since
CFB is a stream cipher) but no 'chunksize' is set.  This bug causes
incorrect encryption/decryption for some scatterlist layouts.

Fix it by setting the 'chunksize'.  Also extend the CFB test vectors to
cover this bug as well as cases where the message length is not a
multiple of the block size.

Fixes: a7d85e06ed80 ("crypto: cfb - add support for Cipher FeedBack mode")
Cc: <stable@vger.kernel.org> # v4.17+
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/cfb.c
crypto/testmgr.h