From: Eric Biggers <ebiggers@kernel.org>
To: Thomas Huth <thuth@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Neal Cardwell <ncardwell@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Kuniyuki Iwashima <kuniyu@google.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH 3/6] net/tcp-ao: clear the aes_cmac_key when done
Date: Wed, 5 Aug 2026 14:02:59 -0700 [thread overview]
Message-ID: <20260805210259.GI3438@quark> (raw)
In-Reply-To: <20260805143611.818559-4-thuth@redhat.com>
On Wed, Aug 05, 2026 at 04:36:06PM +0200, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Clear the local aes_cmac_key structure via __cleanup() function
> when we're done with it to avoid that sensitive data could leak on
> the stack.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> net/ipv4/tcp_ao.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c
> index a56bb79e15e0e..12c724fed8a26 100644
> --- a/net/ipv4/tcp_ao.c
> +++ b/net/ipv4/tcp_ao.c
> @@ -141,7 +141,7 @@ void tcp_ao_calc_traffic_key(const struct tcp_ao_key *mkt, u8 *traffic_key,
> traffic_key);
> return;
> case TCP_AO_ALGO_AES_128_CMAC: {
> - struct aes_cmac_key k;
> + struct aes_cmac_key k __cleanup(aes_cmac_zeroize_key);
>
> aes_cmac_preparekey(&k, mkt->key, AES_KEYSIZE_128);
> aes_cmac(&k, input, input_len, traffic_key);
Similar to the bluetooth patch: This is okay, but it seems the TCP-AO
code has never really tried to do key zeroization, which is why I didn't
include a memzero_explicit() here. Lots of cases, like the various
traffic key buffers, have never been zeroized and still aren't.
The '__cleanup' trick makes this specific case trivial enough that sure,
it might as well be done anyway. But it would be nice to have a more
comprehensive patch that actually tried to zeroize all TCP-AO keys.
Otherwise random individual fixes like this trickle in over time and it
takes a lot longer.
- Eric
next prev parent reply other threads:[~2026-08-05 21:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260805210259.GI3438@quark \
--to=ebiggers@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox