]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: bcm - Verify GCM/CCM key length in setkey
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 2 Oct 2020 07:55:22 +0000 (17:55 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Oct 2020 08:29:55 +0000 (10:29 +0200)
commitaafb6c5652ef9687b6734a4a99240f1fb9cf41b2
treeb1f43e5f3e9edf0175d348faef5a1ccba6158a77
parente47af171227445e71262a228f1b541deb1963b3d
crypto: bcm - Verify GCM/CCM key length in setkey

commit 10a2f0b311094ffd45463a529a410a51ca025f27 upstream.

The setkey function for GCM/CCM algorithms didn't verify the key
length before copying the key and subtracting the salt length.

This patch delays the copying of the key til after the verification
has been done.  It also adds checks on the key length to ensure
that it's at least as long as the salt.

Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")
Cc: <stable@vger.kernel.org>
Reported-by: kiyin(尹亮) <kiyin@tencent.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/bcm/cipher.c