crypto: gcm - Fix rfc4543 decryption crash
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 18 Mar 2016 14:42:40 +0000 (22:42 +0800)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Jun 2016 08:42:50 +0000 (10:42 +0200)
commitb0b535780e3b4ddc29c76bafddf54d2c4f933322
tree9472c53a4e60e68e0b345a76b78d3c4b2cc8988a
parent7fbd6329c2f17ffcca4d846fac0ba2870ce7947b
crypto: gcm - Fix rfc4543 decryption crash

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
crypto/gcm.c