Commit 6a0fcbb4dad15f02ca8f8ae6324fcd3fc43b9d35

Authored by Herbert Xu
1 parent 437f2f91d6

crypto: api - Disallow cryptomgr as a module if algorithms are built-in

If we have at least one algorithm built-in then it no longer makes
sense to have the testing framework, and hence cryptomgr to be a
module.  It should be either on or off, i.e., built-in or disabled.

This just happens to stop a potential runaway modprobe loop that
seems to trigger on at least one distro.

With fixes from Evgeniy Polyakov.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 2 changed files with 41 additions and 13 deletions Side-by-side Diff

... ... @@ -31,34 +31,62 @@
31 31  
32 32 config CRYPTO_ALGAPI
33 33 tristate
  34 + select CRYPTO_ALGAPI2
34 35 help
35 36 This option provides the API for cryptographic algorithms.
36 37  
  38 +config CRYPTO_ALGAPI2
  39 + tristate
  40 +
37 41 config CRYPTO_AEAD
38 42 tristate
  43 + select CRYPTO_AEAD2
39 44 select CRYPTO_ALGAPI
40 45  
  46 +config CRYPTO_AEAD2
  47 + tristate
  48 + select CRYPTO_ALGAPI2
  49 +
41 50 config CRYPTO_BLKCIPHER
42 51 tristate
  52 + select CRYPTO_BLKCIPHER2
43 53 select CRYPTO_ALGAPI
44   - select CRYPTO_RNG
45 54  
  55 +config CRYPTO_BLKCIPHER2
  56 + tristate
  57 + select CRYPTO_ALGAPI2
  58 + select CRYPTO_RNG2
  59 +
46 60 config CRYPTO_HASH
47 61 tristate
  62 + select CRYPTO_HASH2
48 63 select CRYPTO_ALGAPI
49 64  
  65 +config CRYPTO_HASH2
  66 + tristate
  67 + select CRYPTO_ALGAPI2
  68 +
50 69 config CRYPTO_RNG
51 70 tristate
  71 + select CRYPTO_RNG2
52 72 select CRYPTO_ALGAPI
53 73  
  74 +config CRYPTO_RNG2
  75 + tristate
  76 + select CRYPTO_ALGAPI2
  77 +
54 78 config CRYPTO_MANAGER
55 79 tristate "Cryptographic algorithm manager"
56   - select CRYPTO_AEAD
57   - select CRYPTO_HASH
58   - select CRYPTO_BLKCIPHER
  80 + select CRYPTO_MANAGER2
59 81 help
60 82 Create default cryptographic template instantiations such as
61 83 cbc(aes).
  84 +
  85 +config CRYPTO_MANAGER2
  86 + def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
  87 + select CRYPTO_AEAD2
  88 + select CRYPTO_HASH2
  89 + select CRYPTO_BLKCIPHER2
62 90  
63 91 config CRYPTO_GF128MUL
64 92 tristate "GF(2^128) multiplication functions (EXPERIMENTAL)"
... ... @@ -9,24 +9,24 @@
9 9  
10 10 crypto_algapi-$(CONFIG_PROC_FS) += proc.o
11 11 crypto_algapi-objs := algapi.o scatterwalk.o $(crypto_algapi-y)
12   -obj-$(CONFIG_CRYPTO_ALGAPI) += crypto_algapi.o
  12 +obj-$(CONFIG_CRYPTO_ALGAPI2) += crypto_algapi.o
13 13  
14   -obj-$(CONFIG_CRYPTO_AEAD) += aead.o
  14 +obj-$(CONFIG_CRYPTO_AEAD2) += aead.o
15 15  
16 16 crypto_blkcipher-objs := ablkcipher.o
17 17 crypto_blkcipher-objs += blkcipher.o
18   -obj-$(CONFIG_CRYPTO_BLKCIPHER) += crypto_blkcipher.o
19   -obj-$(CONFIG_CRYPTO_BLKCIPHER) += chainiv.o
20   -obj-$(CONFIG_CRYPTO_BLKCIPHER) += eseqiv.o
  18 +obj-$(CONFIG_CRYPTO_BLKCIPHER2) += crypto_blkcipher.o
  19 +obj-$(CONFIG_CRYPTO_BLKCIPHER2) += chainiv.o
  20 +obj-$(CONFIG_CRYPTO_BLKCIPHER2) += eseqiv.o
21 21 obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o
22 22  
23 23 crypto_hash-objs := hash.o
24 24 crypto_hash-objs += ahash.o
25   -obj-$(CONFIG_CRYPTO_HASH) += crypto_hash.o
  25 +obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o
26 26  
27 27 cryptomgr-objs := algboss.o testmgr.o
28 28  
29   -obj-$(CONFIG_CRYPTO_MANAGER) += cryptomgr.o
  29 +obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o
30 30 obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
31 31 obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
32 32 obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o
... ... @@ -73,8 +73,8 @@
73 73 obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o
74 74 obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o
75 75 obj-$(CONFIG_CRYPTO_LZO) += lzo.o
76   -obj-$(CONFIG_CRYPTO_RNG) += rng.o
77   -obj-$(CONFIG_CRYPTO_RNG) += krng.o
  76 +obj-$(CONFIG_CRYPTO_RNG2) += rng.o
  77 +obj-$(CONFIG_CRYPTO_RNG2) += krng.o
78 78 obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o
79 79 obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
80 80