mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/4] crypto: fips - Add back the lost key length checks to the hmac(sha*) algorithms
@ 2026-12-03  9:33 Thomas Huth
  2026-12-03  9:33 ` [PATCH v2 1/4] crypto: fips - Add a wrapper function for checking the HMAC key length Thomas Huth
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thomas Huth @ 2026-12-03  9:33 UTC (permalink / raw)
  To: Herbert Xu, linux-crypto
  Cc: David S. Miller, Eric Biggers, linux-kernel, stable

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-03  9:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03  9:33 [PATCH v2 0/4] crypto: fips - Add back the lost key length checks to the hmac(sha*) algorithms Thomas Huth
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: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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®