Commit 0b767f96 authored by Alexander Shishkin's avatar Alexander Shishkin Committed by Herbert Xu

crypto: testmgr - add an option to disable cryptoalgos' self-tests

By default, CONFIG_CRYPTO_MANAGER_TESTS will be enabled and thus
self-tests will still run, but it is now possible to disable them
to gain some time during bootup.
Signed-off-by: default avatarAlexander Shishkin <virtuoso@slind.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent bc94e596
...@@ -101,6 +101,14 @@ config CRYPTO_MANAGER2 ...@@ -101,6 +101,14 @@ config CRYPTO_MANAGER2
select CRYPTO_BLKCIPHER2 select CRYPTO_BLKCIPHER2
select CRYPTO_PCOMP2 select CRYPTO_PCOMP2
config CRYPTO_MANAGER_TESTS
bool "Run algolithms' self-tests"
default y
depends on CRYPTO_MANAGER2
help
Run cryptomanager's tests for the new crypto algorithms being
registered.
config CRYPTO_GF128MUL config CRYPTO_GF128MUL
tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" tristate "GF(2^128) multiplication functions (EXPERIMENTAL)"
depends on EXPERIMENTAL depends on EXPERIMENTAL
......
...@@ -206,6 +206,7 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) ...@@ -206,6 +206,7 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
return NOTIFY_OK; return NOTIFY_OK;
} }
#ifdef CONFIG_CRYPTO_MANAGER_TESTS
static int cryptomgr_test(void *data) static int cryptomgr_test(void *data)
{ {
struct crypto_test_param *param = data; struct crypto_test_param *param = data;
...@@ -266,6 +267,7 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg) ...@@ -266,6 +267,7 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
err: err:
return NOTIFY_OK; return NOTIFY_OK;
} }
#endif /* CONFIG_CRYPTO_MANAGER_TESTS */
static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
void *data) void *data)
...@@ -273,8 +275,10 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, ...@@ -273,8 +275,10 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
switch (msg) { switch (msg) {
case CRYPTO_MSG_ALG_REQUEST: case CRYPTO_MSG_ALG_REQUEST:
return cryptomgr_schedule_probe(data); return cryptomgr_schedule_probe(data);
#ifdef CONFIG_CRYPTO_MANAGER_TESTS
case CRYPTO_MSG_ALG_REGISTER: case CRYPTO_MSG_ALG_REGISTER:
return cryptomgr_schedule_test(data); return cryptomgr_schedule_test(data);
#endif
} }
return NOTIFY_DONE; return NOTIFY_DONE;
......
...@@ -22,6 +22,17 @@ ...@@ -22,6 +22,17 @@
#include <crypto/rng.h> #include <crypto/rng.h>
#include "internal.h" #include "internal.h"
#ifndef CONFIG_CRYPTO_MANAGER_TESTS
/* a perfect nop */
int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
{
return 0;
}
#else
#include "testmgr.h" #include "testmgr.h"
/* /*
...@@ -2530,4 +2541,7 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask) ...@@ -2530,4 +2541,7 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
non_fips_alg: non_fips_alg:
return -EINVAL; return -EINVAL;
} }
#endif /* CONFIG_CRYPTO_MANAGER_TESTS */
EXPORT_SYMBOL_GPL(alg_test); EXPORT_SYMBOL_GPL(alg_test);
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