aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-04-22 11:28:46 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-04-23 14:18:07 +0800
commit59afdc7b32143528524455039e7557a46b60e4c8 (patch)
treef188388b37d0d6d58191e177a16bb99990ede6f8
parentcrypto: tcrypt - Handle async return from crypto_ahash_init (diff)
downloadlinux-dev-59afdc7b32143528524455039e7557a46b60e4c8.tar.xz
linux-dev-59afdc7b32143528524455039e7557a46b60e4c8.zip
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: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--crypto/algapi.c5
-rw-r--r--include/linux/module.h12
2 files changed, 13 insertions, 4 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index a60f62625b5f..f835f439bb23 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 c883b86ea964..1e5436042eb0 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 */