public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
To: linux-crypto@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] crypto: fix cfb mode decryption
Date: Sat, 20 Oct 2018 02:01:52 +0300	[thread overview]
Message-ID: <20181019230153.28201-1-dbaryshkov@gmail.com> (raw)

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
---
 crypto/cfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/cfb.c b/crypto/cfb.c
index a0d68c09e1b9..fd4e8500e121 100644
--- a/crypto/cfb.c
+++ b/crypto/cfb.c
@@ -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;
-- 
2.19.1

             reply	other threads:[~2018-10-20  7:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 23:01 Dmitry Eremin-Solenikov [this message]
2018-10-19 23:01 ` [PATCH 2/2] crypto: testmgr: add AES-CFB tests Dmitry Eremin-Solenikov
2018-10-21  7:06   ` Ard Biesheuvel
2018-10-21  7:05 ` [PATCH 1/2] crypto: fix cfb mode decryption Ard Biesheuvel
2018-10-21  8:07   ` James Bottomley
2018-10-21  8:58     ` Ard Biesheuvel
2018-10-21  9:00       ` James Bottomley
2018-10-21  9:07         ` Ard Biesheuvel
2018-11-01  8:32     ` Dmitry Eremin-Solenikov
2018-11-01  8:41       ` Herbert Xu
2018-11-01  8:42         ` Dmitry Eremin-Solenikov
2018-11-09  9:52 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181019230153.28201-1-dbaryshkov@gmail.com \
    --to=dbaryshkov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox