[PATCH v2 1/5] crypto: fips: add fips_exception kernel boot parameter and fips_allows() helper

From: Jose Ignacio Tornos Martinez

Date: Wed Sep 30 2026 - 08:16:58 EST


Add a new kernel boot parameter fips_exception=<bitmap> 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 <jtornosm@xxxxxxxxxx>
---
v2: new, add crypto exception for fips
v1: https://lore.kernel.org/all/20260629121213.597038-1-jtornosm@xxxxxxxxxx/

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 <linux/bits.h>
+
#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