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>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH v2 0/4] crypto: fips - Add back the lost key length checks to the hmac(sha*) algorithms
Date: Thu, 3 Dec 2026 10:33:12 +0100 [thread overview]
Message-ID: <20261203093316.97847-1-thuth@redhat.com> (raw)
The generic code in hmac_setkey() in crypto/hmac.c correctly rejects
keys with less than 112 bits in FIPS-compliance mode. However, this
check got lost when the hmac(sha*) algorithms were implemented via
the crypto library.
We noticed this behavioral change after backporting the corresponding
commits to an older kernel branch: One of our downstream tests checks
whether setting key length with less than 112 bits works in fips_enabled
mode, and this test started failing. Thus let's restore the same behavior
from kernel v6.16 and earlier by adding the key length check to the
crypto/sha*.c files, too.
Note: Please don't backport these patches to any kernel before 6.19, see:
https://lore.kernel.org/linux-crypto/20261201202148.GA501764@google.com/
v2:
- Moved the helper in the first patch out of the #ifdef and removed
superfluous macro
- Reworked patch descriptions and added notes to not backport this
to the 6.18 stable trees
Thomas Huth (4):
crypto: fips - Add a wrapper function for checking the HMAC key length
crypto: fips - Add back the lost key length check to the hmac(sha1)
algorithm
crypto: fips - Add back the lost key length check to the hmac(sha256)
algorithm
crypto: fips - Add back the lost key length check to the hmac(sha512)
algorithm
crypto/hmac.c | 4 ++--
crypto/sha1.c | 4 ++++
crypto/sha256.c | 7 +++++++
crypto/sha512.c | 7 +++++++
include/linux/fips.h | 7 +++++++
5 files changed, 27 insertions(+), 2 deletions(-)
--
2.56.1
next reply other threads:[~2026-12-03 9:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 9:33 Thomas Huth [this message]
2026-12-03 9:33 ` [PATCH v2 1/4] crypto: fips - Add a wrapper function for checking the HMAC key length Thomas Huth
2026-12-03 9:33 ` [PATCH v2 2/4] crypto: fips - Add back the lost key length check to the hmac(sha1) algorithm Thomas Huth
2026-12-03 9:50 ` sashiko-bot
2026-12-03 9:33 ` [PATCH v2 3/4] crypto: fips - Add back the lost key length check to the hmac(sha256) algorithm Thomas Huth
2026-12-03 9:33 ` [PATCH v2 4/4] crypto: fips - Add back the lost key length check to the hmac(sha512) algorithm Thomas Huth
2026-12-03 20:25 ` [PATCH v2 0/4] crypto: fips - Add back the lost 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=20261203093316.97847-1-thuth@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 \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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.