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