diff --git a/crypto/algapi.c b/crypto/algapi.c index a60f62625b5f4e3117cb128c198ee6fa5ec741d1..f835f439bb23f4601574fa3fa742ca15300efb0e 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -43,12 +43,9 @@ static inline int crypto_set_driver_name(struct crypto_alg *alg) static inline void crypto_check_module_sig(struct module *mod) { -#ifdef CONFIG_CRYPTO_FIPS - if (fips_enabled && mod && !mod->sig_ok) + if (fips_enabled && mod && !module_sig_ok(mod)) panic("Module %s signature verification failed in FIPS mode\n", mod->name); -#endif - return; } static int crypto_check_alg(struct crypto_alg *alg) diff --git a/include/linux/module.h b/include/linux/module.h index c883b86ea9649ae62ca485dd3843e51e43edc346..1e5436042eb0322f77209586944954f650aa8b17 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -655,4 +655,16 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr, static inline void module_bug_cleanup(struct module *mod) {} #endif /* CONFIG_GENERIC_BUG */ +#ifdef CONFIG_MODULE_SIG +static inline bool module_sig_ok(struct module *module) +{ + return module->sig_ok; +} +#else /* !CONFIG_MODULE_SIG */ +static inline bool module_sig_ok(struct module *module) +{ + return true; +} +#endif /* CONFIG_MODULE_SIG */ + #endif /* _LINUX_MODULE_H */