| 1 | --- a/crypto/Kconfig |
| 2 | +++ b/crypto/Kconfig |
| 3 | @@ -96,6 +96,10 @@ config CRYPTO_MANAGER2 |
| 4 | select CRYPTO_BLKCIPHER2 |
| 5 | select CRYPTO_PCOMP |
| 6 | |
| 7 | +config CRYPTO_MANAGER_NO_TESTS |
| 8 | + bool "Disable internal testsuite to save space" |
| 9 | + depends on CRYPTO_MANAGER |
| 10 | + |
| 11 | config CRYPTO_GF128MUL |
| 12 | tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" |
| 13 | depends on EXPERIMENTAL |
| 14 | --- a/crypto/testmgr.c |
| 15 | +++ b/crypto/testmgr.c |
| 16 | @@ -47,6 +47,8 @@ |
| 17 | #define ENCRYPT 1 |
| 18 | #define DECRYPT 0 |
| 19 | |
| 20 | +#ifndef CONFIG_CRYPTO_MANAGER_NO_TESTS |
| 21 | + |
| 22 | struct tcrypt_result { |
| 23 | struct completion completion; |
| 24 | int err; |
| 25 | @@ -2350,8 +2352,11 @@ static int alg_find_test(const char *alg |
| 26 | return -1; |
| 27 | } |
| 28 | |
| 29 | +#endif /* CONFIG_CRYPTO_MANAGER_NO_TESTS */ |
| 30 | + |
| 31 | int alg_test(const char *driver, const char *alg, u32 type, u32 mask) |
| 32 | { |
| 33 | +#ifndef CONFIG_CRYPTO_MANAGER_NO_TESTS |
| 34 | int i; |
| 35 | int j; |
| 36 | int rc; |
| 37 | @@ -2406,5 +2411,8 @@ notest: |
| 38 | return 0; |
| 39 | non_fips_alg: |
| 40 | return -EINVAL; |
| 41 | +#else /* CONFIG_CRYPTO_MANAGER_NO_TESTS */ |
| 42 | + return 0; |
| 43 | +#endif /* CONFIG_CRYPTO_MANAGER_NO_TESTS */ |
| 44 | } |
| 45 | EXPORT_SYMBOL_GPL(alg_test); |
| 46 | --- a/crypto/testmgr.h |
| 47 | +++ b/crypto/testmgr.h |
| 48 | @@ -20,6 +20,8 @@ |
| 49 | |
| 50 | #include <crypto/compress.h> |
| 51 | |
| 52 | +#ifndef CONFIG_CRYPTO_MANAGER_NO_TESTS |
| 53 | + |
| 54 | #define MAX_DIGEST_SIZE 64 |
| 55 | #define MAX_TAP 8 |
| 56 | |
| 57 | @@ -9537,4 +9539,6 @@ static struct hash_testvec crc32c_tv_tem |
| 58 | }, |
| 59 | }; |
| 60 | |
| 61 | +#endif /* CONFIG_CRYPTO_MANAGER_NO_TESTS */ |
| 62 | + |
| 63 | #endif /* _CRYPTO_TESTMGR_H */ |
| 64 | |