]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit4a92ffb3a59623a4f7e0b0cb5c99326893cf2bd3
treedf5baadd680fa2fe9f49839765d049086e210a8a
parente61c3c8321f21276e53637727b1e8bcc89c3a02f
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: f703c2d64a0e ("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