[PATCH 0/4] crypto: Add back the lost FIPS key length checks to the hmac(sha*) algorithms
From: Thomas Huth
Date: Tue Dec 01 2026 - 13:47:40 EST
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
libcrypto. Thus add the key length check to the crypto/sha*.c files, too,
to be compliant again with the FIPS requirements.
(I've fixed each file in a separate patch to ease backporting if required)
Thomas Huth (4):
crypto: Add a wrapper function for checking the HMAC key length in
FIPS mode
crypto: Add back the lost FIPS key length check to the hmac(sha1)
algorithm
crypto: Add back the lost FIPS key length check to the hmac(sha256)
algorithm
crypto: Add back the lost FIPS key length check to the hmac(sha512)
algorithm
crypto/hmac.c | 2 +-
crypto/sha1.c | 4 ++++
crypto/sha256.c | 7 +++++++
crypto/sha512.c | 7 +++++++
include/linux/fips.h | 9 +++++++++
5 files changed, 28 insertions(+), 1 deletion(-)
--
2.56.1