stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: gcm - Fix rfc4543 decryption crash
@ 2016-03-18 14:42 Herbert Xu
  2016-03-18 17:34 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Herbert Xu @ 2016-03-18 14:42 UTC (permalink / raw)
  To: stable, Linux Crypto Mailing List, Jussi Kivilinna, patrick.meyer

This bug has already bee fixed upstream since 4.2.  However, it
was fixed during the AEAD conversion so no fix was backported to
the older kernels.

When we do an RFC 4543 decryption, we will end up writing the
ICV beyond the end of the dst buffer.  This should lead to a
crash but for some reason it was never noticed.

This patch fixes it by only writing back the ICV for encryption.

Fixes: d733ac90f9fe ("crypto: gcm - fix rfc4543 to handle async...")
Reported-by: Patrick Meyer <patrick.meyer@vasgard.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/crypto/gcm.c b/crypto/gcm.c
index b4c2520..cd97cdd 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -1173,6 +1173,9 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,
 	aead_request_set_tfm(subreq, ctx->child);
 	aead_request_set_callback(subreq, req->base.flags, crypto_rfc4543_done,
 				  req);
+	if (!enc)
+		aead_request_set_callback(subreq, req->base.flags,
+					  req->base.complete, req->base.data);
 	aead_request_set_crypt(subreq, cipher, cipher, enc ? 0 : authsize, iv);
 	aead_request_set_assoc(subreq, assoc, assoclen);
 
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-05-15 19:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18 14:42 [PATCH] crypto: gcm - Fix rfc4543 decryption crash Herbert Xu
2016-03-18 17:34 ` Greg KH
2016-03-19  2:23   ` Herbert Xu
2016-04-26 11:42     ` Ben Hutchings
2016-04-27  4:17       ` Herbert Xu
2016-05-15 19:48         ` Ben Hutchings
2016-04-26 21:05 ` Ben Hutchings
2016-05-01 22:59 ` Patch "crypto: gcm - Fix rfc4543 decryption crash" has been added to the 3.14-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).