diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2016-05-03 10:00:17 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-05-05 14:36:53 +0800 |
commit | ff644448e8377b252ca07da3d156d700ebfa5c6c (patch) | |
tree | 115ecc627e0c3e9fae300eee7de0b3a8bcee36f8 /crypto | |
parent | bd41d5d2a3bb7122337f0af821663647adaac34a (diff) | |
download | linux-crypto-ff644448e8377b252ca07da3d156d700ebfa5c6c.tar.gz linux-crypto-ff644448e8377b252ca07da3d156d700ebfa5c6c.zip |
crypto: testmgr - Add a flag allowing the self-tests to be disabled at runtime.
Running self-tests for a short-lived KVM VM takes 28ms on my laptop.
This commit adds a flag 'cryptomgr.notests' which allows them to be
disabled.
However if fips=1 as well, we ignore this flag as FIPS mode mandates
that the self-tests are run.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | crypto/testmgr.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index b86883ae..fcd89fe4 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -35,6 +35,10 @@ #include "internal.h" +static bool notests; +module_param(notests, bool, 0644); +MODULE_PARM_DESC(notests, "disable crypto self-tests"); + #ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS /* a perfect nop */ @@ -3868,6 +3872,11 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask) int j; int rc; + if (!fips_enabled && notests) { + printk_once(KERN_INFO "alg: self-tests disabled\n"); + return 0; + } + alg_test_descs_check_order(); if ((type & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_CIPHER) { |