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(-)
15 diff --git a/crypto/Kconfig b/crypto/Kconfig
16 index e3552d1c1b84..17be110ad162 100644
19 @@ -132,12 +132,12 @@ config CRYPTO_MANAGER
22 config CRYPTO_MANAGER2
23 - def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
26 - select CRYPTO_BLKCIPHER2
27 - select CRYPTO_AKCIPHER2
29 + def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS)
30 + select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS
31 + select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS
32 + select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
33 + select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
34 + select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS
37 tristate "Userspace cryptographic algorithm configuration"
38 @@ -150,7 +150,6 @@ config CRYPTO_USER
39 config CRYPTO_MANAGER_DISABLE_TESTS
40 bool "Disable run-time self tests"
42 - depends on CRYPTO_MANAGER2
44 Disable run-time self tests that normally take place at
45 algorithm registration.
46 diff --git a/crypto/algboss.c b/crypto/algboss.c
47 index 6e39d9c05b98..4bde25d62ec7 100644
48 --- a/crypto/algboss.c
49 +++ b/crypto/algboss.c
50 @@ -248,12 +248,16 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
51 type = alg->cra_flags;
53 /* This piece of crap needs to disappear into per-type test hooks. */
54 +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
55 + type |= CRYPTO_ALG_TESTED;
57 if (!((type ^ CRYPTO_ALG_TYPE_BLKCIPHER) &
58 CRYPTO_ALG_TYPE_BLKCIPHER_MASK) && !(type & CRYPTO_ALG_GENIV) &&
59 ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
60 CRYPTO_ALG_TYPE_BLKCIPHER ? alg->cra_blkcipher.ivsize :
61 alg->cra_ablkcipher.ivsize))
62 type |= CRYPTO_ALG_TESTED;