xref: /linux/lib/crypto/Kconfig (revision 13cecc526d8fe7eeb9b136159738688a1a10cd82)
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
3166d7fb94SJason A. Donenfeldconfig CRYPTO_ARCH_HAVE_LIB_BLAKE2S
326048fdccSJason A. Donenfeld	bool
3366d7fb94SJason A. Donenfeld	help
3466d7fb94SJason A. Donenfeld	  Declares whether the architecture provides an arch-specific
3566d7fb94SJason A. Donenfeld	  accelerated implementation of the Blake2s library interface,
3666d7fb94SJason A. Donenfeld	  either builtin or as a module.
3766d7fb94SJason A. Donenfeld
3866d7fb94SJason A. Donenfeldconfig CRYPTO_LIB_BLAKE2S_GENERIC
396048fdccSJason A. Donenfeld	def_bool !CRYPTO_ARCH_HAVE_LIB_BLAKE2S
4066d7fb94SJason A. Donenfeld	help
4166d7fb94SJason A. Donenfeld	  This symbol can be depended upon by arch implementations of the
4266d7fb94SJason A. Donenfeld	  Blake2s library interface that require the generic code as a
4366d7fb94SJason A. Donenfeld	  fallback, e.g., for SIMD implementations. If no arch specific
4466d7fb94SJason A. Donenfeld	  implementation is enabled, this implementation serves the users
4566d7fb94SJason A. Donenfeld	  of CRYPTO_LIB_BLAKE2S.
4666d7fb94SJason A. Donenfeld
475fb8ef25SArd Biesheuvelconfig CRYPTO_LIB_CHACHA
48edc8e80bSArnd Bergmann	tristate
49*13cecc52SEric Biggers	select CRYPTO_LIB_UTILS
505fb8ef25SArd Biesheuvel	help
51*13cecc52SEric Biggers	  Enable the ChaCha library interface.  Select this if your module uses
52*13cecc52SEric Biggers	  chacha_crypt() or hchacha_block().
53*13cecc52SEric Biggers
54*13cecc52SEric Biggersconfig CRYPTO_LIB_CHACHA_ARCH
55*13cecc52SEric Biggers	bool
56*13cecc52SEric Biggers	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
57*13cecc52SEric Biggers	default y if ARM
58*13cecc52SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
59*13cecc52SEric Biggers	default y if MIPS && CPU_MIPS32_R2
60*13cecc52SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
61*13cecc52SEric Biggers	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
62*13cecc52SEric Biggers	default y if S390
63*13cecc52SEric Biggers	default y if X86_64
645fb8ef25SArd Biesheuvel
650ed42a6fSJason A. Donenfeldconfig CRYPTO_ARCH_HAVE_LIB_CURVE25519
661047e21aSHerbert Xu	bool
670ed42a6fSJason A. Donenfeld	help
680ed42a6fSJason A. Donenfeld	  Declares whether the architecture provides an arch-specific
690ed42a6fSJason A. Donenfeld	  accelerated implementation of the Curve25519 library interface,
700ed42a6fSJason A. Donenfeld	  either builtin or as a module.
710ed42a6fSJason A. Donenfeld
720ed42a6fSJason A. Donenfeldconfig CRYPTO_LIB_CURVE25519_GENERIC
730ed42a6fSJason A. Donenfeld	tristate
7417ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
750ed42a6fSJason A. Donenfeld	help
760ed42a6fSJason A. Donenfeld	  This symbol can be depended upon by arch implementations of the
770ed42a6fSJason A. Donenfeld	  Curve25519 library interface that require the generic code as a
780ed42a6fSJason A. Donenfeld	  fallback, e.g., for SIMD implementations. If no arch specific
790ed42a6fSJason A. Donenfeld	  implementation is enabled, this implementation serves the users
800ed42a6fSJason A. Donenfeld	  of CRYPTO_LIB_CURVE25519.
810ed42a6fSJason A. Donenfeld
8217ec3e71SHerbert Xuconfig CRYPTO_LIB_CURVE25519_INTERNAL
8317ec3e71SHerbert Xu	tristate
8417ec3e71SHerbert Xu	select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n
8517ec3e71SHerbert Xu
860ed42a6fSJason A. Donenfeldconfig CRYPTO_LIB_CURVE25519
87edc8e80bSArnd Bergmann	tristate
8817ec3e71SHerbert Xu	select CRYPTO
8917ec3e71SHerbert Xu	select CRYPTO_LIB_CURVE25519_INTERNAL
900ed42a6fSJason A. Donenfeld	help
910ed42a6fSJason A. Donenfeld	  Enable the Curve25519 library interface. This interface may be
920ed42a6fSJason A. Donenfeld	  fulfilled by either the generic implementation or an arch-specific
930ed42a6fSJason A. Donenfeld	  one, if one is available and enabled.
940ed42a6fSJason A. Donenfeld
95746b2e02SArd Biesheuvelconfig CRYPTO_LIB_DES
96746b2e02SArd Biesheuvel	tristate
97746b2e02SArd Biesheuvel
98e1644613SEric Biggersconfig CRYPTO_LIB_MD5
99e1644613SEric Biggers	tristate
100e1644613SEric Biggers	help
101e1644613SEric Biggers	  The MD5 and HMAC-MD5 library functions.  Select this if your module
102e1644613SEric Biggers	  uses any of the functions from <crypto/md5.h>.
103e1644613SEric Biggers
104e1644613SEric Biggersconfig CRYPTO_LIB_MD5_ARCH
105e1644613SEric Biggers	bool
106e1644613SEric Biggers	depends on CRYPTO_LIB_MD5 && !UML
107c9e5ac0aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
10809371e13SEric Biggers	default y if PPC
109a1848f6eSEric Biggers	default y if SPARC64
110e1644613SEric Biggers
111b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305
112b646b782SEric Biggers	tristate
113b646b782SEric Biggers	help
114b646b782SEric Biggers	  The Poly1305 library functions.  Select this if your module uses any
115b646b782SEric Biggers	  of the functions from <crypto/poly1305.h>.
116b646b782SEric Biggers
117b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_ARCH
118b646b782SEric Biggers	bool
119b646b782SEric Biggers	depends on CRYPTO_LIB_POLY1305 && !UML
120b646b782SEric Biggers	default y if ARM
121b646b782SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
122b646b782SEric Biggers	default y if MIPS
123b646b782SEric Biggers	# The PPC64 code needs to be fixed to work in softirq context.
124b646b782SEric Biggers	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
125bef9c755SZhihang Shao	default y if RISCV
126b646b782SEric Biggers	default y if X86_64
127b646b782SEric Biggers
128b646b782SEric Biggers# This symbol controls the inclusion of the Poly1305 generic code.  This differs
129b646b782SEric Biggers# from most of the other algorithms, which handle the generic code
130b646b782SEric Biggers# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
131b646b782SEric Biggers# which calls the poly1305_core_*() functions directly, can enable them.
132b646b782SEric Biggersconfig CRYPTO_LIB_POLY1305_GENERIC
133b646b782SEric Biggers	bool
134b646b782SEric Biggers	depends on CRYPTO_LIB_POLY1305
135b646b782SEric Biggers	# Enable if there's no arch impl or the arch impl requires the generic
136b646b782SEric Biggers	# impl as a fallback.  (Or if selected explicitly.)
137b646b782SEric Biggers	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
138b646b782SEric Biggers
139a1d93064SArd Biesheuvelconfig CRYPTO_LIB_POLY1305_RSIZE
140a1d93064SArd Biesheuvel	int
141bef9c755SZhihang Shao	default 2 if MIPS || RISCV
142d7d7b853SJason A. Donenfeld	default 11 if X86_64
143a6b803b3SArd Biesheuvel	default 9 if ARM || ARM64
144a1d93064SArd Biesheuvel	default 1
145a1d93064SArd Biesheuvel
146ed20078bSArd Biesheuvelconfig CRYPTO_LIB_CHACHA20POLY1305
147edc8e80bSArnd Bergmann	tristate
148ed20078bSArd Biesheuvel	select CRYPTO_LIB_CHACHA
149ed20078bSArd Biesheuvel	select CRYPTO_LIB_POLY1305
15017ec3e71SHerbert Xu	select CRYPTO_LIB_UTILS
151ed20078bSArd Biesheuvel
152ec8f7f48SEric Biggersconfig CRYPTO_LIB_SHA1
153ec8f7f48SEric Biggers	tristate
15490860aefSEric Biggers	help
155d73915fdSEric Biggers	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
156d73915fdSEric Biggers	  uses any of the functions from <crypto/sha1.h>.
15790860aefSEric Biggers
15890860aefSEric Biggersconfig CRYPTO_LIB_SHA1_ARCH
15990860aefSEric Biggers	bool
16090860aefSEric Biggers	depends on CRYPTO_LIB_SHA1 && !UML
16170cb6ca5SEric Biggers	default y if ARM
16200d549bbSEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
163b6ac1dacSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
1646b9ae8cfSEric Biggers	default y if PPC
165377982d5SEric Biggers	default y if S390
166c7510599SEric Biggers	default y if SPARC64
167f3d6cb3dSEric Biggers	default y if X86_64
168ec8f7f48SEric Biggers
169746b2e02SArd Biesheuvelconfig CRYPTO_LIB_SHA256
170746b2e02SArd Biesheuvel	tristate
171950e5c84SEric Biggers	help
172d73915fdSEric Biggers	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
173d73915fdSEric Biggers	  Select this if your module uses any of these functions from
174d73915fdSEric Biggers	  <crypto/sha2.h>.
175950e5c84SEric Biggers
176e96cb950SEric Biggersconfig CRYPTO_LIB_SHA256_ARCH
177950e5c84SEric Biggers	bool
178e96cb950SEric Biggers	depends on CRYPTO_LIB_SHA256 && !UML
179e96cb950SEric Biggers	default y if ARM && !CPU_V7M
180e96cb950SEric Biggers	default y if ARM64
181e96cb950SEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
182e96cb950SEric Biggers	default y if PPC && SPE
183e96cb950SEric Biggers	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
184e96cb950SEric Biggers	default y if S390
185e96cb950SEric Biggers	default y if SPARC64
186e96cb950SEric Biggers	default y if X86_64
1872b31277aSTianjia Zhang
188b693c703SEric Biggersconfig CRYPTO_LIB_SHA512
189b693c703SEric Biggers	tristate
190b693c703SEric Biggers	help
19123e8b437SEric Biggers	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
19223e8b437SEric Biggers	  Select this if your module uses any of these functions from
19323e8b437SEric Biggers	  <crypto/sha2.h>.
194b693c703SEric Biggers
195b693c703SEric Biggersconfig CRYPTO_LIB_SHA512_ARCH
196b693c703SEric Biggers	bool
197b693c703SEric Biggers	depends on CRYPTO_LIB_SHA512 && !UML
19824c91b62SEric Biggers	default y if ARM && !CPU_V7M
19960e3f1e9SEric Biggers	default y if ARM64
2007117739aSEric Biggers	default y if MIPS && CPU_CAVIUM_OCTEON
201b59059a2SEric Biggers	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
202b7b36608SEric Biggers	default y if S390
20302b35babSEric Biggers	default y if SPARC64
204484c1811SEric Biggers	default y if X86_64
205b693c703SEric Biggers
206f4065b2fSHerbert Xuconfig CRYPTO_LIB_SM3
207f4065b2fSHerbert Xu	tristate
208f4065b2fSHerbert Xu
2094dcf6cadSEric Biggerssource "lib/crypto/tests/Kconfig"
2104dcf6cadSEric Biggers
211714656a8SEric Biggersif !KMSAN # avoid false positives from assembly
212714656a8SEric Biggersif ARM
2134a32e5dcSEric Biggerssource "lib/crypto/arm/Kconfig"
214714656a8SEric Biggersendif
215c7c18c94SEric Biggersif X86
21674750aa7SEric Biggerssource "lib/crypto/x86/Kconfig"
217c7c18c94SEric Biggersendif
218714656a8SEric Biggersendif
219714656a8SEric Biggers
220e56e1898SJustin M. Forbesendmenu
221