[Bionic,SRU,2/4] crypto: cfb - fix decryption
diff mbox series

Message ID 20190823220825.25608-3-connor.kuehl@canonical.com
State New
Headers show
  • Fix build for crypto/testmgr.o
Related show

Commit Message

Connor Kuehl Aug. 23, 2019, 10:08 p.m. UTC
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1841264

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>
(cherry picked from commit fa4600734b74f74d9169c3015946d4722f8bcf79)
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
 crypto/cfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/crypto/cfb.c b/crypto/cfb.c
index 94ee39bed758..0ae43945e435 100644
--- a/crypto/cfb.c
+++ b/crypto/cfb.c
@@ -145,7 +145,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;