From: Thomas Huth <thuth@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>, linux-crypto@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Biggers <ebiggers@kernel.org>
Subject: Re: [PATCH 1/4] crypto: Add a wrapper function for checking the HMAC key length in FIPS mode
Date: Tue, 1 Dec 2026 20:07:49 +0100 [thread overview]
Message-ID: <a8043c84-ffd9-4c11-8dc3-e858044e2841@redhat.com> (raw)
In-Reply-To: <sashiko-outbox-244002@kernel.org>
Am 01.12.26 um 19:52 schrieb sashiko-bot@kernel.org:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] crypto: hmac - use fips_hmac_keylen_disallowed() in
> hmac_setkey()
> --
>
> commit 4ffb5320ef4c37faa3b0412bbad1381631271b73
> Author: Thomas Huth <thuth@redhat.com>
>
> crypto: Add a wrapper function for checking the HMAC key length in FIPS mode
>
> This commit introduces a fips_hmac_keylen_disallowed() helper in
> include/linux/fips.h and converts hmac_setkey_ahash() in crypto/hmac.c
> to use it.
>
>> diff --git a/crypto/hmac.c b/crypto/hmac.c
>> index 807e08b252c55..53ed48deb4b5a 100644
>> --- a/crypto/hmac.c
>> +++ b/crypto/hmac.c
>> @@ -246,7 +246,7 @@ static int hmac_setkey_ahash(struct crypto_ahash *parent,
>> u8 *ipad = &tctx->pads[0];
>> int err, i;
>>
>> - if (fips_enabled && (keylen < 112 / 8))
>> + if (fips_hmac_keylen_disallowed(keylen))
>> return -EINVAL;
>
> [Severity: Low]
> Should hmac_setkey() in this file also use fips_hmac_keylen_disallowed()?
>
> crypto/hmac.c:hmac_setkey() {
> ...
> if (fips_enabled && (keylen < 112 / 8))
> return -EINVAL;
> ...
> }
Drat, I indeed missed the second location ... will fix it in v2.
Thomas
next prev parent reply other threads:[~2026-12-01 19:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 18:47 [PATCH 0/4] crypto: Add back the lost FIPS key length checks to the hmac(sha*) algorithms Thomas Huth
2026-12-01 18:47 ` [PATCH 1/4] crypto: Add a wrapper function for checking the HMAC key length in FIPS mode Thomas Huth
2026-12-01 18:52 ` sashiko-bot
2026-12-01 19:07 ` Thomas Huth [this message]
2026-12-02 6:46 ` Eric Biggers
2026-12-01 18:47 ` [PATCH 2/4] crypto: Add back the lost FIPS key length check to the hmac(sha1) algorithm Thomas Huth
2026-12-01 18:47 ` [PATCH 3/4] crypto: Add back the lost FIPS key length check to the hmac(sha256) algorithm Thomas Huth
2026-12-01 18:47 ` [PATCH 4/4] crypto: Add back the lost FIPS key length check to the hmac(sha512) algorithm Thomas Huth
2026-12-01 20:21 ` [PATCH 0/4] crypto: Add back the lost FIPS key length checks to the hmac(sha*) algorithms Eric Biggers
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=a8043c84-ffd9-4c11-8dc3-e858044e2841@redhat.com \
--to=thuth@redhat.com \
--cc=davem@davemloft.net \
--cc=ebiggers@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.