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