xref: /linux/lib/crypto/Kconfig (revision 23e5c306a207360bfda4f8e96a229dd5fde81cbd)
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
11309a7e51SEric Biggers	# Select dependencies of modes that are part of libaes.
12309a7e51SEric Biggers	select CRYPTO_LIB_UTILS if CRYPTO_LIB_AES_CBC_MACS
13746b2e02SArd Biesheuvel
14a22fd0e3SEric Biggersconfig CRYPTO_LIB_AES_ARCH
15a22fd0e3SEric Biggers	bool
16a22fd0e3SEric Biggers	depends on CRYPTO_LIB_AES && !UML && !KMSAN
17fa229775SEric Biggers	default y if ARM
182b1ef7aeSEric Biggers	default y if ARM64
197cf2082eSEric Biggers	default y if PPC && (SPE || (PPC64 && VSX))
20a4e573dbSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
21a4e573dbSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
220cab1561SEric Biggers	default y if S390
23293c7cd5SEric Biggers	default y if SPARC64
2424eb22d8SEric Biggers	default y if X86
25a22fd0e3SEric Biggers
26f1354404SArd Biesheuvelconfig CRYPTO_LIB_AESCFB
27f1354404SArd Biesheuvel	tristate
28f1354404SArd Biesheuvel	select CRYPTO_LIB_AES
29f1354404SArd Biesheuvel	select CRYPTO_LIB_UTILS
30f1354404SArd Biesheuvel
31309a7e51SEric Biggersconfig CRYPTO_LIB_AES_CBC_MACS
32309a7e51SEric Biggers	tristate
33309a7e51SEric Biggers	select CRYPTO_LIB_AES
34309a7e51SEric Biggers	help
35309a7e51SEric Biggers	  The AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC library functions.  Select
36309a7e51SEric Biggers	  this if your module uses any of the functions from
37309a7e51SEric Biggers	  <crypto/aes-cbc-macs.h>.
38309a7e51SEric Biggers
39520af5daSArd Biesheuvelconfig CRYPTO_LIB_AESGCM
40520af5daSArd Biesheuvel	tristate
41520af5daSArd Biesheuvel	select CRYPTO_LIB_AES
42ea0c746fSEric Biggers	select CRYPTO_LIB_GF128HASH
43520af5daSArd Biesheuvel	select CRYPTO_LIB_UTILS
44520af5daSArd Biesheuvel
45746b2e02SArd Biesheuvelconfig CRYPTO_LIB_ARC4
46746b2e02SArd Biesheuvel	tristate
47746b2e02SArd Biesheuvel
4861c581a4SArd Biesheuvelconfig CRYPTO_LIB_GF128MUL
4961c581a4SArd Biesheuvel	tristate
5061c581a4SArd Biesheuvel
5123a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B
5223a16c95SEric Biggers	tristate
5323a16c95SEric Biggers	help
5423a16c95SEric Biggers	  The BLAKE2b library functions.  Select this if your module uses any of
5523a16c95SEric Biggers	  the functions from <crypto/blake2b.h>.
5623a16c95SEric Biggers
5723a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B_ARCH
5823a16c95SEric Biggers	bool
5923a16c95SEric Biggers	depends on CRYPTO_LIB_BLAKE2B && !UML
60ba6617bdSEric Biggers	default y if ARM && KERNEL_MODE_NEON
6123a16c95SEric Biggers
6239ee3970SEric Biggers# BLAKE2s support is always built-in, so there's no CRYPTO_LIB_BLAKE2S option.
6366d7fb94SJason A. Donenfeld
6439ee3970SEric Biggersconfig CRYPTO_LIB_BLAKE2S_ARCH
6539ee3970SEric Biggers	bool
6639ee3970SEric Biggers	depends on !UML
6739ee3970SEric Biggers	default y if ARM
6839ee3970SEric Biggers	default y if X86_64
6966d7fb94SJason A. Donenfeld
705fb8ef25SArd Biesheuvelconfig CRYPTO_LIB_CHACHA
71edc8e80bSArnd Bergmann	tristate
7213cecc52SEric Biggers	select CRYPTO_LIB_UTILS
735fb8ef25SArd Biesheuvel	help
7413cecc52SEric Biggers	  Enable the ChaCha library interface.  Select this if your module uses
7513cecc52SEric Biggers	  chacha_crypt() or hchacha_block().
7613cecc52SEric Biggers
7713cecc52SEric Biggersconfig CRYPTO_LIB_CHACHA_ARCH
7813cecc52SEric Biggers	bool
7913cecc52SEric Biggers	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
8013cecc52SEric Biggers	default y if ARM
81c2db2288SEric Biggers	default y if ARM64
8213cecc52SEric Biggers	default y if MIPS && CPU_MIPS32_R2
8313cecc52SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
841cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
851cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
8613cecc52SEric Biggers	default y if S390
8713cecc52SEric Biggers	default y if X86_64
885fb8ef25SArd Biesheuvel
8968546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519
900ed42a6fSJason A. Donenfeld	tristate
9117ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
920ed42a6fSJason A. Donenfeld	help
9368546e56SEric Biggers	  The Curve25519 library functions.  Select this if your module uses any
9468546e56SEric Biggers	  of the functions from <crypto/curve25519.h>.
950ed42a6fSJason A. Donenfeld
9668546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_ARCH
9768546e56SEric Biggers	bool
9868546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519 && !UML && !KMSAN
9944e8241cSEric Biggers	default y if ARM && KERNEL_MODE_NEON && !CPU_BIG_ENDIAN
10068546e56SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN
10168546e56SEric Biggers	default y if X86_64
10217ec3e71SHerbert Xu
10368546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_GENERIC
10468546e56SEric Biggers	bool
10568546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519
10668546e56SEric Biggers	default y if !CRYPTO_LIB_CURVE25519_ARCH || ARM || X86_64
1070ed42a6fSJason A. Donenfeld
108746b2e02SArd Biesheuvelconfig CRYPTO_LIB_DES
109746b2e02SArd Biesheuvel	tristate
110746b2e02SArd Biesheuvel
11161f66c52SEric Biggersconfig CRYPTO_LIB_GF128HASH
11261f66c52SEric Biggers	tristate
11361f66c52SEric Biggers	help
11461f66c52SEric Biggers	  The GHASH and POLYVAL library functions.  Select this if your module
11561f66c52SEric Biggers	  uses any of the functions from <crypto/gf128hash.h>.
11661f66c52SEric Biggers
11761f66c52SEric Biggersconfig CRYPTO_LIB_GF128HASH_ARCH
11861f66c52SEric Biggers	bool
11961f66c52SEric Biggers	depends on CRYPTO_LIB_GF128HASH && !UML
12071e59795SEric Biggers	default y if ARM && KERNEL_MODE_NEON
12161f66c52SEric Biggers	default y if ARM64
12273f315c1SEric Biggers	default y if PPC64 && VSX
123af413d71SEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
124af413d71SEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
125efd1d2c8SEric Biggers	default y if S390
12661f66c52SEric Biggers	default y if X86_64
12761f66c52SEric Biggers
128e1644613SEric Biggersconfig CRYPTO_LIB_MD5
129e1644613SEric Biggers	tristate
130e1644613SEric Biggers	help
131e1644613SEric Biggers	  The MD5 and HMAC-MD5 library functions.  Select this if your module
132e1644613SEric Biggers	  uses any of the functions from <crypto/md5.h>.
133e1644613SEric Biggers
134e1644613SEric Biggersconfig CRYPTO_LIB_MD5_ARCH
135e1644613SEric Biggers	bool
136e1644613SEric Biggers	depends on CRYPTO_LIB_MD5 && !UML
13709371e13SEric Biggers	default y if PPC
138e1644613SEric Biggers
13964edcceaSEric Biggersconfig CRYPTO_LIB_MLDSA
14064edcceaSEric Biggers	tristate
14164edcceaSEric Biggers	select CRYPTO_LIB_SHA3
14264edcceaSEric Biggers	help
14364edcceaSEric Biggers	  The ML-DSA library functions.  Select this if your module uses any of
14464edcceaSEric Biggers	  the functions from <crypto/mldsa.h>.
14564edcceaSEric Biggers
14614e15c71SEric Biggersconfig CRYPTO_LIB_NH
14714e15c71SEric Biggers	tristate
14814e15c71SEric Biggers	help
14914e15c71SEric Biggers	  Implementation of the NH almost-universal hash function, specifically
15014e15c71SEric Biggers	  the variant of NH used in Adiantum.
15114e15c71SEric Biggers
15214e15c71SEric Biggersconfig CRYPTO_LIB_NH_ARCH
15314e15c71SEric Biggers	bool
1540d92c555SEric Biggers	depends on CRYPTO_LIB_NH && !UML && !KMSAN
15529e39a11SEric Biggers	default y if ARM && KERNEL_MODE_NEON
156c2db2288SEric Biggers	default y if ARM64
157a229d832SEric Biggers	default y if X86_64
15814e15c71SEric Biggers
159b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305
160b646b782SEric Biggers	tristate
161b646b782SEric Biggers	help
162b646b782SEric Biggers	  The Poly1305 library functions.  Select this if your module uses any
163b646b782SEric Biggers	  of the functions from <crypto/poly1305.h>.
164b646b782SEric Biggers
165b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_ARCH
166b646b782SEric Biggers	bool
1671af424b1SEric Biggers	depends on CRYPTO_LIB_POLY1305 && !UML && !KMSAN
168b646b782SEric Biggers	default y if ARM
169c2db2288SEric Biggers	default y if ARM64
170b646b782SEric Biggers	default y if MIPS
171b646b782SEric Biggers	# The PPC64 code needs to be fixed to work in softirq context.
172b646b782SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
173bef9c755SZhihang Shao	default y if RISCV
174b646b782SEric Biggers	default y if X86_64
175b646b782SEric Biggers
176b646b782SEric Biggers# This symbol controls the inclusion of the Poly1305 generic code.  This differs
177b646b782SEric Biggers# from most of the other algorithms, which handle the generic code
178b646b782SEric Biggers# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
179b646b782SEric Biggers# which calls the poly1305_core_*() functions directly, can enable them.
180b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_GENERIC
181b646b782SEric Biggers	bool
182b646b782SEric Biggers	depends on CRYPTO_LIB_POLY1305
183b646b782SEric Biggers	# Enable if there's no arch impl or the arch impl requires the generic
184b646b782SEric Biggers	# impl as a fallback.  (Or if selected explicitly.)
185b646b782SEric Biggers	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
186b646b782SEric Biggers
187a1d93064SArd Biesheuvelconfig CRYPTO_LIB_POLY1305_RSIZE
188a1d93064SArd Biesheuvel	int
189bef9c755SZhihang Shao	default 2 if MIPS || RISCV
190d7d7b853SJason A. Donenfeld	default 11 if X86_64
191a6b803b3SArd Biesheuvel	default 9 if ARM || ARM64
192a1d93064SArd Biesheuvel	default 1
193a1d93064SArd Biesheuvel
194ed20078bSArd Biesheuvelconfig CRYPTO_LIB_CHACHA20POLY1305
195edc8e80bSArnd Bergmann	tristate
196ed20078bSArd Biesheuvel	select CRYPTO_LIB_CHACHA
197ed20078bSArd Biesheuvel	select CRYPTO_LIB_POLY1305
19817ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
199ed20078bSArd Biesheuvel
200ec8f7f48SEric Biggersconfig CRYPTO_LIB_SHA1
201ec8f7f48SEric Biggers	tristate
20290860aefSEric Biggers	help
203d73915fdSEric Biggers	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
204d73915fdSEric Biggers	  uses any of the functions from <crypto/sha1.h>.
20590860aefSEric Biggers
20690860aefSEric Biggersconfig CRYPTO_LIB_SHA1_ARCH
20790860aefSEric Biggers	bool
20890860aefSEric Biggers	depends on CRYPTO_LIB_SHA1 && !UML
20970cb6ca5SEric Biggers	default y if ARM
210c2db2288SEric Biggers	default y if ARM64
211b6ac1dacSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
2126b9ae8cfSEric Biggers	default y if PPC
213377982d5SEric Biggers	default y if S390
214c7510599SEric Biggers	default y if SPARC64
215f3d6cb3dSEric Biggers	default y if X86_64
216ec8f7f48SEric Biggers
217746b2e02SArd Biesheuvelconfig CRYPTO_LIB_SHA256
218746b2e02SArd Biesheuvel	tristate
219950e5c84SEric Biggers	help
220d73915fdSEric Biggers	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
221d73915fdSEric Biggers	  Select this if your module uses any of these functions from
222d73915fdSEric Biggers	  <crypto/sha2.h>.
223950e5c84SEric Biggers
224e96cb950SEric Biggersconfig CRYPTO_LIB_SHA256_ARCH
225950e5c84SEric Biggers	bool
226e96cb950SEric Biggers	depends on CRYPTO_LIB_SHA256 && !UML
227e96cb950SEric Biggers	default y if ARM && !CPU_V7M
228e96cb950SEric Biggers	default y if ARM64
229e96cb950SEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
230e96cb950SEric Biggers	default y if PPC && SPE
2311cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2321cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
233e96cb950SEric Biggers	default y if S390
234e96cb950SEric Biggers	default y if SPARC64
235e96cb950SEric Biggers	default y if X86_64
2362b31277aSTianjia Zhang
237b693c703SEric Biggersconfig CRYPTO_LIB_SHA512
238b693c703SEric Biggers	tristate
239b693c703SEric Biggers	help
24023e8b437SEric Biggers	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
24123e8b437SEric Biggers	  Select this if your module uses any of these functions from
24223e8b437SEric Biggers	  <crypto/sha2.h>.
243b693c703SEric Biggers
244b693c703SEric Biggersconfig CRYPTO_LIB_SHA512_ARCH
245b693c703SEric Biggers	bool
246b693c703SEric Biggers	depends on CRYPTO_LIB_SHA512 && !UML
24724c91b62SEric Biggers	default y if ARM && !CPU_V7M
24860e3f1e9SEric Biggers	default y if ARM64
2497117739aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
2501cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2511cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
252b7b36608SEric Biggers	default y if S390
25302b35babSEric Biggers	default y if SPARC64
254484c1811SEric Biggers	default y if X86_64
255b693c703SEric Biggers
25605934472SDavid Howellsconfig CRYPTO_LIB_SHA3
25705934472SDavid Howells	tristate
25805934472SDavid Howells	select CRYPTO_LIB_UTILS
25905934472SDavid Howells	help
26005934472SDavid Howells	  The SHA3 library functions.  Select this if your module uses any of
26105934472SDavid Howells	  the functions from <crypto/sha3.h>.
26205934472SDavid Howells
2631e29a750SEric Biggersconfig CRYPTO_LIB_SHA3_ARCH
2641e29a750SEric Biggers	bool
2651e29a750SEric Biggers	depends on CRYPTO_LIB_SHA3 && !UML
266c2db2288SEric Biggers	default y if ARM64
26704171105SEric Biggers	default y if S390
2681e29a750SEric Biggers
269f4065b2fSHerbert Xuconfig CRYPTO_LIB_SM3
270f4065b2fSHerbert Xu	tristate
271324bb3bbSEric Biggers	help
272324bb3bbSEric Biggers	  The SM3 library functions.  Select this if your module uses any of the
273324bb3bbSEric Biggers	  functions from <crypto/sm3.h>.
274324bb3bbSEric Biggers
275324bb3bbSEric Biggersconfig CRYPTO_LIB_SM3_ARCH
276324bb3bbSEric Biggers	bool
277324bb3bbSEric Biggers	depends on CRYPTO_LIB_SM3 && !UML
2789f69f52bSEric Biggers	default y if ARM64
2795f6bbba5SEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2805f6bbba5SEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
281*17ba6108SEric Biggers	default y if X86_64
282