xref: /linux/lib/crypto/Kconfig (revision cf52058dcdd96420cfc38ee284c5ac077901ea61)
1# SPDX-License-Identifier: GPL-2.0
2
3config CRYPTO_HASH_INFO
4	bool
5
6config CRYPTO_LIB_UTILS
7	tristate
8
9config CRYPTO_LIB_AES
10	tristate
11	# Select dependencies of modes that are part of libaes.
12	select CRYPTO_LIB_UTILS if CRYPTO_LIB_AES_CBC_MACS
13
14config CRYPTO_LIB_AES_ARCH
15	bool
16	depends on CRYPTO_LIB_AES && !UML && !KMSAN
17	default y if ARM
18	default y if ARM64
19	default y if PPC && (SPE || (PPC64 && VSX))
20	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
21		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
22	default y if S390
23	default y if SPARC64
24	default y if X86
25
26config CRYPTO_LIB_AESCFB
27	tristate
28	select CRYPTO_LIB_AES
29	select CRYPTO_LIB_UTILS
30
31config CRYPTO_LIB_AES_CBC_MACS
32	tristate
33	select CRYPTO_LIB_AES
34	help
35	  The AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC library functions.  Select
36	  this if your module uses any of the functions from
37	  <crypto/aes-cbc-macs.h>.
38
39config CRYPTO_LIB_AESGCM
40	tristate
41	select CRYPTO_LIB_AES
42	select CRYPTO_LIB_GF128HASH
43	select CRYPTO_LIB_UTILS
44
45config CRYPTO_LIB_ARC4
46	tristate
47
48config CRYPTO_LIB_GF128MUL
49	tristate
50
51config CRYPTO_LIB_BLAKE2B
52	tristate
53	help
54	  The BLAKE2b library functions.  Select this if your module uses any of
55	  the functions from <crypto/blake2b.h>.
56
57config CRYPTO_LIB_BLAKE2B_ARCH
58	bool
59	depends on CRYPTO_LIB_BLAKE2B && !UML
60	default y if ARM && KERNEL_MODE_NEON
61
62# BLAKE2s support is always built-in, so there's no CRYPTO_LIB_BLAKE2S option.
63
64config CRYPTO_LIB_BLAKE2S_ARCH
65	bool
66	depends on !UML
67	default y if ARM
68	default y if X86_64
69
70config CRYPTO_LIB_CHACHA
71	tristate
72	select CRYPTO_LIB_UTILS
73	help
74	  Enable the ChaCha library interface.  Select this if your module uses
75	  chacha_crypt() or hchacha_block().
76
77config CRYPTO_LIB_CHACHA_ARCH
78	bool
79	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
80	default y if ARM
81	default y if ARM64
82	default y if MIPS && CPU_MIPS32_R2
83	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
84	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
85		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
86	default y if S390
87	default y if X86_64
88
89config CRYPTO_LIB_CURVE25519
90	tristate
91	select CRYPTO_LIB_UTILS
92	help
93	  The Curve25519 library functions.  Select this if your module uses any
94	  of the functions from <crypto/curve25519.h>.
95
96config CRYPTO_LIB_CURVE25519_ARCH
97	bool
98	depends on CRYPTO_LIB_CURVE25519 && !UML && !KMSAN
99	default y if ARM && KERNEL_MODE_NEON && !CPU_BIG_ENDIAN
100	default y if PPC64 && CPU_LITTLE_ENDIAN
101	default y if X86_64
102
103config CRYPTO_LIB_CURVE25519_GENERIC
104	bool
105	depends on CRYPTO_LIB_CURVE25519
106	default y if !CRYPTO_LIB_CURVE25519_ARCH || ARM || X86_64
107
108config CRYPTO_LIB_DES
109	tristate
110
111config CRYPTO_LIB_GF128HASH
112	tristate
113	help
114	  The GHASH and POLYVAL library functions.  Select this if your module
115	  uses any of the functions from <crypto/gf128hash.h>.
116
117config CRYPTO_LIB_GF128HASH_ARCH
118	bool
119	depends on CRYPTO_LIB_GF128HASH && !UML
120	default y if ARM && KERNEL_MODE_NEON
121	default y if ARM64
122	default y if PPC64 && VSX
123	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
124		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
125	default y if S390
126	default y if X86_64
127
128config CRYPTO_LIB_MD5
129	tristate
130	help
131	  The MD5 and HMAC-MD5 library functions.  Select this if your module
132	  uses any of the functions from <crypto/md5.h>.
133
134config CRYPTO_LIB_MLDSA
135	tristate
136	select CRYPTO_LIB_SHA3
137	help
138	  The ML-DSA library functions.  Select this if your module uses any of
139	  the functions from <crypto/mldsa.h>.
140
141config CRYPTO_LIB_NH
142	tristate
143	help
144	  Implementation of the NH almost-universal hash function, specifically
145	  the variant of NH used in Adiantum.
146
147config CRYPTO_LIB_NH_ARCH
148	bool
149	depends on CRYPTO_LIB_NH && !UML && !KMSAN
150	default y if ARM && KERNEL_MODE_NEON
151	default y if ARM64
152	default y if X86_64
153
154config CRYPTO_LIB_POLY1305
155	tristate
156	help
157	  The Poly1305 library functions.  Select this if your module uses any
158	  of the functions from <crypto/poly1305.h>.
159
160config CRYPTO_LIB_POLY1305_ARCH
161	bool
162	depends on CRYPTO_LIB_POLY1305 && !UML && !KMSAN
163	default y if ARM
164	default y if ARM64
165	default y if MIPS
166	# The PPC64 code needs to be fixed to work in softirq context.
167	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
168	default y if RISCV
169	default y if X86_64
170
171# This symbol controls the inclusion of the Poly1305 generic code.  This differs
172# from most of the other algorithms, which handle the generic code
173# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
174# which calls the poly1305_core_*() functions directly, can enable them.
175config CRYPTO_LIB_POLY1305_GENERIC
176	bool
177	depends on CRYPTO_LIB_POLY1305
178	# Enable if there's no arch impl or the arch impl requires the generic
179	# impl as a fallback.  (Or if selected explicitly.)
180	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
181
182config CRYPTO_LIB_POLY1305_RSIZE
183	int
184	default 2 if MIPS || RISCV
185	default 11 if X86_64
186	default 9 if ARM || ARM64
187	default 1
188
189config CRYPTO_LIB_CHACHA20POLY1305
190	tristate
191	select CRYPTO_LIB_CHACHA
192	select CRYPTO_LIB_POLY1305
193	select CRYPTO_LIB_UTILS
194
195config CRYPTO_LIB_SHA1
196	tristate
197	help
198	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
199	  uses any of the functions from <crypto/sha1.h>.
200
201config CRYPTO_LIB_SHA1_ARCH
202	bool
203	depends on CRYPTO_LIB_SHA1 && !UML
204	default y if ARM
205	default y if ARM64
206	default y if MIPS && CPU_CAVIUM_OCTEON
207	default y if PPC
208	default y if S390
209	default y if SPARC64
210	default y if X86_64
211
212config CRYPTO_LIB_SHA256
213	tristate
214	help
215	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
216	  Select this if your module uses any of these functions from
217	  <crypto/sha2.h>.
218
219config CRYPTO_LIB_SHA256_ARCH
220	bool
221	depends on CRYPTO_LIB_SHA256 && !UML
222	default y if ARM && !CPU_V7M
223	default y if ARM64
224	default y if MIPS && CPU_CAVIUM_OCTEON
225	default y if PPC && SPE
226	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
227		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
228	default y if S390
229	default y if SPARC64
230	default y if X86_64
231
232config CRYPTO_LIB_SHA512
233	tristate
234	help
235	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
236	  Select this if your module uses any of these functions from
237	  <crypto/sha2.h>.
238
239config CRYPTO_LIB_SHA512_ARCH
240	bool
241	depends on CRYPTO_LIB_SHA512 && !UML
242	default y if ARM && !CPU_V7M
243	default y if ARM64
244	default y if MIPS && CPU_CAVIUM_OCTEON
245	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
246		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
247	default y if S390
248	default y if SPARC64
249	default y if X86_64
250
251config CRYPTO_LIB_SHA3
252	tristate
253	select CRYPTO_LIB_UTILS
254	help
255	  The SHA3 library functions.  Select this if your module uses any of
256	  the functions from <crypto/sha3.h>.
257
258config CRYPTO_LIB_SHA3_ARCH
259	bool
260	depends on CRYPTO_LIB_SHA3 && !UML
261	default y if ARM64
262	default y if S390
263
264config CRYPTO_LIB_SM3
265	tristate
266	help
267	  The SM3 library functions.  Select this if your module uses any of the
268	  functions from <crypto/sm3.h>.
269
270config CRYPTO_LIB_SM3_ARCH
271	bool
272	depends on CRYPTO_LIB_SM3 && !UML
273	default y if ARM64
274	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
275		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
276	default y if X86_64
277