From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2974C4CE697 for ; Wed, 30 Sep 2026 12:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790770133; cv=none; b=Pi+JZllVBcxnW4TYkfP5IkwkZ6jsynKI9lW5k2pd7vJkc5MjuBmEL6WGpjXNS+YGbHVbVuslJXrZUnhWb7oCQtsJzVvcUvSbwAD3IHWdywUNj/VIKRxm2NOTMiwLcU5zRG1GPsYscvThTc6caHpg8BcyXMeFOsYZbXJijmjRKyU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790770133; c=relaxed/simple; bh=E+O3qPqBJTiKOBH2bnKsx4bWL3m33z5H11tcQBFauXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qL8BRtqD2FYa0Am9NGDNu6js5kcYhpf0B3kvMLiDp5Fsq4WyItVf/Flm2bKs5TdNJqTEs5qJaKmtHR6GpGzOyJJOmLYONkvSW6hw3bEGP8Eu+nEkv2pBdRHZv8mqnvOY61UKZrsVspzdBWW8n8llvCUOlPK+DW7VD0nsg9sgSkU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LJcfrxYy; arc=none smtp.client-ip=170.10.133.124 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.b="LJcfrxYy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790770131; 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: in-reply-to:in-reply-to:references:references; bh=31ShRxaW64dFryzULX9JYs3IFNpp5jw5ZWTTKBxvlCY=; b=LJcfrxYyQ71oE76lT6VxVgcQN1/KzFjjly0zhXHJ84QpdY94DsFn7cwFRQfOjjAQnqfiK2 08fTQg6pCEaAIIwmn4yuOkydw+CvzOmsqyvocNw3GtaLjvaYh2tdw+ymHDZZQLmRuf4KSz e8u+Jj9FJM4RSoyueYNEuM409QY96k8= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-374-cJ2ame4OO6WX60zje2c2nw-1; Wed, 30 Sep 2026 08:08:47 -0400 X-MC-Unique: cJ2ame4OO6WX60zje2c2nw-1 X-Mimecast-MFC-AGG-ID: cJ2ame4OO6WX60zje2c2nw_1790770124 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 82D7D183EEEF; Wed, 30 Sep 2026 12:08:44 +0000 (UTC) Received: from jtornosm-thinkpadp1gen7.rmtes.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B7A371800361; Wed, 30 Sep 2026 12:08:41 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: herbert@gondor.apana.org.au, davem@davemloft.net, johannes@sipsolutions.net, miriam.rachel.korenblit@intel.com Cc: ilan.peer@intel.com, emmanuel.grumbach@intel.com, linux-crypto@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Ignacio Tornos Martinez Subject: [PATCH v2 1/5] crypto: fips: add fips_exception kernel boot parameter and fips_allows() helper Date: Wed, 30 Sep 2026 14:08:24 +0200 Message-ID: <20260930120829.383408-2-jtornosm@redhat.com> In-Reply-To: <20260930120829.383408-1-jtornosm@redhat.com> References: <20260930120829.383408-1-jtornosm@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Add a new kernel boot parameter fips_exception= to allow documented exceptions to strict FIPS compliance when full compliance is not achievable due to hardware/firmware limitations but functionality is required. The parameter is stored in a static variable and accessed through the exported fips_allows() helper function, which returns true if FIPS is not enabled or the requested exception bit is set. It is not meant for fully FIPS-compliant features. For !CONFIG_CRYPTO_FIPS, fips_allows() is a trivial static inline returning true. The parameter is exposed as a read-only sysctl at /proc/sys/crypto/fips_exception for runtime inspection. As with fips_enabled, it is intentionally not writable at runtime so that enabling exceptions requires a deliberate boot-time decision, visible in /proc/cmdline. The bitmap design allows individual subsystem exceptions to be defined independently. Currently defined bits: - Bit 0 (FIPS_EXCEPTION_WIFI_MFP): Allow WiFi MFP (802.11w) in FIPS mode despite firmware sending some unprotected management frames on TX Without this parameter (or with fips_exception=0), all existing FIPS restrictions remain in effect. Signed-off-by: Jose Ignacio Tornos Martinez --- v2: new, add crypto exception for fips v1: https://lore.kernel.org/all/20260629121213.597038-1-jtornosm@redhat.com/ crypto/fips.c | 27 +++++++++++++++++++++++++++ include/linux/fips.h | 14 ++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/crypto/fips.c b/crypto/fips.c index c59711248d95..0f075e61a657 100644 --- a/crypto/fips.c +++ b/crypto/fips.c @@ -21,6 +21,15 @@ EXPORT_SYMBOL_GPL(fips_enabled); ATOMIC_NOTIFIER_HEAD(fips_fail_notif_chain); EXPORT_SYMBOL_GPL(fips_fail_notif_chain); +static unsigned long fips_exception; + +int fips_allows(unsigned long feature) +{ + return !fips_enabled || + (fips_exception & feature); +} +EXPORT_SYMBOL_GPL(fips_allows); + /* Process kernel command-line parameter at boot time. fips=0 or fips=1 */ static int __init fips_enable(char *str) { @@ -34,6 +43,17 @@ static int __init fips_enable(char *str) __setup("fips=", fips_enable); +static int __init fips_exception_setup(char *str) +{ + if (kstrtoul(str, 0, &fips_exception)) + return 0; + + pr_info("fips exceptions: 0x%lx\n", fips_exception); + return 1; +} + +__setup("fips_exception=", fips_exception_setup); + #define FIPS_MODULE_NAME CONFIG_CRYPTO_FIPS_NAME #ifdef CONFIG_CRYPTO_FIPS_CUSTOM_VERSION #define FIPS_MODULE_VERSION CONFIG_CRYPTO_FIPS_VERSION @@ -52,6 +72,13 @@ static const struct ctl_table crypto_sysctl_table[] = { .mode = 0444, .proc_handler = proc_dointvec }, + { + .procname = "fips_exception", + .data = &fips_exception, + .maxlen = sizeof(unsigned long), + .mode = 0444, + .proc_handler = proc_doulongvec_minmax + }, { .procname = "fips_name", .data = &fips_name, diff --git a/include/linux/fips.h b/include/linux/fips.h index c6961e932fef..61fe58b0762c 100644 --- a/include/linux/fips.h +++ b/include/linux/fips.h @@ -2,17 +2,31 @@ #ifndef _FIPS_H #define _FIPS_H +#include + #ifdef CONFIG_CRYPTO_FIPS extern int fips_enabled; extern struct atomic_notifier_head fips_fail_notif_chain; void fips_fail_notify(void); +/* + * fips_allows - check if a not fully FIPS-compliant feature is allowed + * via an explicit boot-time exception (fips_exception=). + * Not for fully FIPS-compliant features. + */ +int fips_allows(unsigned long feature); #else #define fips_enabled 0 static inline void fips_fail_notify(void) {} +static inline int fips_allows(unsigned long feature) +{ + return 1; +} #endif +#define FIPS_EXCEPTION_WIFI_MFP BIT(0) + #endif -- 2.55.0