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