260-crypto_optional_tests.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --- a/crypto/Kconfig
  2. +++ b/crypto/Kconfig
  3. @@ -104,6 +104,10 @@ config CRYPTO_MANAGER_TESTS
  4. Run cryptomanager's tests for the new crypto algorithms being
  5. registered.
  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. @@ -58,6 +58,8 @@ int alg_test(const char *driver, const c
  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. @@ -2484,8 +2486,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. @@ -2540,6 +2545,9 @@ 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. #endif /* CONFIG_CRYPTO_MANAGER_TESTS */
  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. @@ -9608,4 +9610,6 @@ static struct hash_testvec crc32c_tv_tem
  52. },
  53. };
  54. +#endif /* CONFIG_CRYPTO_MANAGER_NO_TESTS */
  55. +
  56. #endif /* _CRYPTO_TESTMGR_H */