@@ -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,
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@axis.com> --- drivers/crypto/axis/artpec6_crypto.c | 7 +++++++ 1 file changed, 7 insertions(+)