1
0

260-crypto_test_dependencies.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From fd1799b0bf5efa46dd3e6dfbbf3955564807e508 Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <nbd@nbd.name>
  3. Date: Fri, 7 Jul 2017 17:12:51 +0200
  4. Subject: kernel: prevent cryptomgr from pulling in useless extra dependencies for tests that are not run
  5. Reduces kernel size after LZMA by about 5k on MIPS
  6. lede-commit: 044c316167e076479a344c59905e5b435b84a77f
  7. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8. ---
  9. crypto/Kconfig | 13 ++++++-------
  10. crypto/algboss.c | 4 ++++
  11. 2 files changed, 10 insertions(+), 7 deletions(-)
  12. --- a/crypto/Kconfig
  13. +++ b/crypto/Kconfig
  14. @@ -143,13 +143,13 @@ config CRYPTO_MANAGER
  15. cbc(aes).
  16. config CRYPTO_MANAGER2
  17. - def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
  18. - select CRYPTO_AEAD2
  19. - select CRYPTO_HASH2
  20. - select CRYPTO_BLKCIPHER2
  21. - select CRYPTO_AKCIPHER2
  22. - select CRYPTO_KPP2
  23. - select CRYPTO_ACOMP2
  24. + def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS)
  25. + select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS
  26. + select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS
  27. + select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
  28. + select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
  29. + select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS
  30. + select CRYPTO_ACOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS
  31. config CRYPTO_USER
  32. tristate "Userspace cryptographic algorithm configuration"
  33. @@ -162,7 +162,6 @@ config CRYPTO_USER
  34. config CRYPTO_MANAGER_DISABLE_TESTS
  35. bool "Disable run-time self tests"
  36. default y
  37. - depends on CRYPTO_MANAGER2
  38. help
  39. Disable run-time self tests that normally take place at
  40. algorithm registration.
  41. --- a/crypto/algboss.c
  42. +++ b/crypto/algboss.c
  43. @@ -248,8 +248,12 @@ static int cryptomgr_schedule_test(struc
  44. type = alg->cra_flags;
  45. /* Do not test internal algorithms. */
  46. +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
  47. + type |= CRYPTO_ALG_TESTED;
  48. +#else
  49. if (type & CRYPTO_ALG_INTERNAL)
  50. type |= CRYPTO_ALG_TESTED;
  51. +#endif
  52. param->type = type;