crypto: cfb - fix decryption
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Fri, 19 Oct 2018 23:01:52 +0000 (02:01 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 9 Nov 2018 09:40:59 +0000 (17:40 +0800)
crypto_cfb_decrypt_segment() incorrectly XOR'ed generated keystream with
IV, rather than with data stream, resulting in incorrect decryption.
Test vectors will be added in the next patch.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/cfb.c

index a0d68c09e1b9c53dd9eb4fb9bd08238d24b70d44..fd4e8500e1213bd9dd3af8118a094a5283dda308 100644 (file)
@@ -144,7 +144,7 @@ static int crypto_cfb_decrypt_segment(struct skcipher_walk *walk,
 
        do {
                crypto_cfb_encrypt_one(tfm, iv, dst);
-               crypto_xor(dst, iv, bsize);
+               crypto_xor(dst, src, bsize);
                iv = src;
 
                src += bsize;