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