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