260-crypto_optional_tests.patch 1.4 KB

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