xref: /linux/lib/crypto/Kconfig (revision fab183d632628381b466a41479489541ac0e29a0)
1746b2e02SArd Biesheuvel# SPDX-License-Identifier: GPL-2.0
2746b2e02SArd Biesheuvel
3aacb37f5SEric Biggersconfig CRYPTO_HASH_INFO
4aacb37f5SEric Biggers	bool
5aacb37f5SEric Biggers
67033b937SEric Biggersconfig CRYPTO_LIB_UTILS
77033b937SEric Biggers	tristate
87033b937SEric Biggers
9746b2e02SArd Biesheuvelconfig CRYPTO_LIB_AES
10746b2e02SArd Biesheuvel	tristate
11*e073f123SEric Biggers	# Select dependencies of modes that are part of libaes.
12746b2e02SArd Biesheuvel	select CRYPTO_LIB_GF128HASH if CRYPTO_LIB_AES_GCM != n
13a22fd0e3SEric Biggers	select CRYPTO_LIB_UTILS
14a22fd0e3SEric Biggers
15a22fd0e3SEric Biggersconfig CRYPTO_LIB_AES_ARCH
16fa229775SEric Biggers	bool
172b1ef7aeSEric Biggers	depends on CRYPTO_LIB_AES && !UML && !KMSAN
187cf2082eSEric Biggers	default y if ARM
19a4e573dbSEric Biggers	default y if ARM64
20a4e573dbSEric Biggers	default y if PPC && (SPE || (PPC64 && VSX))
210cab1561SEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
22293c7cd5SEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
2324eb22d8SEric Biggers	default y if S390
24a22fd0e3SEric Biggers	default y if SPARC64
25f1354404SArd Biesheuvel	default y if X86
26f1354404SArd Biesheuvel
27f1354404SArd Biesheuvelconfig CRYPTO_LIB_AESCFB
28f1354404SArd Biesheuvel	tristate
29f1354404SArd Biesheuvel	select CRYPTO_LIB_AES
30309a7e51SEric Biggers	select CRYPTO_LIB_UTILS
31309a7e51SEric Biggers
32309a7e51SEric Biggersconfig CRYPTO_LIB_AES_CBC
33309a7e51SEric Biggers	tristate
34309a7e51SEric Biggers	select CRYPTO_LIB_AES
35309a7e51SEric Biggers	help
36309a7e51SEric Biggers	  The AES-CBC and AES-CBC-CTS library functions.
37309a7e51SEric Biggers
38520af5daSArd Biesheuvelconfig CRYPTO_LIB_AES_CBC_MACS
39520af5daSArd Biesheuvel	tristate
40520af5daSArd Biesheuvel	select CRYPTO_LIB_AES
41ea0c746fSEric Biggers	help
42520af5daSArd Biesheuvel	  The AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC library functions.  Select
43520af5daSArd Biesheuvel	  this if your module uses any of the functions from
44746b2e02SArd Biesheuvel	  <crypto/aes-cbc-macs.h>.
45746b2e02SArd Biesheuvel
46746b2e02SArd Biesheuvelconfig CRYPTO_LIB_AES_CCM
4761c581a4SArd Biesheuvel	tristate
4861c581a4SArd Biesheuvel	select CRYPTO_LIB_AES
4961c581a4SArd Biesheuvel	select CRYPTO_LIB_AES_CBC_MACS
5023a16c95SEric Biggers	select CRYPTO_LIB_AES_CTR
5123a16c95SEric Biggers	help
5223a16c95SEric Biggers	  The AES-CCM library functions.
5323a16c95SEric Biggers
5423a16c95SEric Biggersconfig CRYPTO_LIB_AES_CTR
5523a16c95SEric Biggers	tristate
5623a16c95SEric Biggers	select CRYPTO_LIB_AES
5723a16c95SEric Biggers	help
5823a16c95SEric Biggers	  The AES-CTR and AES-XCTR library functions.
59ba6617bdSEric Biggers
6023a16c95SEric Biggersconfig CRYPTO_LIB_AES_ECB
6139ee3970SEric Biggers	tristate
6266d7fb94SJason A. Donenfeld	select CRYPTO_LIB_AES
6339ee3970SEric Biggers	help
6439ee3970SEric Biggers	  The AES-ECB library functions.
6539ee3970SEric Biggers
6639ee3970SEric Biggersconfig CRYPTO_LIB_AES_GCM
6739ee3970SEric Biggers	tristate
6866d7fb94SJason A. Donenfeld	select CRYPTO_LIB_AES
695fb8ef25SArd Biesheuvel	select CRYPTO_LIB_AES_CTR
70edc8e80bSArnd Bergmann	help
7113cecc52SEric Biggers	  The AES-GCM library functions.
725fb8ef25SArd Biesheuvel
7313cecc52SEric Biggersconfig CRYPTO_LIB_AES_XTS
7413cecc52SEric Biggers	tristate
7513cecc52SEric Biggers	select CRYPTO_LIB_AES
7613cecc52SEric Biggers	help
7713cecc52SEric Biggers	  The AES-XTS library functions.
7813cecc52SEric Biggers
7913cecc52SEric Biggersconfig CRYPTO_LIB_ARC4
80c2db2288SEric Biggers	tristate
8113cecc52SEric Biggers
8213cecc52SEric Biggersconfig CRYPTO_LIB_GF128MUL
831cd5bb6eSEric Biggers	tristate
841cd5bb6eSEric Biggers
8513cecc52SEric Biggersconfig CRYPTO_LIB_BLAKE2B
8613cecc52SEric Biggers	tristate
875fb8ef25SArd Biesheuvel	help
8868546e56SEric Biggers	  The BLAKE2b library functions.  Select this if your module uses any of
890ed42a6fSJason A. Donenfeld	  the functions from <crypto/blake2b.h>.
9017ec3e71SHerbert Xu
910ed42a6fSJason A. Donenfeldconfig CRYPTO_LIB_BLAKE2B_ARCH
9268546e56SEric Biggers	bool
9368546e56SEric Biggers	depends on CRYPTO_LIB_BLAKE2B && !UML
940ed42a6fSJason A. Donenfeld	default y if ARM && KERNEL_MODE_NEON
9568546e56SEric Biggers
9668546e56SEric Biggers# BLAKE2s support is always built-in, so there's no CRYPTO_LIB_BLAKE2S option.
9768546e56SEric Biggers
9844e8241cSEric Biggersconfig CRYPTO_LIB_BLAKE2S_ARCH
9968546e56SEric Biggers	bool
10068546e56SEric Biggers	depends on !UML
10117ec3e71SHerbert Xu	default y if ARM
10268546e56SEric Biggers	default y if X86_64
10368546e56SEric Biggers
10468546e56SEric Biggersconfig CRYPTO_LIB_CHACHA
10568546e56SEric Biggers	tristate
1060ed42a6fSJason A. Donenfeld	select CRYPTO_LIB_UTILS
107746b2e02SArd Biesheuvel	help
108746b2e02SArd Biesheuvel	  Enable the ChaCha library interface.  Select this if your module uses
109746b2e02SArd Biesheuvel	  chacha_crypt() or hchacha_block().
11061f66c52SEric Biggers
11161f66c52SEric Biggersconfig CRYPTO_LIB_CHACHA_ARCH
11261f66c52SEric Biggers	bool
11361f66c52SEric Biggers	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
11461f66c52SEric Biggers	default y if ARM
11561f66c52SEric Biggers	default y if ARM64
11661f66c52SEric Biggers	default y if MIPS && CPU_MIPS32_R2
11761f66c52SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
11861f66c52SEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
11971e59795SEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
12061f66c52SEric Biggers	default y if S390
12173f315c1SEric Biggers	default y if X86_64
122af413d71SEric Biggers
123af413d71SEric Biggersconfig CRYPTO_LIB_CURVE25519
124efd1d2c8SEric Biggers	tristate
12561f66c52SEric Biggers	select CRYPTO_LIB_UTILS
12661f66c52SEric Biggers	help
127e1644613SEric Biggers	  The Curve25519 library functions.  Select this if your module uses any
128e1644613SEric Biggers	  of the functions from <crypto/curve25519.h>.
129e1644613SEric Biggers
130e1644613SEric Biggersconfig CRYPTO_LIB_CURVE25519_ARCH
131e1644613SEric Biggers	bool
132e1644613SEric Biggers	depends on CRYPTO_LIB_CURVE25519 && !UML && !KMSAN
13364edcceaSEric Biggers	default y if ARM && KERNEL_MODE_NEON && !CPU_BIG_ENDIAN
13464edcceaSEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN
13564edcceaSEric Biggers	default y if X86_64
13664edcceaSEric Biggers
13764edcceaSEric Biggersconfig CRYPTO_LIB_CURVE25519_GENERIC
13864edcceaSEric Biggers	bool
13964edcceaSEric Biggers	depends on CRYPTO_LIB_CURVE25519
14014e15c71SEric Biggers	default y if !CRYPTO_LIB_CURVE25519_ARCH || ARM || X86_64
14114e15c71SEric Biggers
14214e15c71SEric Biggersconfig CRYPTO_LIB_DES
14314e15c71SEric Biggers	tristate
14414e15c71SEric Biggers
14514e15c71SEric Biggersconfig CRYPTO_LIB_GF128HASH
14614e15c71SEric Biggers	tristate
14714e15c71SEric Biggers	help
1480d92c555SEric Biggers	  The GHASH and POLYVAL library functions.  Select this if your module
14929e39a11SEric Biggers	  uses any of the functions from <crypto/gf128hash.h>.
150c2db2288SEric Biggers
151a229d832SEric Biggersconfig CRYPTO_LIB_GF128HASH_ARCH
15214e15c71SEric Biggers	bool
153b646b782SEric Biggers	depends on CRYPTO_LIB_GF128HASH && !UML
154b646b782SEric Biggers	default y if ARM && KERNEL_MODE_NEON
155b646b782SEric Biggers	default y if ARM64
156b646b782SEric Biggers	default y if PPC64 && VSX
157b646b782SEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
158b646b782SEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
159b646b782SEric Biggers	default y if S390
160b646b782SEric Biggers	default y if X86_64
1611af424b1SEric Biggers
162b646b782SEric Biggersconfig CRYPTO_LIB_MD5
163c2db2288SEric Biggers	tristate
164b646b782SEric Biggers	help
165b646b782SEric Biggers	  The MD5 and HMAC-MD5 library functions.  Select this if your module
166b646b782SEric Biggers	  uses any of the functions from <crypto/md5.h>.
167bef9c755SZhihang Shao
168b646b782SEric Biggersconfig CRYPTO_LIB_MLDSA
169b646b782SEric Biggers	tristate
170b646b782SEric Biggers	select CRYPTO_LIB_SHA3
171b646b782SEric Biggers	help
172b646b782SEric Biggers	  The ML-DSA library functions.  Select this if your module uses any of
173b646b782SEric Biggers	  the functions from <crypto/mldsa.h>.
174b646b782SEric Biggers
175b646b782SEric Biggersconfig CRYPTO_LIB_NH
176b646b782SEric Biggers	tristate
177b646b782SEric Biggers	help
178b646b782SEric Biggers	  Implementation of the NH almost-universal hash function, specifically
179b646b782SEric Biggers	  the variant of NH used in Adiantum.
180b646b782SEric Biggers
181a1d93064SArd Biesheuvelconfig CRYPTO_LIB_NH_ARCH
182a1d93064SArd Biesheuvel	bool
183bef9c755SZhihang Shao	depends on CRYPTO_LIB_NH && !UML && !KMSAN
184d7d7b853SJason A. Donenfeld	default y if ARM && KERNEL_MODE_NEON
185a6b803b3SArd Biesheuvel	default y if ARM64
186a1d93064SArd Biesheuvel	default y if X86_64
187a1d93064SArd Biesheuvel
188ed20078bSArd Biesheuvelconfig CRYPTO_LIB_POLY1305
189edc8e80bSArnd Bergmann	tristate
190ed20078bSArd Biesheuvel	help
191ed20078bSArd Biesheuvel	  The Poly1305 library functions.  Select this if your module uses any
19217ec3e71SHerbert Xu	  of the functions from <crypto/poly1305.h>.
193ed20078bSArd Biesheuvel
194ec8f7f48SEric Biggersconfig CRYPTO_LIB_POLY1305_ARCH
195ec8f7f48SEric Biggers	bool
19690860aefSEric Biggers	depends on CRYPTO_LIB_POLY1305 && !UML && !KMSAN
197d73915fdSEric Biggers	default y if ARM
198d73915fdSEric Biggers	default y if ARM64
19990860aefSEric Biggers	default y if MIPS
20090860aefSEric Biggers	# The PPC64 code needs to be fixed to work in softirq context.
20190860aefSEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
20290860aefSEric Biggers	default y if RISCV
20370cb6ca5SEric Biggers	default y if X86_64
204c2db2288SEric Biggers
205b6ac1dacSEric Biggers# This symbol controls the inclusion of the Poly1305 generic code.  This differs
2066b9ae8cfSEric Biggers# from most of the other algorithms, which handle the generic code
207377982d5SEric Biggers# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
208c7510599SEric Biggers# which calls the poly1305_core_*() functions directly, can enable them.
209f3d6cb3dSEric Biggersconfig CRYPTO_LIB_POLY1305_GENERIC
210ec8f7f48SEric Biggers	bool
211746b2e02SArd Biesheuvel	depends on CRYPTO_LIB_POLY1305
212746b2e02SArd Biesheuvel	# Enable if there's no arch impl or the arch impl requires the generic
213950e5c84SEric Biggers	# impl as a fallback.  (Or if selected explicitly.)
214d73915fdSEric Biggers	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
215d73915fdSEric Biggers
216d73915fdSEric Biggersconfig CRYPTO_LIB_POLY1305_RSIZE
217950e5c84SEric Biggers	int
218e96cb950SEric Biggers	default 2 if MIPS || RISCV
219950e5c84SEric Biggers	default 11 if X86_64
220e96cb950SEric Biggers	default 9 if ARM || ARM64
221e96cb950SEric Biggers	default 1
222e96cb950SEric Biggers
223e96cb950SEric Biggersconfig CRYPTO_LIB_CHACHA20POLY1305
224e96cb950SEric Biggers	tristate
2251cd5bb6eSEric Biggers	select CRYPTO_LIB_CHACHA
2261cd5bb6eSEric Biggers	select CRYPTO_LIB_POLY1305
227e96cb950SEric Biggers	select CRYPTO_LIB_UTILS
228e96cb950SEric Biggers
229e96cb950SEric Biggersconfig CRYPTO_LIB_SHA1
2302b31277aSTianjia Zhang	tristate
231b693c703SEric Biggers	help
232b693c703SEric Biggers	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
233b693c703SEric Biggers	  uses any of the functions from <crypto/sha1.h>.
23423e8b437SEric Biggers
23523e8b437SEric Biggersconfig CRYPTO_LIB_SHA1_ARCH
23623e8b437SEric Biggers	bool
237b693c703SEric Biggers	depends on CRYPTO_LIB_SHA1 && !UML
238b693c703SEric Biggers	default y if ARM
239b693c703SEric Biggers	default y if ARM64
240b693c703SEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
24124c91b62SEric Biggers	default y if PPC
24260e3f1e9SEric Biggers	default y if S390
2437117739aSEric Biggers	default y if SPARC64
2441cd5bb6eSEric Biggers	default y if X86_64
2451cd5bb6eSEric Biggers
246b7b36608SEric Biggersconfig CRYPTO_LIB_SHA256
24702b35babSEric Biggers	tristate
248484c1811SEric Biggers	help
249b693c703SEric Biggers	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
25005934472SDavid Howells	  Select this if your module uses any of these functions from
25105934472SDavid Howells	  <crypto/sha2.h>.
25205934472SDavid Howells
25305934472SDavid Howellsconfig CRYPTO_LIB_SHA256_ARCH
25405934472SDavid Howells	bool
25505934472SDavid Howells	depends on CRYPTO_LIB_SHA256 && !UML
25605934472SDavid Howells	default y if ARM && !CPU_V7M
2571e29a750SEric Biggers	default y if ARM64
2581e29a750SEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
2591e29a750SEric Biggers	default y if PPC && SPE
260c2db2288SEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
26104171105SEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
2621e29a750SEric Biggers	default y if S390
263f4065b2fSHerbert Xu	default y if SPARC64
264f4065b2fSHerbert Xu	default y if X86_64
265324bb3bbSEric Biggers
266324bb3bbSEric Biggersconfig CRYPTO_LIB_SHA512
267324bb3bbSEric Biggers	tristate
268324bb3bbSEric Biggers	help
269324bb3bbSEric Biggers	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
270324bb3bbSEric Biggers	  Select this if your module uses any of these functions from
271324bb3bbSEric Biggers	  <crypto/sha2.h>.
2729f69f52bSEric Biggers
2735f6bbba5SEric Biggersconfig CRYPTO_LIB_SHA512_ARCH
2745f6bbba5SEric Biggers	bool
27517ba6108SEric Biggers	depends on CRYPTO_LIB_SHA512 && !UML
276	default y if ARM && !CPU_V7M
277	default y if ARM64
278	default y if MIPS && CPU_CAVIUM_OCTEON
279	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
280		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
281	default y if S390
282	default y if SPARC64
283	default y if X86_64
284
285config CRYPTO_LIB_SHA3
286	tristate
287	select CRYPTO_LIB_UTILS
288	help
289	  The SHA3 library functions.  Select this if your module uses any of
290	  the functions from <crypto/sha3.h>.
291
292config CRYPTO_LIB_SHA3_ARCH
293	bool
294	depends on CRYPTO_LIB_SHA3 && !UML
295	default y if ARM64
296	default y if S390
297
298config CRYPTO_LIB_SM3
299	tristate
300	help
301	  The SM3 library functions.  Select this if your module uses any of the
302	  functions from <crypto/sm3.h>.
303
304config CRYPTO_LIB_SM3_ARCH
305	bool
306	depends on CRYPTO_LIB_SM3 && !UML
307	default y if ARM64
308	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
309		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
310	default y if X86_64
311