kernel: Update kernel 4.19 to version 4.19.131
[openwrt/openwrt.git] / target / linux / generic / hack-4.19 / 260-crypto_test_dependencies.patch
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
6 Reduces kernel size after LZMA by about 5k on MIPS
7
8 lede-commit: 044c316167e076479a344c59905e5b435b84a77f
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11 crypto/Kconfig | 13 ++++++-------
12 crypto/algboss.c | 4 ++++
13 2 files changed, 10 insertions(+), 7 deletions(-)
14
15 --- a/crypto/Kconfig
16 +++ b/crypto/Kconfig
17 @@ -144,13 +144,13 @@ config CRYPTO_MANAGER
18 cbc(aes).
19
20 config CRYPTO_MANAGER2
21 - def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
22 - select CRYPTO_AEAD2
23 - select CRYPTO_HASH2
24 - select CRYPTO_BLKCIPHER2
25 - select CRYPTO_AKCIPHER2
26 - select CRYPTO_KPP2
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
35
36 config CRYPTO_USER
37 tristate "Userspace cryptographic algorithm configuration"
38 @@ -163,7 +163,6 @@ config CRYPTO_USER
39 config CRYPTO_MANAGER_DISABLE_TESTS
40 bool "Disable run-time self tests"
41 default y
42 - depends on CRYPTO_MANAGER2
43 help
44 Disable run-time self tests that normally take place at
45 algorithm registration.
46 --- a/crypto/algboss.c
47 +++ b/crypto/algboss.c
48 @@ -245,8 +245,12 @@ static int cryptomgr_schedule_test(struc
49 type = alg->cra_flags;
50
51 /* Do not test internal algorithms. */
52 +#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
53 + type |= CRYPTO_ALG_TESTED;
54 +#else
55 if (type & CRYPTO_ALG_INTERNAL)
56 type |= CRYPTO_ALG_TESTED;
57 +#endif
58
59 param->type = type;
60