Commit 59afdc7b authored by Herbert Xu's avatar Herbert Xu

crypto: api - Move module sig ifdef into accessor function

Currently we're hiding mod->sig_ok under an ifdef in open code.
This patch adds a module_sig_ok accessor function and removes that
ifdef.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 43a9607d
...@@ -43,12 +43,9 @@ static inline int crypto_set_driver_name(struct crypto_alg *alg) ...@@ -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) static inline void crypto_check_module_sig(struct module *mod)
{ {
#ifdef CONFIG_CRYPTO_FIPS if (fips_enabled && mod && !module_sig_ok(mod))
if (fips_enabled && mod && !mod->sig_ok)
panic("Module %s signature verification failed in FIPS mode\n", panic("Module %s signature verification failed in FIPS mode\n",
mod->name); mod->name);
#endif
return;
} }
static int crypto_check_alg(struct crypto_alg *alg) static int crypto_check_alg(struct crypto_alg *alg)
......
...@@ -655,4 +655,16 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr, ...@@ -655,4 +655,16 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr,
static inline void module_bug_cleanup(struct module *mod) {} static inline void module_bug_cleanup(struct module *mod) {}
#endif /* CONFIG_GENERIC_BUG */ #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 */ #endif /* _LINUX_MODULE_H */
Markdown is supported
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