xref: /linux/lib/crypto/Kconfig (revision b4a8528d17fbcd9027290c168efd6ba7ac4d4cd2)
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
14f1354404SArd Biesheuvelconfig CRYPTO_LIB_AESCFB
15f1354404SArd Biesheuvel	tristate
16f1354404SArd Biesheuvel	select CRYPTO_LIB_AES
17f1354404SArd Biesheuvel	select CRYPTO_LIB_UTILS
18f1354404SArd Biesheuvel
19520af5daSArd Biesheuvelconfig CRYPTO_LIB_AESGCM
20520af5daSArd Biesheuvel	tristate
21520af5daSArd Biesheuvel	select CRYPTO_LIB_AES
22520af5daSArd Biesheuvel	select CRYPTO_LIB_GF128MUL
23520af5daSArd Biesheuvel	select CRYPTO_LIB_UTILS
24520af5daSArd Biesheuvel
25746b2e02SArd Biesheuvelconfig CRYPTO_LIB_ARC4
26746b2e02SArd Biesheuvel	tristate
27746b2e02SArd Biesheuvel
2861c581a4SArd Biesheuvelconfig CRYPTO_LIB_GF128MUL
2961c581a4SArd Biesheuvel	tristate
3061c581a4SArd Biesheuvel
3123a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B
3223a16c95SEric Biggers	tristate
3323a16c95SEric Biggers	help
3423a16c95SEric Biggers	  The BLAKE2b library functions.  Select this if your module uses any of
3523a16c95SEric Biggers	  the functions from <crypto/blake2b.h>.
3623a16c95SEric Biggers
3723a16c95SEric Biggersconfig CRYPTO_LIB_BLAKE2B_ARCH
3823a16c95SEric Biggers	bool
3923a16c95SEric Biggers	depends on CRYPTO_LIB_BLAKE2B && !UML
40ba6617bdSEric Biggers	default y if ARM && KERNEL_MODE_NEON
4123a16c95SEric Biggers
4239ee3970SEric Biggers# BLAKE2s support is always built-in, so there's no CRYPTO_LIB_BLAKE2S option.
4366d7fb94SJason A. Donenfeld
4439ee3970SEric Biggersconfig CRYPTO_LIB_BLAKE2S_ARCH
4539ee3970SEric Biggers	bool
4639ee3970SEric Biggers	depends on !UML
4739ee3970SEric Biggers	default y if ARM
4839ee3970SEric Biggers	default y if X86_64
4966d7fb94SJason A. Donenfeld
505fb8ef25SArd Biesheuvelconfig CRYPTO_LIB_CHACHA
51edc8e80bSArnd Bergmann	tristate
5213cecc52SEric Biggers	select CRYPTO_LIB_UTILS
535fb8ef25SArd Biesheuvel	help
5413cecc52SEric Biggers	  Enable the ChaCha library interface.  Select this if your module uses
5513cecc52SEric Biggers	  chacha_crypt() or hchacha_block().
5613cecc52SEric Biggers
5713cecc52SEric Biggersconfig CRYPTO_LIB_CHACHA_ARCH
5813cecc52SEric Biggers	bool
5913cecc52SEric Biggers	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
6013cecc52SEric Biggers	default y if ARM
6113cecc52SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
6213cecc52SEric Biggers	default y if MIPS && CPU_MIPS32_R2
6313cecc52SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
641cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
651cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
6613cecc52SEric Biggers	default y if S390
6713cecc52SEric Biggers	default y if X86_64
685fb8ef25SArd Biesheuvel
6968546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519
700ed42a6fSJason A. Donenfeld	tristate
7117ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
720ed42a6fSJason A. Donenfeld	help
7368546e56SEric Biggers	  The Curve25519 library functions.  Select this if your module uses any
7468546e56SEric Biggers	  of the functions from <crypto/curve25519.h>.
750ed42a6fSJason A. Donenfeld
7668546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_ARCH
7768546e56SEric Biggers	bool
7868546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519 && !UML && !KMSAN
7944e8241cSEric Biggers	default y if ARM && KERNEL_MODE_NEON && !CPU_BIG_ENDIAN
8068546e56SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN
8168546e56SEric Biggers	default y if X86_64
8217ec3e71SHerbert Xu
8368546e56SEric Biggersconfig CRYPTO_LIB_CURVE25519_GENERIC
8468546e56SEric Biggers	bool
8568546e56SEric Biggers	depends on CRYPTO_LIB_CURVE25519
8668546e56SEric Biggers	default y if !CRYPTO_LIB_CURVE25519_ARCH || ARM || X86_64
870ed42a6fSJason A. Donenfeld
88746b2e02SArd Biesheuvelconfig CRYPTO_LIB_DES
89746b2e02SArd Biesheuvel	tristate
90746b2e02SArd Biesheuvel
91e1644613SEric Biggersconfig CRYPTO_LIB_MD5
92e1644613SEric Biggers	tristate
93e1644613SEric Biggers	help
94e1644613SEric Biggers	  The MD5 and HMAC-MD5 library functions.  Select this if your module
95e1644613SEric Biggers	  uses any of the functions from <crypto/md5.h>.
96e1644613SEric Biggers
97e1644613SEric Biggersconfig CRYPTO_LIB_MD5_ARCH
98e1644613SEric Biggers	bool
99e1644613SEric Biggers	depends on CRYPTO_LIB_MD5 && !UML
100c9e5ac0aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
10109371e13SEric Biggers	default y if PPC
102a1848f6eSEric Biggers	default y if SPARC64
103e1644613SEric Biggers
10464edcceaSEric Biggersconfig CRYPTO_LIB_MLDSA
10564edcceaSEric Biggers	tristate
10664edcceaSEric Biggers	select CRYPTO_LIB_SHA3
10764edcceaSEric Biggers	help
10864edcceaSEric Biggers	  The ML-DSA library functions.  Select this if your module uses any of
10964edcceaSEric Biggers	  the functions from <crypto/mldsa.h>.
11064edcceaSEric Biggers
11114e15c71SEric Biggersconfig CRYPTO_LIB_NH
11214e15c71SEric Biggers	tristate
11314e15c71SEric Biggers	help
11414e15c71SEric Biggers	  Implementation of the NH almost-universal hash function, specifically
11514e15c71SEric Biggers	  the variant of NH used in Adiantum.
11614e15c71SEric Biggers
11714e15c71SEric Biggersconfig CRYPTO_LIB_NH_ARCH
11814e15c71SEric Biggers	bool
11914e15c71SEric Biggers	depends on CRYPTO_LIB_NH && !UML
12029e39a11SEric Biggers	default y if ARM && KERNEL_MODE_NEON
121*b4a8528dSEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
12214e15c71SEric Biggers
123b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305
124b646b782SEric Biggers	tristate
125b646b782SEric Biggers	help
126b646b782SEric Biggers	  The Poly1305 library functions.  Select this if your module uses any
127b646b782SEric Biggers	  of the functions from <crypto/poly1305.h>.
128b646b782SEric Biggers
129b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_ARCH
130b646b782SEric Biggers	bool
1311af424b1SEric Biggers	depends on CRYPTO_LIB_POLY1305 && !UML && !KMSAN
132b646b782SEric Biggers	default y if ARM
133b646b782SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
134b646b782SEric Biggers	default y if MIPS
135b646b782SEric Biggers	# The PPC64 code needs to be fixed to work in softirq context.
136b646b782SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
137bef9c755SZhihang Shao	default y if RISCV
138b646b782SEric Biggers	default y if X86_64
139b646b782SEric Biggers
140b646b782SEric Biggers# This symbol controls the inclusion of the Poly1305 generic code.  This differs
141b646b782SEric Biggers# from most of the other algorithms, which handle the generic code
142b646b782SEric Biggers# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
143b646b782SEric Biggers# which calls the poly1305_core_*() functions directly, can enable them.
144b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_GENERIC
145b646b782SEric Biggers	bool
146b646b782SEric Biggers	depends on CRYPTO_LIB_POLY1305
147b646b782SEric Biggers	# Enable if there's no arch impl or the arch impl requires the generic
148b646b782SEric Biggers	# impl as a fallback.  (Or if selected explicitly.)
149b646b782SEric Biggers	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
150b646b782SEric Biggers
151a1d93064SArd Biesheuvelconfig CRYPTO_LIB_POLY1305_RSIZE
152a1d93064SArd Biesheuvel	int
153bef9c755SZhihang Shao	default 2 if MIPS || RISCV
154d7d7b853SJason A. Donenfeld	default 11 if X86_64
155a6b803b3SArd Biesheuvel	default 9 if ARM || ARM64
156a1d93064SArd Biesheuvel	default 1
157a1d93064SArd Biesheuvel
1583d176751SEric Biggersconfig CRYPTO_LIB_POLYVAL
1593d176751SEric Biggers	tristate
1603d176751SEric Biggers	help
1613d176751SEric Biggers	  The POLYVAL library functions.  Select this if your module uses any of
1623d176751SEric Biggers	  the functions from <crypto/polyval.h>.
1633d176751SEric Biggers
1643d176751SEric Biggersconfig CRYPTO_LIB_POLYVAL_ARCH
1653d176751SEric Biggers	bool
1663d176751SEric Biggers	depends on CRYPTO_LIB_POLYVAL && !UML
16737919e23SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
1684d8da355SEric Biggers	default y if X86_64
1693d176751SEric Biggers
170ed20078bSArd Biesheuvelconfig CRYPTO_LIB_CHACHA20POLY1305
171edc8e80bSArnd Bergmann	tristate
172ed20078bSArd Biesheuvel	select CRYPTO_LIB_CHACHA
173ed20078bSArd Biesheuvel	select CRYPTO_LIB_POLY1305
17417ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
175ed20078bSArd Biesheuvel
176ec8f7f48SEric Biggersconfig CRYPTO_LIB_SHA1
177ec8f7f48SEric Biggers	tristate
17890860aefSEric Biggers	help
179d73915fdSEric Biggers	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
180d73915fdSEric Biggers	  uses any of the functions from <crypto/sha1.h>.
18190860aefSEric Biggers
18290860aefSEric Biggersconfig CRYPTO_LIB_SHA1_ARCH
18390860aefSEric Biggers	bool
18490860aefSEric Biggers	depends on CRYPTO_LIB_SHA1 && !UML
18570cb6ca5SEric Biggers	default y if ARM
18600d549bbSEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
187b6ac1dacSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
1886b9ae8cfSEric Biggers	default y if PPC
189377982d5SEric Biggers	default y if S390
190c7510599SEric Biggers	default y if SPARC64
191f3d6cb3dSEric Biggers	default y if X86_64
192ec8f7f48SEric Biggers
193746b2e02SArd Biesheuvelconfig CRYPTO_LIB_SHA256
194746b2e02SArd Biesheuvel	tristate
195950e5c84SEric Biggers	help
196d73915fdSEric Biggers	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
197d73915fdSEric Biggers	  Select this if your module uses any of these functions from
198d73915fdSEric Biggers	  <crypto/sha2.h>.
199950e5c84SEric Biggers
200e96cb950SEric Biggersconfig CRYPTO_LIB_SHA256_ARCH
201950e5c84SEric Biggers	bool
202e96cb950SEric Biggers	depends on CRYPTO_LIB_SHA256 && !UML
203e96cb950SEric Biggers	default y if ARM && !CPU_V7M
204e96cb950SEric Biggers	default y if ARM64
205e96cb950SEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
206e96cb950SEric Biggers	default y if PPC && SPE
2071cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2081cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
209e96cb950SEric Biggers	default y if S390
210e96cb950SEric Biggers	default y if SPARC64
211e96cb950SEric Biggers	default y if X86_64
2122b31277aSTianjia Zhang
213b693c703SEric Biggersconfig CRYPTO_LIB_SHA512
214b693c703SEric Biggers	tristate
215b693c703SEric Biggers	help
21623e8b437SEric Biggers	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
21723e8b437SEric Biggers	  Select this if your module uses any of these functions from
21823e8b437SEric Biggers	  <crypto/sha2.h>.
219b693c703SEric Biggers
220b693c703SEric Biggersconfig CRYPTO_LIB_SHA512_ARCH
221b693c703SEric Biggers	bool
222b693c703SEric Biggers	depends on CRYPTO_LIB_SHA512 && !UML
22324c91b62SEric Biggers	default y if ARM && !CPU_V7M
22460e3f1e9SEric Biggers	default y if ARM64
2257117739aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
2261cd5bb6eSEric Biggers	default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
2271cd5bb6eSEric Biggers		     RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
228b7b36608SEric Biggers	default y if S390
22902b35babSEric Biggers	default y if SPARC64
230484c1811SEric Biggers	default y if X86_64
231b693c703SEric Biggers
23205934472SDavid Howellsconfig CRYPTO_LIB_SHA3
23305934472SDavid Howells	tristate
23405934472SDavid Howells	select CRYPTO_LIB_UTILS
23505934472SDavid Howells	help
23605934472SDavid Howells	  The SHA3 library functions.  Select this if your module uses any of
23705934472SDavid Howells	  the functions from <crypto/sha3.h>.
23805934472SDavid Howells
2391e29a750SEric Biggersconfig CRYPTO_LIB_SHA3_ARCH
2401e29a750SEric Biggers	bool
2411e29a750SEric Biggers	depends on CRYPTO_LIB_SHA3 && !UML
2421e29a750SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
24304171105SEric Biggers	default y if S390
2441e29a750SEric Biggers
245f4065b2fSHerbert Xuconfig CRYPTO_LIB_SM3
246f4065b2fSHerbert Xu	tristate
247f4065b2fSHerbert Xu
2484dcf6cadSEric Biggerssource "lib/crypto/tests/Kconfig"
2494dcf6cadSEric Biggers
250e56e1898SJustin M. Forbesendmenu
251