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