260-crypto_test_dependencies.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From fd1799b0bf5efa46dd3e6dfbbf3955564807e508 Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <[email protected]>
  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 <[email protected]>
  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. @@ -132,12 +132,12 @@ 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. + def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS)
  24. + select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS
  25. + select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS
  26. + select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
  27. + select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
  28. + select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS
  29. config CRYPTO_USER
  30. tristate "Userspace cryptographic algorithm configuration"
  31. @@ -150,7 +150,6 @@ config CRYPTO_USER
  32. config CRYPTO_MANAGER_DISABLE_TESTS
  33. bool "Disable run-time self tests"
  34. default y
  35. - depends on CRYPTO_MANAGER2
  36. help
  37. Disable run-time self tests that normally take place at
  38. algorithm registration.
  39. --- a/crypto/algboss.c
  40. +++ b/crypto/algboss.c
  41. @@ -248,12 +248,16 @@ static int cryptomgr_schedule_test(struc
  42. type = alg->cra_flags;
  43. /* This piece of crap needs to disappear into per-type test hooks. */
  44. +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
  45. + type |= CRYPTO_ALG_TESTED;
  46. +#else
  47. if (!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) &
  48. CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) &&
  49. ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
  50. CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize :
  51. alg->cra_ablkcipher.ivsize))
  52. type |= CRYPTO_ALG_TESTED;
  53. +#endif
  54. param->type = type;