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