The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/6] crypto: Add __cleanup functions for zeroizing aes_cmac_key & aes_cmac_ctx
@ 2026-08-05 14:36 Thomas Huth
  2026-08-05 14:36 ` [PATCH 1/6] crypto: Provide wrapper functions for zeroizing aes_cmac_key and aes_cmac_ctx Thomas Huth
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Thomas Huth @ 2026-08-05 14:36 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Eric Biggers; +Cc: linux-crypto, linux-kernel

Code that uses AES-CMAC might need to zeroize their local aes_cmac_key
and/or aes_cmac_ctx structures after use to avoid leaking sensitive
material on the stack.

The first patch introduces an aes_cmac_zeroize_key() and an
aes_cmac_zeroize_ctx() helper function that can be used with __cleanup()
to automatically clear the key and context when they go out of scope.

Patches 2 - 3 add the __cleanup markers to spots in the code that
missed to clean up the structures so far.

The final two patches are just cosmetics and change some memzero_explicit()
calls to use the __cleanup() way instead.

Thomas Huth (6):
  crypto: Provide wrapper functions for zeroizing aes_cmac_key and
    aes_cmac_ctx
  smb: clear the aes_cmac_key and aes_cmac_ctx when done
  net/tcp-ao: clear the aes_cmac_key when done
  Bluetooth: SMP: clear the aes_cmac_key when done
  lib/crypto: aes: Use _cleanup() for aes_cmac_key instead of
    memzero_explicit()
  mac80211: fils_aead: Use _cleanup for aes_cmac_key instead of
    memzero_explicit

 fs/smb/client/smb2transport.c |  4 ++--
 fs/smb/server/auth.c          |  2 +-
 include/crypto/aes-cbc-macs.h | 26 ++++++++++++++++++++++++++
 lib/crypto/aes.c              |  3 +--
 net/bluetooth/smp.c           |  2 +-
 net/ipv4/tcp_ao.c             |  2 +-
 net/mac80211/fils_aead.c      |  3 +--
 7 files changed, 33 insertions(+), 9 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-08-06 13:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 14:36 [PATCH 0/6] crypto: Add __cleanup functions for zeroizing aes_cmac_key & aes_cmac_ctx Thomas Huth
2026-08-05 14:36 ` [PATCH 1/6] crypto: Provide wrapper functions for zeroizing aes_cmac_key and aes_cmac_ctx Thomas Huth
2026-08-05 20:37   ` Eric Biggers
2026-08-05 20:46   ` Eric Biggers
2026-08-05 14:36 ` [PATCH 2/6] smb: clear the aes_cmac_key and aes_cmac_ctx when done Thomas Huth
2026-08-05 21:12   ` Eric Biggers
2026-08-05 14:36 ` [PATCH 3/6] net/tcp-ao: clear the aes_cmac_key " Thomas Huth
2026-08-05 21:02   ` Eric Biggers
2026-08-06 13:06     ` Thomas Huth
2026-08-05 14:36 ` [PATCH 4/6] Bluetooth: SMP: " Thomas Huth
2026-08-05 20:46   ` Eric Biggers
2026-08-06 13:00     ` Thomas Huth
2026-08-05 14:36 ` [PATCH 5/6] lib/crypto: aes: Use _cleanup() for aes_cmac_key instead of memzero_explicit() Thomas Huth
2026-08-05 14:36 ` [PATCH 6/6] mac80211: fils_aead: Use _cleanup for aes_cmac_key instead of memzero_explicit Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox