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