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