From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796150854; b=miRihJ7r4Ml+XNjbnMvScMiuDPC3IzpMrk+Q3mPJ04PiPvFB7fF/J3SoesRVwuR5d7lo vHxhhI17HRSEYyuF6JlHHgtkYgTjEszVZZqWF8Cbsuo1NX8JKz7wyI3vQt/x8HUPIs2gF eURLtTa4orrYzM7+n6OytfM97pQ2t87hnt07s7/sOk3OoaK8uDYtobmvPYcTXVJavUSwL bxVylCoDuzBEecqsol+vCxZEhFOnTahaleky+NmO3cpd6LYPIex7Xu2c6mA7shO+LlyHn diHsyY+ljbRq5nhO17MmEmkh6Al8Qo35MxKEYMYoKpzyNPptCpMqd8L3MClmg0c1DfQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796150854; 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=94k+Bp/RdsLfRPXrfMQw1z4GFpDmwmGZImuDY7oN6jc=; b=DlfUWJRC+YNPeyj/7Md49ySL2VDiwmDyr7f8NXGXl6nBXUaaDd47rHQQaywlS8aEA6m/ ukmC3OcrtIxw7K0HkoHrW8SD0rxlIsbYUxrS8uBBqrexm3VaQ7nejr2GxT5ex/QRMiTu/ FIKcfqFVPTLaOnHetP4Iqgz9noS89AmuSMhqD3PkzqeaQ/0BOuY6PatIfZAELnBtwBz2d u23jQjZe9MzLKG4ydO4qKMDZqTLTKspg7wajyJ8U/cxsSQYC7HeDn3WlQIlRn98osKB8w VmvSvsn5r9wlyIZB7c/X6+qPl8eXIs7biAVEkhHu01cQKQzFqj+bItK28ojJRIYHeIQ== 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=eoulT6cC; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 93D74606A31A for ; Tue, 1 Dec 2026 18:47:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 93D74606A31A 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=eoulT6cC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796150853; 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=94k+Bp/RdsLfRPXrfMQw1z4GFpDmwmGZImuDY7oN6jc=; b=eoulT6cCGRgsh1+1KiGeX9d5CNHAgYsZJtxXwFMeK8jtdqHDYzn7mq/ldVmt2qFTTA9AOd xbGlt4iIUOVQ6FJ9YQwjA2SRP3miG1CzAeD5VaZpE/YqcQTshn2uoXbKbCDK0Mk4+/bfPN KoBW0Tf3QfHJbu0XtgdKvp2iztqI5K8= Received: from mx-prod-mc-03.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-397-sRurxdO3MUSyLP4WVHxmnQ-1; Tue, 1 Dec 2026 18:47:27 +0000 X-MC-Unique: sRurxdO3MUSyLP4WVHxmnQ-1 X-Mimecast-MFC-AGG-ID: sRurxdO3MUSyLP4WVHxmnQ_1796150846 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D90581935321; Tue, 1 Dec 2026 18:47:25 +0000 (UTC) Received: from thuth-p1g4.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 29A091955E72; Tue, 1 Dec 2026 18:47:23 +0000 (UTC) From: Thomas Huth To: Herbert Xu , linux-crypto@vger.kernel.org Cc: "David S. Miller" , Eric Biggers , linux-kernel@vger.kernel.org Subject: [PATCH 0/4] crypto: Add back the lost FIPS key length checks to the hmac(sha*) algorithms Date: Tue, 1 Dec 2026 19:47:18 +0100 Message-ID: <20261201184722.887139-1-thuth@redhat.com> X-Mailing-List: linux-kernel@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.0 on 10.30.177.12 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