From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290407; b=OXGq9U6OKECfO3Bah+vzBr38eJT2zi4cFwM9UGjP6gO3vaIUhDdBtPgrh43TY5K+IJpn S7V+rSImgbY90c78Xq7UdE1W15+H8iIKw/d1vZMI78VgiZpSmJO/NoMEKIlgWgE/EsxWK lxQG4CtF25DwnPFg5vpJ1WkEpWJKyoXOwehAolm7jGPVgyBI9SkQKFTnp7JQaAUvx8Lav Nb62Px4pOStEFAqJbFHTE9PsTiiZDzp47tNPWnGkA/Elepu6vNhfEuSs8YLZ5Oqy+P6rG LfG2MkslMMyVODYx3UVUudQIz/f6K7hwI9o0M2XkEmRWEMPVIRM15EVtKcA8uqElLEA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290407; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:MIME-Version:Content-Transfer-Encoding:X-Scanned-By; bh=+KmuUFO9IJ2V/OjEVLFf9Bl+i7d8UaIW/3qKUX2YN1w=; b=BIWhtjfLv9T6Ev3bO0aT3KULiwEVhBCPs3CQE0wAw2rMKdrZhs6I+E6zqBsiGIN1/REz 9/qClQABTp7F8EeWriNeKMW+QqymYQERcfPBCVBf5CT7lczSSntt5d2hQf6Ip+Kv3Rh52 Ncifbdla8qBhUqskIwQGt6IsDXJHEFE4zoLD3OBP2R4gy48CJBs1hS3n0lkVPqPaGllAv Yi69SsMG7wtUZEVkITB/2ElfLdrFMC8vxlpTPjg8l/wM2E9iuqc+lPlsBUicgf4ZHmzil jJlZGgEFLg4K+vHtNlkT/Y42gVluEqEVCOD4vt2YBeJHAeR+hItfpoZRLn8bcrdxaZw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JVXVoTLl; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17D21606A32C for ; Thu, 3 Dec 2026 09:33:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 17D21606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JVXVoTLl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796290406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+KmuUFO9IJ2V/OjEVLFf9Bl+i7d8UaIW/3qKUX2YN1w=; b=JVXVoTLl3VopW+mxwPmkc2w1p6gpvj7RRDZzkkdwpHglXlgunlsNyuC0ZBZUgoMhTCiTZ7 i2td11xevhcjoYfvU6paV46nLvB67uAHxwGEh1GC24poTg4zpjk5iep2NBynXz/dpka7Y3 +gmO2oAiOrXxdMrhTjNVpS0TYzIDbbg= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-Z4fnGtQeOjK16j146mIo8g-1; Thu, 3 Dec 2026 09:33:21 +0000 X-MC-Unique: Z4fnGtQeOjK16j146mIo8g-1 X-Mimecast-MFC-AGG-ID: Z4fnGtQeOjK16j146mIo8g_1796290400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F27C519056AB; Thu, 3 Dec 2026 09:33:19 +0000 (UTC) Received: from thuth-p1g4.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 92D88B8A; Thu, 3 Dec 2026 09:33:17 +0000 (UTC) From: Thomas Huth To: Herbert Xu , linux-crypto@vger.kernel.org Cc: "David S. Miller" , Eric Biggers , 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 Message-ID: <20261203093316.97847-1-thuth@redhat.com> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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