Re: [PATCH 0/3] lib/crypto: Provide a function for zeroizing hmac_sha1_ctx
Thomas Huth <[email protected]>
| Newsgroups | org.kernel.vger.linux-crypto,org.kernel.vger.keyrings,org.kernel.vger.linux-integrity,org.kernel.vger.linux-kernel,org.kernel.vger.linux-security-module |
|---|---|
| Message-ID | <[email protected]> |
On 13/08/2026 04.27, Eric Biggers wrote: > On Wed, Aug 12, 2026 at 06:33:33PM +0200, Thomas Huth wrote: >> It's maybe not worth the effort for hmac_sha1_ctx right now (since there >> is only one spot that forgot to zeroize the structure in case of errors), >> but offering a function for zeroizing the data via __cleanup might help to >> get future code into the proper shape right from the start. Thus let's >> introduce a hmac_sha1_zeroize_ctx() function now and use it in the >> appropriate spots. >> >> Thomas Huth (3): >> crypto: Provide a wrapper for zeroizing hmac_sha1_ctx > > Subject prefix should be "lib/crypto: sha1:" > >> security: keys: trusted: always clear the hmac_sha1_ctx before >> returning >> lib/crypto: sha1: Use hmac_sha1_zeroize_ctx() instead of >> memzero_explicit() >> >> include/crypto/sha1.h | 17 +++++++++++++++++ >> lib/crypto/sha1.c | 2 +- >> security/keys/trusted-keys/trusted_tpm1.c | 2 +- >> 3 files changed, 19 insertions(+), 2 deletions(-) > > As you probably know, SHA-1 is a bit outdated. Will these be coming for > SHA-2 as well? It would be nice to introduce all the APIs at the same > time so that we can make sure they're consistent. I would actually > prioritize that over introducing callers of them right now, as that can > be done later and often requires acks from other maintainers (and they > can go through other trees as well). Yes, makes sense. I've got a patch for HMAC-SHA2 ready, too, but the patch that is using it on the calling site has a conflict with the smb patch that I already sent out, so I wanted to wait a little bit til that is merged: https://lore.kernel.org/lkml/[email protected]/ ... but if you're fine with a series that introduces the zeroization functions first, without immediately introducing callers, I'm happy to assemble such a patch series first! Thomas