xref: /linux/lib/crypto/Kconfig (revision a4e573db06a4e8c519ec4c42f8e1249a0853367a)
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))
20*a4e573dbSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
21*a4e573dbSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
22a22fd0e3SEric Biggers
23f1354404SArd Biesheuvelconfig CRYPTO_LIB_AESCFB
24f1354404SArd Biesheuvel	tristate
25f1354404SArd Biesheuvel	select CRYPTO_LIB_AES
26f1354404SArd Biesheuvel	select CRYPTO_LIB_UTILS
27f1354404SArd Biesheuvel
28520af5daSArd Biesheuvelconfig CRYPTO_LIB_AESGCM
29520af5daSArd Biesheuvel	tristate
30520af5daSArd Biesheuvel	select CRYPTO_LIB_AES
31520af5daSArd Biesheuvel	select CRYPTO_LIB_GF128MUL
32520af5daSArd Biesheuvel	select CRYPTO_LIB_UTILS
33520af5daSArd Biesheuvel
34746b2e02SArd Biesheuvelconfig CRYPTO_LIB_ARC4
35746b2e02SArd Biesheuvel	tristate
36746b2e02SArd Biesheuvel
3761c581a4SArd Biesheuvelconfig CRYPTO_LIB_GF128MUL
3861c581a4SArd Biesheuvel	tristate
3961c581a4SArd Biesheuvel
4023a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B
4123a16c95SEric Biggers	tristate
4223a16c95SEric Biggers	help
4323a16c95SEric Biggers	  The BLAKE2b library functions.  Select this if your module uses any of
4423a16c95SEric Biggers	  the functions from <crypto/blake2b.h>.
4523a16c95SEric Biggers
4623a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B_ARCH
4723a16c95SEric Biggers	bool
4823a16c95SEric Biggers	depends on CRYPTO_LIB_BLAKE2B && !UML
49ba6617bdSEric Biggers	default y if ARM && KERNEL_MODE_NEON
5023a16c95SEric Biggers
5139ee3970SEric Biggers# BLAKE2s support is always built-in, so there's no CRYPTO_LIB_BLAKE2S option.
5266d7fb94SJason A. Donenfeld
5339ee3970SEric Biggersconfig CRYPTO_LIB_BLAKE2S_ARCH
5439ee3970SEric Biggers	bool
5539ee3970SEric Biggers	depends on !UML
5639ee3970SEric Biggers	default y if ARM
5739ee3970SEric Biggers	default y if X86_64
5866d7fb94SJason A. Donenfeld
595fb8ef25SArd Biesheuvelconfig CRYPTO_LIB_CHACHA
60edc8e80bSArnd Bergmann	tristate
6113cecc52SEric Biggers	select CRYPTO_LIB_UTILS
625fb8ef25SArd Biesheuvel	help
6313cecc52SEric Biggers	  Enable the ChaCha library interface.  Select this if your module uses
6413cecc52SEric Biggers	  chacha_crypt() or hchacha_block().
6513cecc52SEric Biggers
6613cecc52SEric Biggersconfig CRYPTO_LIB_CHACHA_ARCH
6713cecc52SEric Biggers	bool
6813cecc52SEric Biggers	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
6913cecc52SEric Biggers	default y if ARM
7013cecc52SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
7113cecc52SEric Biggers	default y if MIPS && CPU_MIPS32_R2
7213cecc52SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
731cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
741cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
7513cecc52SEric Biggers	default y if S390
7613cecc52SEric Biggers	default y if X86_64
775fb8ef25SArd Biesheuvel
7868546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519
790ed42a6fSJason A. Donenfeld	tristate
8017ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
810ed42a6fSJason A. Donenfeld	help
8268546e56SEric Biggers	  The Curve25519 library functions.  Select this if your module uses any
8368546e56SEric Biggers	  of the functions from <crypto/curve25519.h>.
840ed42a6fSJason A. Donenfeld
8568546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_ARCH
8668546e56SEric Biggers	bool
8768546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519 && !UML && !KMSAN
8844e8241cSEric Biggers	default y if ARM && KERNEL_MODE_NEON && !CPU_BIG_ENDIAN
8968546e56SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN
9068546e56SEric Biggers	default y if X86_64
9117ec3e71SHerbert Xu
9268546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_GENERIC
9368546e56SEric Biggers	bool
9468546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519
9568546e56SEric Biggers	default y if !CRYPTO_LIB_CURVE25519_ARCH || ARM || X86_64
960ed42a6fSJason A. Donenfeld
97746b2e02SArd Biesheuvelconfig CRYPTO_LIB_DES
98746b2e02SArd Biesheuvel	tristate
99746b2e02SArd Biesheuvel
100e1644613SEric Biggersconfig CRYPTO_LIB_MD5
101e1644613SEric Biggers	tristate
102e1644613SEric Biggers	help
103e1644613SEric Biggers	  The MD5 and HMAC-MD5 library functions.  Select this if your module
104e1644613SEric Biggers	  uses any of the functions from <crypto/md5.h>.
105e1644613SEric Biggers
106e1644613SEric Biggersconfig CRYPTO_LIB_MD5_ARCH
107e1644613SEric Biggers	bool
108e1644613SEric Biggers	depends on CRYPTO_LIB_MD5 && !UML
109c9e5ac0aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
11009371e13SEric Biggers	default y if PPC
111a1848f6eSEric Biggers	default y if SPARC64
112e1644613SEric Biggers
11364edcceaSEric Biggersconfig CRYPTO_LIB_MLDSA
11464edcceaSEric Biggers	tristate
11564edcceaSEric Biggers	select CRYPTO_LIB_SHA3
11664edcceaSEric Biggers	help
11764edcceaSEric Biggers	  The ML-DSA library functions.  Select this if your module uses any of
11864edcceaSEric Biggers	  the functions from <crypto/mldsa.h>.
11964edcceaSEric Biggers
12014e15c71SEric Biggersconfig CRYPTO_LIB_NH
12114e15c71SEric Biggers	tristate
12214e15c71SEric Biggers	help
12314e15c71SEric Biggers	  Implementation of the NH almost-universal hash function, specifically
12414e15c71SEric Biggers	  the variant of NH used in Adiantum.
12514e15c71SEric Biggers
12614e15c71SEric Biggersconfig CRYPTO_LIB_NH_ARCH
12714e15c71SEric Biggers	bool
1280d92c555SEric Biggers	depends on CRYPTO_LIB_NH && !UML && !KMSAN
12929e39a11SEric Biggers	default y if ARM && KERNEL_MODE_NEON
130b4a8528dSEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
131a229d832SEric Biggers	default y if X86_64
13214e15c71SEric Biggers
133b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305
134b646b782SEric Biggers	tristate
135b646b782SEric Biggers	help
136b646b782SEric Biggers	  The Poly1305 library functions.  Select this if your module uses any
137b646b782SEric Biggers	  of the functions from <crypto/poly1305.h>.
138b646b782SEric Biggers
139b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_ARCH
140b646b782SEric Biggers	bool
1411af424b1SEric Biggers	depends on CRYPTO_LIB_POLY1305 && !UML && !KMSAN
142b646b782SEric Biggers	default y if ARM
143b646b782SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
144b646b782SEric Biggers	default y if MIPS
145b646b782SEric Biggers	# The PPC64 code needs to be fixed to work in softirq context.
146b646b782SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
147bef9c755SZhihang Shao	default y if RISCV
148b646b782SEric Biggers	default y if X86_64
149b646b782SEric Biggers
150b646b782SEric Biggers# This symbol controls the inclusion of the Poly1305 generic code.  This differs
151b646b782SEric Biggers# from most of the other algorithms, which handle the generic code
152b646b782SEric Biggers# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
153b646b782SEric Biggers# which calls the poly1305_core_*() functions directly, can enable them.
154b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_GENERIC
155b646b782SEric Biggers	bool
156b646b782SEric Biggers	depends on CRYPTO_LIB_POLY1305
157b646b782SEric Biggers	# Enable if there's no arch impl or the arch impl requires the generic
158b646b782SEric Biggers	# impl as a fallback.  (Or if selected explicitly.)
159b646b782SEric Biggers	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
160b646b782SEric Biggers
161a1d93064SArd Biesheuvelconfig CRYPTO_LIB_POLY1305_RSIZE
162a1d93064SArd Biesheuvel	int
163bef9c755SZhihang Shao	default 2 if MIPS || RISCV
164d7d7b853SJason A. Donenfeld	default 11 if X86_64
165a6b803b3SArd Biesheuvel	default 9 if ARM || ARM64
166a1d93064SArd Biesheuvel	default 1
167a1d93064SArd Biesheuvel
1683d176751SEric Biggersconfig CRYPTO_LIB_POLYVAL
1693d176751SEric Biggers	tristate
1703d176751SEric Biggers	help
1713d176751SEric Biggers	  The POLYVAL library functions.  Select this if your module uses any of
1723d176751SEric Biggers	  the functions from <crypto/polyval.h>.
1733d176751SEric Biggers
1743d176751SEric Biggersconfig CRYPTO_LIB_POLYVAL_ARCH
1753d176751SEric Biggers	bool
1763d176751SEric Biggers	depends on CRYPTO_LIB_POLYVAL && !UML
17737919e23SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
1784d8da355SEric Biggers	default y if X86_64
1793d176751SEric Biggers
180ed20078bSArd Biesheuvelconfig CRYPTO_LIB_CHACHA20POLY1305
181edc8e80bSArnd Bergmann	tristate
182ed20078bSArd Biesheuvel	select CRYPTO_LIB_CHACHA
183ed20078bSArd Biesheuvel	select CRYPTO_LIB_POLY1305
18417ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
185ed20078bSArd Biesheuvel
186ec8f7f48SEric Biggersconfig CRYPTO_LIB_SHA1
187ec8f7f48SEric Biggers	tristate
18890860aefSEric Biggers	help
189d73915fdSEric Biggers	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
190d73915fdSEric Biggers	  uses any of the functions from <crypto/sha1.h>.
19190860aefSEric Biggers
19290860aefSEric Biggersconfig CRYPTO_LIB_SHA1_ARCH
19390860aefSEric Biggers	bool
19490860aefSEric Biggers	depends on CRYPTO_LIB_SHA1 && !UML
19570cb6ca5SEric Biggers	default y if ARM
19600d549bbSEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
197b6ac1dacSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
1986b9ae8cfSEric Biggers	default y if PPC
199377982d5SEric Biggers	default y if S390
200c7510599SEric Biggers	default y if SPARC64
201f3d6cb3dSEric Biggers	default y if X86_64
202ec8f7f48SEric Biggers
203746b2e02SArd Biesheuvelconfig CRYPTO_LIB_SHA256
204746b2e02SArd Biesheuvel	tristate
205950e5c84SEric Biggers	help
206d73915fdSEric Biggers	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
207d73915fdSEric Biggers	  Select this if your module uses any of these functions from
208d73915fdSEric Biggers	  <crypto/sha2.h>.
209950e5c84SEric Biggers
210e96cb950SEric Biggersconfig CRYPTO_LIB_SHA256_ARCH
211950e5c84SEric Biggers	bool
212e96cb950SEric Biggers	depends on CRYPTO_LIB_SHA256 && !UML
213e96cb950SEric Biggers	default y if ARM && !CPU_V7M
214e96cb950SEric Biggers	default y if ARM64
215e96cb950SEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
216e96cb950SEric Biggers	default y if PPC && SPE
2171cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2181cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
219e96cb950SEric Biggers	default y if S390
220e96cb950SEric Biggers	default y if SPARC64
221e96cb950SEric Biggers	default y if X86_64
2222b31277aSTianjia Zhang
223b693c703SEric Biggersconfig CRYPTO_LIB_SHA512
224b693c703SEric Biggers	tristate
225b693c703SEric Biggers	help
22623e8b437SEric Biggers	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
22723e8b437SEric Biggers	  Select this if your module uses any of these functions from
22823e8b437SEric Biggers	  <crypto/sha2.h>.
229b693c703SEric Biggers
230b693c703SEric Biggersconfig CRYPTO_LIB_SHA512_ARCH
231b693c703SEric Biggers	bool
232b693c703SEric Biggers	depends on CRYPTO_LIB_SHA512 && !UML
23324c91b62SEric Biggers	default y if ARM && !CPU_V7M
23460e3f1e9SEric Biggers	default y if ARM64
2357117739aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
2361cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2371cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
238b7b36608SEric Biggers	default y if S390
23902b35babSEric Biggers	default y if SPARC64
240484c1811SEric Biggers	default y if X86_64
241b693c703SEric Biggers
24205934472SDavid Howellsconfig CRYPTO_LIB_SHA3
24305934472SDavid Howells	tristate
24405934472SDavid Howells	select CRYPTO_LIB_UTILS
24505934472SDavid Howells	help
24605934472SDavid Howells	  The SHA3 library functions.  Select this if your module uses any of
24705934472SDavid Howells	  the functions from <crypto/sha3.h>.
24805934472SDavid Howells
2491e29a750SEric Biggersconfig CRYPTO_LIB_SHA3_ARCH
2501e29a750SEric Biggers	bool
2511e29a750SEric Biggers	depends on CRYPTO_LIB_SHA3 && !UML
2521e29a750SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
25304171105SEric Biggers	default y if S390
2541e29a750SEric Biggers
255f4065b2fSHerbert Xuconfig CRYPTO_LIB_SM3
256f4065b2fSHerbert Xu	tristate
257f4065b2fSHerbert Xu
2584dcf6cadSEric Biggerssource "lib/crypto/tests/Kconfig"
2594dcf6cadSEric Biggers
260e56e1898SJustin M. Forbesendmenu
261