diff options
| -rw-r--r-- | crypto/Kconfig | 8 | ||||
| -rw-r--r-- | crypto/algboss.c | 4 | ||||
| -rw-r--r-- | crypto/testmgr.c | 14 |
3 files changed, 26 insertions, 0 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig index 11d0f21fd417..1cd497d7a15a 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
| @@ -101,6 +101,14 @@ config CRYPTO_MANAGER2 | |||
| 101 | select CRYPTO_BLKCIPHER2 | 101 | select CRYPTO_BLKCIPHER2 |
| 102 | select CRYPTO_PCOMP2 | 102 | select CRYPTO_PCOMP2 |
| 103 | 103 | ||
| 104 | config CRYPTO_MANAGER_TESTS | ||
| 105 | bool "Run algolithms' self-tests" | ||
| 106 | default y | ||
| 107 | depends on CRYPTO_MANAGER2 | ||
| 108 | help | ||
| 109 | Run cryptomanager's tests for the new crypto algorithms being | ||
| 110 | registered. | ||
| 111 | |||
| 104 | config CRYPTO_GF128MUL | 112 | config CRYPTO_GF128MUL |
| 105 | tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" | 113 | tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" |
| 106 | depends on EXPERIMENTAL | 114 | depends on EXPERIMENTAL |
diff --git a/crypto/algboss.c b/crypto/algboss.c index c3c196b5823a..40bd391f34d9 100644 --- a/crypto/algboss.c +++ b/crypto/algboss.c | |||
| @@ -206,6 +206,7 @@ err: | |||
| 206 | return NOTIFY_OK; | 206 | return NOTIFY_OK; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | #ifdef CONFIG_CRYPTO_MANAGER_TESTS | ||
| 209 | static int cryptomgr_test(void *data) | 210 | static int cryptomgr_test(void *data) |
| 210 | { | 211 | { |
| 211 | struct crypto_test_param *param = data; | 212 | struct crypto_test_param *param = data; |
| @@ -266,6 +267,7 @@ err_put_module: | |||
| 266 | err: | 267 | err: |
| 267 | return NOTIFY_OK; | 268 | return NOTIFY_OK; |
| 268 | } | 269 | } |
| 270 | #endif /* CONFIG_CRYPTO_MANAGER_TESTS */ | ||
| 269 | 271 | ||
| 270 | static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, | 272 | static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, |
| 271 | void *data) | 273 | void *data) |
| @@ -273,8 +275,10 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, | |||
| 273 | switch (msg) { | 275 | switch (msg) { |
| 274 | case CRYPTO_MSG_ALG_REQUEST: | 276 | case CRYPTO_MSG_ALG_REQUEST: |
| 275 | return cryptomgr_schedule_probe(data); | 277 | return cryptomgr_schedule_probe(data); |
| 278 | #ifdef CONFIG_CRYPTO_MANAGER_TESTS | ||
| 276 | case CRYPTO_MSG_ALG_REGISTER: | 279 | case CRYPTO_MSG_ALG_REGISTER: |
| 277 | return cryptomgr_schedule_test(data); | 280 | return cryptomgr_schedule_test(data); |
| 281 | #endif | ||
| 278 | } | 282 | } |
| 279 | 283 | ||
| 280 | return NOTIFY_DONE; | 284 | return NOTIFY_DONE; |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 5c8aaa0cb0b9..abd980c729eb 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
| @@ -22,6 +22,17 @@ | |||
| 22 | #include <crypto/rng.h> | 22 | #include <crypto/rng.h> |
| 23 | 23 | ||
| 24 | #include "internal.h" | 24 | #include "internal.h" |
| 25 | |||
| 26 | #ifndef CONFIG_CRYPTO_MANAGER_TESTS | ||
| 27 | |||
| 28 | /* a perfect nop */ | ||
| 29 | int alg_test(const char *driver, const char *alg, u32 type, u32 mask) | ||
| 30 | { | ||
| 31 | return 0; | ||
| 32 | } | ||
| 33 | |||
| 34 | #else | ||
| 35 | |||
| 25 | #include "testmgr.h" | 36 | #include "testmgr.h" |
| 26 | 37 | ||
| 27 | /* | 38 | /* |
| @@ -2530,4 +2541,7 @@ notest: | |||
| 2530 | non_fips_alg: | 2541 | non_fips_alg: |
| 2531 | return -EINVAL; | 2542 | return -EINVAL; |
| 2532 | } | 2543 | } |
| 2544 | |||
| 2545 | #endif /* CONFIG_CRYPTO_MANAGER_TESTS */ | ||
| 2546 | |||
| 2533 | EXPORT_SYMBOL_GPL(alg_test); | 2547 | EXPORT_SYMBOL_GPL(alg_test); |
