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