Commit 002c77a4 authored by Jarod Wilson's avatar Jarod Wilson Committed by Herbert Xu
Browse files

crypto: fips - only panic on bad/missing crypto mod signatures

Per further discussion with NIST, the requirements for FIPS state that
we only need to panic the system on failed kernel module signature checks
for crypto subsystem modules. This moves the fips-mode-only module
signature check out of the generic module loading code, into the crypto
subsystem, at points where we can catch both algorithm module loads and
mode module loads. At the same time, make CONFIG_CRYPTO_FIPS dependent on
CONFIG_MODULE_SIG, as this is entirely necessary for FIPS mode.

v2: remove extraneous blank line, perform checks in static inline
function, drop no longer necessary fips.h include.

CC: "David S. Miller" <>
CC: Rusty Russell <>
CC: Stephan Mueller <>
Signed-off-by: default avatarJarod Wilson <>
Acked-by: default avatarNeil Horman <>
Signed-off-by: default avatarHerbert Xu <>
parent 8f312d64
......@@ -24,6 +24,7 @@ comment "Crypto core or helper"
bool "FIPS 200 compliance"
depends on MODULE_SIG
This options enables the fips boot option which is
required if you want to system to operate in a FIPS 200
......@@ -41,8 +41,20 @@ static inline int crypto_set_driver_name(struct crypto_alg *alg)
return 0;
static inline void crypto_check_module_sig(struct module *mod)
if (fips_enabled && mod && !mod->sig_ok)
panic("Module %s signature verification failed in FIPS mode\n",
static int crypto_check_alg(struct crypto_alg *alg)
if (alg->cra_alignmask & (alg->cra_alignmask + 1))
return -EINVAL;
......@@ -430,6 +442,8 @@ int crypto_register_template(struct crypto_template *tmpl)
list_for_each_entry(q, &crypto_template_list, list) {
if (q == tmpl)
goto out;
......@@ -60,7 +60,6 @@
#include <linux/jump_label.h>
#include <linux/pfn.h>
#include <linux/bsearch.h>
#include <linux/fips.h>
#include <uapi/linux/module.h>
#include "module-internal.h"
......@@ -2448,9 +2447,6 @@ static int module_sig_check(struct load_info *info)
/* Not having a signature is only an error if we're strict. */
if (err < 0 && fips_enabled)
panic("Module verification failed with error %d in FIPS mode\n",
if (err == -ENOKEY && !sig_enforce)
err = 0;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment