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