]> git.baikalelectronics.ru Git - kernel.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)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 8 Oct 2020 05:38:06 +0000 (16:38 +1100)
commit0a1362369c3f681e8068b2bb5fc25797ac4acfb9
tree94d9d26368ca785407ce84b986ced8084beaf565
parentf93fc97b33f6a67a54d2701b38791d4af68531b9
crypto: bcm - Verify GCM/CCM key length in setkey

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: fafe61d8dac2 ("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>
drivers/crypto/bcm/cipher.c