260-crypto_test_dependencies.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. @@ -121,13 +121,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_SKCIPHER2
  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_SKCIPHER2 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. --- a/crypto/algboss.c
  34. +++ b/crypto/algboss.c
  35. @@ -211,8 +211,12 @@ static int cryptomgr_schedule_test(struc
  36. type = alg->cra_flags;
  37. /* Do not test internal algorithms. */
  38. +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
  39. + type |= CRYPTO_ALG_TESTED;
  40. +#else
  41. if (type & CRYPTO_ALG_INTERNAL)
  42. type |= CRYPTO_ALG_TESTED;
  43. +#endif
  44. param->type = type;