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
6 Reduces kernel size after LZMA by about 5k on MIPS
8 lede-commit: 044c316167e076479a344c59905e5b435b84a77f
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 crypto/Kconfig | 13 ++++++-------
12 crypto/algboss.c | 4 ++++
13 2 files changed, 10 insertions(+), 7 deletions(-)
17 @@ -120,13 +120,13 @@ config CRYPTO_MANAGER
20 config CRYPTO_MANAGER2
21 - def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
24 - select CRYPTO_BLKCIPHER2
25 - select CRYPTO_AKCIPHER2
27 - select CRYPTO_ACOMP2
28 + def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS)
29 + select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS
30 + select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS
31 + select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
32 + select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
33 + select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS
34 + select CRYPTO_ACOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS
37 tristate "Userspace cryptographic algorithm configuration"
38 @@ -136,8 +136,6 @@ config CRYPTO_USER
39 Userspace configuration for cryptographic instantiations such as
44 config CRYPTO_MANAGER_DISABLE_TESTS
45 bool "Disable run-time self tests"
47 @@ -145,6 +143,8 @@ config CRYPTO_MANAGER_DISABLE_TESTS
48 Disable run-time self tests that normally take place at
49 algorithm registration.
53 config CRYPTO_MANAGER_EXTRA_TESTS
54 bool "Enable extra run-time crypto self tests"
55 depends on DEBUG_KERNEL && !CRYPTO_MANAGER_DISABLE_TESTS
56 --- a/crypto/algboss.c
57 +++ b/crypto/algboss.c
58 @@ -242,8 +242,12 @@ static int cryptomgr_schedule_test(struc
59 type = alg->cra_flags;
61 /* Do not test internal algorithms. */
62 +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
63 + type |= CRYPTO_ALG_TESTED;
65 if (type & CRYPTO_ALG_INTERNAL)
66 type |= CRYPTO_ALG_TESTED;