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=1796150851; b=hbUvI6GdJrj2moMN3jb/u0woHpFelZ9oAow+TkIkIquJqNcv87izfzS2RXesj72jiqg6 a+zSQtXO8XOjkZrSPCk7Oi1tGQLutHvr04gc2cFyf8V7i1HCS9p+SO/SbDOVp0OdotmOt LTUJINRt39zCC+tsGqZmK4PwjY8LkpY+9s0lXJI8m+yPqlF6NZYK45D8KsVRsHPVqxtZ9 ZyGNdI8bVlzsZL9UVF/x7xbhEEuud9rnL3MVMWLFw0tSR1WCPfJivg52ZerdeJLcRm80n QFl3MjAlzHNuVuBsptUqOvZc7jgGC/aTcxxGGCvQsJc+nqrnVsTROl6qieFyocSPWaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796150851; 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=KyR8cp+cZ0XowyU9K4pLplHU6+TTJruvfP92iRdRxESaO1MNLdcAxha5WMLLgbTLnckC cplNd2JcnklQ2/8r9ccP0FxISZ906ZzxK7SKgRAM9biEpIR1H2/esvmNOaD/H3dI7P4DW cUB3T8y7ga8ig6SSOok9FyHdS64CZ1byBBSgcQwcPcfs1Ce+7Toyo7blQm17Y1CYAJ4jW aSlq33i9iLtH6NKUPOJwrxpXR3otBJ7O0W+AfWYYm/Uv94lemT9hnHhOqbwrxBa3QZPz0 1lzhwN08/6QhKjE833Hf5JsgxjQfzAQR8ZfHwXeGzHeK4gr9GWjIkz1LH1aruZjoypQ== 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="SdjOiH/5"; 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 B2B55606A31A for ; Tue, 1 Dec 2026 18:47:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B2B55606A31A 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=SdjOiH/5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796150850; 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=SdjOiH/53PyTs2kwLZ0x2v25lbKIBLUVFSX5lAZwbi1Oca4rp86Kit1+RThmk5gn0FM5gs KGRDrEongx4MJXiISB47d+ueW/YiqEUy4KqB3zFAhrS6JwkXpl7nh7RKA0Gl57py5PYgaI qt4npPRcdpet/JK5kz8HYlNiE6JpEkA= 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-crypto@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