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