Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Simon Richter <Simon.Richter@hogyros.de>
To: Eric Biggers <ebiggers@kernel.org>, Thomas Huth <thuth@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	Simo Sorce <simo@redhat.com>
Subject: Re: [PATCH v2 1/9] crypto: Provide a wrapper for zeroizing crypto_aes_ctx
Date: Tue, 4 Aug 2026 11:21:30 +0900	[thread overview]
Message-ID: <d7764cb3-152e-4b52-bed3-d23b45fce540@hogyros.de> (raw)
In-Reply-To: <20260803190540.GD2062@quark>

Hi,

On 8/4/26 4:05 AM, Eric Biggers wrote:

> I guess we should start using __cleanup with type-specific zeroization
> functions like this more often.
Frame challenge: should key material be copied that often that we need a 
mechanism to keep track of it?

My feeling is that this wasn't a conscious decision, but is the result 
of two other decisions (that individually make sense): contexts need to 
be self-contained (so need to include key material), and context 
creation should be cheap (so stack contexts are allowed).

So I can see two other approaches:

1. add a parameter to library functions that instructs them to clear the 
key material from the context. Most callers with the context on the 
stack could probably use that mechanism, and SIMD based implementations 
might even be able to do this rather early.

2. allow contexts to refer to key material stored elsewhere to avoid the 
copy. That opens the lifetime tracking can of worms, but the on-stack 
crypto context is rather short-lived.

    Simon

  reply	other threads:[~2026-08-04  2:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  9:44 [PATCH v2 0/9] crypto: Provide a function for zeroizing crypto_aes_ctx Thomas Huth
2026-08-03  9:44 ` [PATCH v2 1/9] crypto: Provide a wrapper " Thomas Huth
2026-08-03 19:05   ` Eric Biggers
2026-08-04  2:21     ` Simon Richter [this message]
2026-08-04  2:37       ` Eric Biggers
2026-08-04  7:42     ` Thomas Huth
2026-08-04 18:54       ` Eric Biggers
2026-08-03  9:44 ` [PATCH v2 2/9] crypto: aspeed - clear the crypto_aes_ctx when done Thomas Huth
2026-08-03  9:44 ` [PATCH v2 3/9] crypto: inside-secure/eip93 " Thomas Huth
2026-08-03  9:44 ` [PATCH v2 4/9] crypto: padlock-aes " Thomas Huth
2026-08-03  9:44 ` [PATCH v2 5/9] crypto: sa2ul " Thomas Huth
2026-08-03  9:44 ` [PATCH v2 6/9] crypto: arm/aes-neonbs " Thomas Huth
2026-08-03  9:44 ` [PATCH v2 7/9] crypto: arm64/aes-neonbs " Thomas Huth
2026-08-03  9:44 ` [PATCH v2 8/9] crypto: safexcel - zeroize crypto_aes_ctx with __cleanup(aes_clear_ctx) Thomas Huth
2026-08-03  9:44 ` [PATCH v2 9/9] crypto: qat " 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=d7764cb3-152e-4b52-bed3-d23b45fce540@hogyros.de \
    --to=simon.richter@hogyros.de \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=simo@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