From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796156510; b=HKb0d6Z1F4neFnoflRXQ+O7zmt2VGNI46ngabNBZzNjjBK7STIdNYADvC2ZGed392gEh UWE7vLX+EozOMinUQ4vJxLlF9AvEHumxENgCOZvcFC1kpvg9nLypbLODW9KqwdFHhjbC1 hMBeyYW/Pe/vNPYEZMSX2aVS3M/3UK1Ca6GVUvm1c3ExSWLtZX0EjPUHyML5c1bz5i/S7 TNBSvE95h1lHANtVZAjA1bUOb2xisMouCSh/7EV3l368SEUfatR/9fy8SzCr5nBqmp8eb YItzVazRF62pSLEiNVBylCiO+ttwrQDgLt3Mg8Hl75xufdwXnHY7w/WkWFSyVNmQvhA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796156510; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=tsl8bTXo+nXOB0VSlyvwdPsx5U4+yM3RdUVd9X8SIIY=; b=PY2aUrzl73g3JoXFE1JUCDZ53OBmHMLhEw7hZMiOtl3X+TWM5Tjo4umZ3RlUBOaIK6Fs O5RfBSkSrPRM5sv7aG/T3M84GVDFkIU8LwlvMVhFyBKUihTfTpD03u1AqAg5EsaGoqLyp +xXGMWxYeRSkAaGPnJDZv3TLY1jhZQhDpW2o9yhgwf4DaqodCeqNbmasp+YFp0kuLwTWj 5QHUzLv2f+hhdNxhjI26TG0E6s2TqdM5iduCQMhT65K1ouZjVy/qS9AXWNAs8Lkk7p85N riuMOUyz9cEyeOnxPtLpifdtd+eL2T5tw+Voe0uQ6ri7+oDxRIfzVepxyBrBqyc7nDw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NSa6a99R; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BBC1606A320; Tue, 1 Dec 2026 20:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NSa6a99R Received: by smtp.kernel.org (Postfix) with ESMTPSA id 245F41F000C1; Tue, 1 Dec 2026 20:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796156510; bh=tsl8bTXo+nXOB0VSlyvwdPsx5U4+yM3RdUVd9X8SIIY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=NSa6a99RizVgMc9IJva+I9a3dJ6pIKQOrOaJmQmrOUV3FehbJXeoCbmWIueNQ5itx WIpEWctzAgzLTHfGxWDMzkVbe0XrWkMArGa3HaLnkmdq9P1xOgrQVzAKNnI1C+K0O2 0sEBfg+6kJCzyJIU5rxw7q0LCxZVZKcepRSR2lnXbzWkywJD9RcjCHDda0pPHamU+6 QB8GPpm81jW1WFhzyXxxkVFJYdFvjJMsa9nmcwi3E61Hbz4OVn7pxcgJQgEUHIFZSb YSOqBJDE7qoOIHn/Y95WjBoPyuK261LBnmKI+Qwvi0VF8pMjqthK4bX3A9yQeDG7kf RbiKe9JC1herA== Date: Tue, 1 Dec 2026 20:21:48 +0000 From: Eric Biggers To: Thomas Huth Cc: Herbert Xu , linux-crypto@vger.kernel.org, "David S. Miller" , linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/4] crypto: Add back the lost FIPS key length checks to the hmac(sha*) algorithms Message-ID: <20261201202148.GA501764@google.com> References: <20261201184722.887139-1-thuth@redhat.com> X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201184722.887139-1-thuth@redhat.com> On Tue, Dec 01, 2026 at 07:47:18PM +0100, Thomas Huth wrote: > 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(-) Note that many FIPS modules implement HMAC without this check. Also, even after this patchset, not all hmac(sha*) implementations in the kernel do this check (and for s390, this is the first time the check will have ever been present). And anytime HMAC is used as an entropy extractor, like in HKDF, this check looks at the wrong length. So from a technical perspective, it's hard to evaluate this patchset. It doesn't help that the commit messages only include vague references to "FIPS compliance". That being said, if this patchset is really necessary and sufficient to make the specific FIPS lab you are using happy (which presumably is the real reason, that was not explicitly stated in the patchset), I am okay with it. At least it's less intrusive than other potential changes. What is inevitably going to happen, though, is that the Fixes tags are going to result in this being backported to 6.18.y, where they will reintroduce the regression where the kernel fails to boot with fips=1 due to the HKDF self-test failure. And failure to boot is a real issue that people actually care about, as was quite clear when it happened last time! (Also, it seems that the distros that offer fips=1 don't yet have testing in place to detect such issues preemptively.) So I would strongly recommend leaving a note in the commit message about the 6.18.y backporting pitfall. Otherwise it will likely get backported without considering that and reintroduce the fips=1 boot failure. - Eric