[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230110135042.2940847-6-vincent.whitchurch@axis.com>
Date: Tue, 10 Jan 2023 14:50:35 +0100
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: <herbert@...dor.apana.org.au>, <davem@...emloft.net>,
<jesper.nilsson@...s.com>, <lars.persson@...s.com>
CC: <kernel@...s.com>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
<linux-crypto@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 05/12] crypto: axis - validate AEAD authsize
Validate the AEAD authsize to fix errors like this with
CRYPTO_MANAGER_EXTRA_TESTS:
alg: aead: artpec-gcm-aes setauthsize unexpectedly succeeded on test
vector "random: alen=0 plen=60 authsize=6 klen=17 novrfy=0";
expected_error=-22
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
---
drivers/crypto/axis/artpec6_crypto.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
index 87f82c314e48..0ffe6e0045aa 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -1274,6 +1274,12 @@ static int artpec6_crypto_aead_set_key(struct crypto_aead *tfm, const u8 *key,
return 0;
}
+static int artpec6_crypto_aead_setauthsize(struct crypto_aead *tfm,
+ unsigned int authsize)
+{
+ return crypto_gcm_check_authsize(authsize);
+}
+
static int artpec6_crypto_aead_encrypt(struct aead_request *req)
{
int ret;
@@ -2829,6 +2835,7 @@ static struct aead_alg aead_algos[] = {
{
.init = artpec6_crypto_aead_init,
.setkey = artpec6_crypto_aead_set_key,
+ .setauthsize = artpec6_crypto_aead_setauthsize,
.encrypt = artpec6_crypto_aead_encrypt,
.decrypt = artpec6_crypto_aead_decrypt,
.ivsize = GCM_AES_IV_SIZE,
--
2.34.1
Powered by blists - more mailing lists