[PATCH v2 6/6] mac80211: fils_aead: Use __cleanup() for aes_cmac_key instead of memzero_explicit()
From: Thomas Huth
Date: Fri Aug 07 2026 - 09:03:09 EST
From: Thomas Huth <thuth@xxxxxxxxxx>
By using __cleanup(aes_cmac_zeroize_key) for clearing the key data,
we can save one line of code here.
Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
---
net/mac80211/fils_aead.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c
index d2f4a17eab990..293590976489a 100644
--- a/net/mac80211/fils_aead.c
+++ b/net/mac80211/fils_aead.c
@@ -24,7 +24,7 @@ static int aes_s2v(const u8 *in_key, size_t key_len,
size_t num_elem, const u8 *addr[], size_t len[], u8 *v)
{
u8 d[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE] = {};
- struct aes_cmac_key key;
+ struct aes_cmac_key key __cleanup(aes_cmac_zeroize_key);
struct aes_cmac_ctx ctx;
size_t i;
int res;
@@ -62,7 +62,6 @@ static int aes_s2v(const u8 *in_key, size_t key_len,
aes_cmac_update(&ctx, d, AES_BLOCK_SIZE);
aes_cmac_final(&ctx, v);
- memzero_explicit(&key, sizeof(key));
return 0;
}
--
2.55.0