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