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