summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2026-09-16 11:50:04 +0200
committerEric Biggers <ebiggers@kernel.org>2026-09-30 09:33:54 -0700
commitbde4dcd6cac5cbdaa3144adffeb3a0c1d9bba064 (patch)
tree1ebabeda3a48a8f6eb76f1e4b18d1d0a8dbf6556 /lib
parent72f4c2eae4036d0d5e63f9aa548c2688f8f99ff1 (diff)
downloadlinux-bde4dcd6cac5cbdaa3144adffeb3a0c1d9bba064.tar.gz
linux-bde4dcd6cac5cbdaa3144adffeb3a0c1d9bba064.zip
lib/crypto: aes-xts: Provide function for zeroizing aes_xts_key
In certain cases crypto code functions need to zeroize their local aes_xts_key structures after use to avoid leaking sensitive material. Provide an aes_xts_zeroize_key() helper function that e.g. can be used with __cleanup() to automatically zeroize the struct when it goes out of scope. While we're at it, replace the related memzero_explicit() call in lib/crypto/aes.c with a call to the new helper function. Signed-off-by: Thomas Huth <thuth@redhat.com> Link: https://patch.msgid.link/20260916095022.604354-3-thuth@redhat.com Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto/aes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/crypto/aes.c b/lib/crypto/aes.c
index 07c1d912ac36..34ef5deca0a7 100644
--- a/lib/crypto/aes.c
+++ b/lib/crypto/aes.c
@@ -1223,7 +1223,7 @@ int aes_xts_preparekey(struct aes_xts_key *key, const u8 *in_key,
return 0;
out_zeroize:
- memzero_explicit(key, sizeof(*key));
+ aes_xts_zeroize_key(key);
return err;
}
EXPORT_SYMBOL_GPL(aes_xts_preparekey);