xref: /linux/lib/crypto/Kconfig (revision c17ee635fd3a482b2ad2bf5e269755c2eae5f25e)
1746b2e02SArd Biesheuvel# SPDX-License-Identifier: GPL-2.0
2746b2e02SArd Biesheuvel
3e56e1898SJustin M. Forbesmenu "Crypto library routines"
4e56e1898SJustin M. Forbes
5aacb37f5SEric Biggersconfig CRYPTO_HASH_INFO
6aacb37f5SEric Biggers	bool
7aacb37f5SEric Biggers
87033b937SEric Biggersconfig CRYPTO_LIB_UTILS
97033b937SEric Biggers	tristate
107033b937SEric Biggers
11746b2e02SArd Biesheuvelconfig CRYPTO_LIB_AES
12746b2e02SArd Biesheuvel	tristate
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
24*24eb22d8SEric 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
31520af5daSArd Biesheuvelconfig CRYPTO_LIB_AESGCM
32520af5daSArd Biesheuvel	tristate
33520af5daSArd Biesheuvel	select CRYPTO_LIB_AES
34520af5daSArd Biesheuvel	select CRYPTO_LIB_GF128MUL
35520af5daSArd Biesheuvel	select CRYPTO_LIB_UTILS
36520af5daSArd Biesheuvel
37746b2e02SArd Biesheuvelconfig CRYPTO_LIB_ARC4
38746b2e02SArd Biesheuvel	tristate
39746b2e02SArd Biesheuvel
4061c581a4SArd Biesheuvelconfig CRYPTO_LIB_GF128MUL
4161c581a4SArd Biesheuvel	tristate
4261c581a4SArd Biesheuvel
4323a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B
4423a16c95SEric Biggers	tristate
4523a16c95SEric Biggers	help
4623a16c95SEric Biggers	  The BLAKE2b library functions.  Select this if your module uses any of
4723a16c95SEric Biggers	  the functions from <crypto/blake2b.h>.
4823a16c95SEric Biggers
4923a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B_ARCH
5023a16c95SEric Biggers	bool
5123a16c95SEric Biggers	depends on CRYPTO_LIB_BLAKE2B && !UML
52ba6617bdSEric Biggers	default y if ARM && KERNEL_MODE_NEON
5323a16c95SEric Biggers
5439ee3970SEric Biggers# BLAKE2s support is always built-in, so there's no CRYPTO_LIB_BLAKE2S option.
5566d7fb94SJason A. Donenfeld
5639ee3970SEric Biggersconfig CRYPTO_LIB_BLAKE2S_ARCH
5739ee3970SEric Biggers	bool
5839ee3970SEric Biggers	depends on !UML
5939ee3970SEric Biggers	default y if ARM
6039ee3970SEric Biggers	default y if X86_64
6166d7fb94SJason A. Donenfeld
625fb8ef25SArd Biesheuvelconfig CRYPTO_LIB_CHACHA
63edc8e80bSArnd Bergmann	tristate
6413cecc52SEric Biggers	select CRYPTO_LIB_UTILS
655fb8ef25SArd Biesheuvel	help
6613cecc52SEric Biggers	  Enable the ChaCha library interface.  Select this if your module uses
6713cecc52SEric Biggers	  chacha_crypt() or hchacha_block().
6813cecc52SEric Biggers
6913cecc52SEric Biggersconfig CRYPTO_LIB_CHACHA_ARCH
7013cecc52SEric Biggers	bool
7113cecc52SEric Biggers	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
7213cecc52SEric Biggers	default y if ARM
7313cecc52SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
7413cecc52SEric Biggers	default y if MIPS && CPU_MIPS32_R2
7513cecc52SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
761cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
771cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
7813cecc52SEric Biggers	default y if S390
7913cecc52SEric Biggers	default y if X86_64
805fb8ef25SArd Biesheuvel
8168546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519
820ed42a6fSJason A. Donenfeld	tristate
8317ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
840ed42a6fSJason A. Donenfeld	help
8568546e56SEric Biggers	  The Curve25519 library functions.  Select this if your module uses any
8668546e56SEric Biggers	  of the functions from <crypto/curve25519.h>.
870ed42a6fSJason A. Donenfeld
8868546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_ARCH
8968546e56SEric Biggers	bool
9068546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519 && !UML && !KMSAN
9144e8241cSEric Biggers	default y if ARM && KERNEL_MODE_NEON && !CPU_BIG_ENDIAN
9268546e56SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN
9368546e56SEric Biggers	default y if X86_64
9417ec3e71SHerbert Xu
9568546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_GENERIC
9668546e56SEric Biggers	bool
9768546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519
9868546e56SEric Biggers	default y if !CRYPTO_LIB_CURVE25519_ARCH || ARM || X86_64
990ed42a6fSJason A. Donenfeld
100746b2e02SArd Biesheuvelconfig CRYPTO_LIB_DES
101746b2e02SArd Biesheuvel	tristate
102746b2e02SArd Biesheuvel
103e1644613SEric Biggersconfig CRYPTO_LIB_MD5
104e1644613SEric Biggers	tristate
105e1644613SEric Biggers	help
106e1644613SEric Biggers	  The MD5 and HMAC-MD5 library functions.  Select this if your module
107e1644613SEric Biggers	  uses any of the functions from <crypto/md5.h>.
108e1644613SEric Biggers
109e1644613SEric Biggersconfig CRYPTO_LIB_MD5_ARCH
110e1644613SEric Biggers	bool
111e1644613SEric Biggers	depends on CRYPTO_LIB_MD5 && !UML
112c9e5ac0aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
11309371e13SEric Biggers	default y if PPC
114a1848f6eSEric Biggers	default y if SPARC64
115e1644613SEric Biggers
11664edcceaSEric Biggersconfig CRYPTO_LIB_MLDSA
11764edcceaSEric Biggers	tristate
11864edcceaSEric Biggers	select CRYPTO_LIB_SHA3
11964edcceaSEric Biggers	help
12064edcceaSEric Biggers	  The ML-DSA library functions.  Select this if your module uses any of
12164edcceaSEric Biggers	  the functions from <crypto/mldsa.h>.
12264edcceaSEric Biggers
12314e15c71SEric Biggersconfig CRYPTO_LIB_NH
12414e15c71SEric Biggers	tristate
12514e15c71SEric Biggers	help
12614e15c71SEric Biggers	  Implementation of the NH almost-universal hash function, specifically
12714e15c71SEric Biggers	  the variant of NH used in Adiantum.
12814e15c71SEric Biggers
12914e15c71SEric Biggersconfig CRYPTO_LIB_NH_ARCH
13014e15c71SEric Biggers	bool
1310d92c555SEric Biggers	depends on CRYPTO_LIB_NH && !UML && !KMSAN
13229e39a11SEric Biggers	default y if ARM && KERNEL_MODE_NEON
133b4a8528dSEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
134a229d832SEric Biggers	default y if X86_64
13514e15c71SEric Biggers
136b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305
137b646b782SEric Biggers	tristate
138b646b782SEric Biggers	help
139b646b782SEric Biggers	  The Poly1305 library functions.  Select this if your module uses any
140b646b782SEric Biggers	  of the functions from <crypto/poly1305.h>.
141b646b782SEric Biggers
142b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_ARCH
143b646b782SEric Biggers	bool
1441af424b1SEric Biggers	depends on CRYPTO_LIB_POLY1305 && !UML && !KMSAN
145b646b782SEric Biggers	default y if ARM
146b646b782SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
147b646b782SEric Biggers	default y if MIPS
148b646b782SEric Biggers	# The PPC64 code needs to be fixed to work in softirq context.
149b646b782SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
150bef9c755SZhihang Shao	default y if RISCV
151b646b782SEric Biggers	default y if X86_64
152b646b782SEric Biggers
153b646b782SEric Biggers# This symbol controls the inclusion of the Poly1305 generic code.  This differs
154b646b782SEric Biggers# from most of the other algorithms, which handle the generic code
155b646b782SEric Biggers# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
156b646b782SEric Biggers# which calls the poly1305_core_*() functions directly, can enable them.
157b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_GENERIC
158b646b782SEric Biggers	bool
159b646b782SEric Biggers	depends on CRYPTO_LIB_POLY1305
160b646b782SEric Biggers	# Enable if there's no arch impl or the arch impl requires the generic
161b646b782SEric Biggers	# impl as a fallback.  (Or if selected explicitly.)
162b646b782SEric Biggers	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
163b646b782SEric Biggers
164a1d93064SArd Biesheuvelconfig CRYPTO_LIB_POLY1305_RSIZE
165a1d93064SArd Biesheuvel	int
166bef9c755SZhihang Shao	default 2 if MIPS || RISCV
167d7d7b853SJason A. Donenfeld	default 11 if X86_64
168a6b803b3SArd Biesheuvel	default 9 if ARM || ARM64
169a1d93064SArd Biesheuvel	default 1
170a1d93064SArd Biesheuvel
1713d176751SEric Biggersconfig CRYPTO_LIB_POLYVAL
1723d176751SEric Biggers	tristate
1733d176751SEric Biggers	help
1743d176751SEric Biggers	  The POLYVAL library functions.  Select this if your module uses any of
1753d176751SEric Biggers	  the functions from <crypto/polyval.h>.
1763d176751SEric Biggers
1773d176751SEric Biggersconfig CRYPTO_LIB_POLYVAL_ARCH
1783d176751SEric Biggers	bool
1793d176751SEric Biggers	depends on CRYPTO_LIB_POLYVAL && !UML
18037919e23SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
1814d8da355SEric Biggers	default y if X86_64
1823d176751SEric Biggers
183ed20078bSArd Biesheuvelconfig CRYPTO_LIB_CHACHA20POLY1305
184edc8e80bSArnd Bergmann	tristate
185ed20078bSArd Biesheuvel	select CRYPTO_LIB_CHACHA
186ed20078bSArd Biesheuvel	select CRYPTO_LIB_POLY1305
18717ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
188ed20078bSArd Biesheuvel
189ec8f7f48SEric Biggersconfig CRYPTO_LIB_SHA1
190ec8f7f48SEric Biggers	tristate
19190860aefSEric Biggers	help
192d73915fdSEric Biggers	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
193d73915fdSEric Biggers	  uses any of the functions from <crypto/sha1.h>.
19490860aefSEric Biggers
19590860aefSEric Biggersconfig CRYPTO_LIB_SHA1_ARCH
19690860aefSEric Biggers	bool
19790860aefSEric Biggers	depends on CRYPTO_LIB_SHA1 && !UML
19870cb6ca5SEric Biggers	default y if ARM
19900d549bbSEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
200b6ac1dacSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
2016b9ae8cfSEric Biggers	default y if PPC
202377982d5SEric Biggers	default y if S390
203c7510599SEric Biggers	default y if SPARC64
204f3d6cb3dSEric Biggers	default y if X86_64
205ec8f7f48SEric Biggers
206746b2e02SArd Biesheuvelconfig CRYPTO_LIB_SHA256
207746b2e02SArd Biesheuvel	tristate
208950e5c84SEric Biggers	help
209d73915fdSEric Biggers	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
210d73915fdSEric Biggers	  Select this if your module uses any of these functions from
211d73915fdSEric Biggers	  <crypto/sha2.h>.
212950e5c84SEric Biggers
213e96cb950SEric Biggersconfig CRYPTO_LIB_SHA256_ARCH
214950e5c84SEric Biggers	bool
215e96cb950SEric Biggers	depends on CRYPTO_LIB_SHA256 && !UML
216e96cb950SEric Biggers	default y if ARM && !CPU_V7M
217e96cb950SEric Biggers	default y if ARM64
218e96cb950SEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
219e96cb950SEric Biggers	default y if PPC && SPE
2201cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2211cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
222e96cb950SEric Biggers	default y if S390
223e96cb950SEric Biggers	default y if SPARC64
224e96cb950SEric Biggers	default y if X86_64
2252b31277aSTianjia Zhang
226b693c703SEric Biggersconfig CRYPTO_LIB_SHA512
227b693c703SEric Biggers	tristate
228b693c703SEric Biggers	help
22923e8b437SEric Biggers	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
23023e8b437SEric Biggers	  Select this if your module uses any of these functions from
23123e8b437SEric Biggers	  <crypto/sha2.h>.
232b693c703SEric Biggers
233b693c703SEric Biggersconfig CRYPTO_LIB_SHA512_ARCH
234b693c703SEric Biggers	bool
235b693c703SEric Biggers	depends on CRYPTO_LIB_SHA512 && !UML
23624c91b62SEric Biggers	default y if ARM && !CPU_V7M
23760e3f1e9SEric Biggers	default y if ARM64
2387117739aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
2391cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2401cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
241b7b36608SEric Biggers	default y if S390
24202b35babSEric Biggers	default y if SPARC64
243484c1811SEric Biggers	default y if X86_64
244b693c703SEric Biggers
24505934472SDavid Howellsconfig CRYPTO_LIB_SHA3
24605934472SDavid Howells	tristate
24705934472SDavid Howells	select CRYPTO_LIB_UTILS
24805934472SDavid Howells	help
24905934472SDavid Howells	  The SHA3 library functions.  Select this if your module uses any of
25005934472SDavid Howells	  the functions from <crypto/sha3.h>.
25105934472SDavid Howells
2521e29a750SEric Biggersconfig CRYPTO_LIB_SHA3_ARCH
2531e29a750SEric Biggers	bool
2541e29a750SEric Biggers	depends on CRYPTO_LIB_SHA3 && !UML
2551e29a750SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
25604171105SEric Biggers	default y if S390
2571e29a750SEric Biggers
258f4065b2fSHerbert Xuconfig CRYPTO_LIB_SM3
259f4065b2fSHerbert Xu	tristate
260f4065b2fSHerbert Xu
2614dcf6cadSEric Biggerssource "lib/crypto/tests/Kconfig"
2624dcf6cadSEric Biggers
263e56e1898SJustin M. Forbesendmenu
264