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