[PATCH v2 5/9] crypto: sa2ul - clear the crypto_aes_ctx when done
Thomas Huth <[email protected]> Mon, 3 Aug 2026 11:44:24 +0200
| Newsgroups | org.kernel.vger.linux-crypto,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Thomas Huth <[email protected]> Clear the crypto_aes_ctx structure via __cleanup(aes_clear_ctx) when we're done with it to avoid that key data could leak on the stack. Signed-off-by: Thomas Huth <[email protected]> --- drivers/crypto/sa2ul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c index d865fd4a098cb..b921993d86a7b 100644 --- a/drivers/crypto/sa2ul.c +++ b/drivers/crypto/sa2ul.c @@ -465,7 +465,7 @@ static void sa_prepare_iopads(struct algo_data *data, const u8 *key, /* Derive the inverse key used in AES-CBC decryption operation */ static inline int sa_aes_inv_key(u8 *inv_key, const u8 *key, u16 key_sz) { - struct crypto_aes_ctx ctx; + struct crypto_aes_ctx ctx __cleanup(aes_clear_ctx); int key_pos; if (aes_expandkey(&ctx, key, key_sz)) { -- 2.55.0