]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
gcm - Fix rfc4543 decryption crash
authorHerbert Xu <20160318144240.GA20816@gondor.apana.org.au>
Thu, 17 Mar 2016 17:42:00 +0000 (02:42 +0900)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 26 Feb 2017 05:34:28 +0000 (21:34 -0800)
Orabug: 25243093

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>
Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
crypto/gcm.c

index b56200eff0293d2f2f590998e8220fc4112ad16e..33adbc4a4b51a3b0e0a00d83274c210b6c7dc1aa 100644 (file)
@@ -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);