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