xref: /linux/lib/crypto/Kconfig (revision 13cecc526d8fe7eeb9b136159738688a1a10cd82)
1# SPDX-License-Identifier: GPL-2.0
2
3menu "Crypto library routines"
4
5config CRYPTO_HASH_INFO
6	bool
7
8config CRYPTO_LIB_UTILS
9	tristate
10
11config CRYPTO_LIB_AES
12	tristate
13
14config CRYPTO_LIB_AESCFB
15	tristate
16	select CRYPTO_LIB_AES
17	select CRYPTO_LIB_UTILS
18
19config CRYPTO_LIB_AESGCM
20	tristate
21	select CRYPTO_LIB_AES
22	select CRYPTO_LIB_GF128MUL
23	select CRYPTO_LIB_UTILS
24
25config CRYPTO_LIB_ARC4
26	tristate
27
28config CRYPTO_LIB_GF128MUL
29	tristate
30
31config CRYPTO_ARCH_HAVE_LIB_BLAKE2S
32	bool
33	help
34	  Declares whether the architecture provides an arch-specific
35	  accelerated implementation of the Blake2s library interface,
36	  either builtin or as a module.
37
38config CRYPTO_LIB_BLAKE2S_GENERIC
39	def_bool !CRYPTO_ARCH_HAVE_LIB_BLAKE2S
40	help
41	  This symbol can be depended upon by arch implementations of the
42	  Blake2s library interface that require the generic code as a
43	  fallback, e.g., for SIMD implementations. If no arch specific
44	  implementation is enabled, this implementation serves the users
45	  of CRYPTO_LIB_BLAKE2S.
46
47config CRYPTO_LIB_CHACHA
48	tristate
49	select CRYPTO_LIB_UTILS
50	help
51	  Enable the ChaCha library interface.  Select this if your module uses
52	  chacha_crypt() or hchacha_block().
53
54config CRYPTO_LIB_CHACHA_ARCH
55	bool
56	depends on CRYPTO_LIB_CHACHA && !UML && !KMSAN
57	default y if ARM
58	default y if ARM64 && KERNEL_MODE_NEON
59	default y if MIPS && CPU_MIPS32_R2
60	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
61	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
62	default y if S390
63	default y if X86_64
64
65config CRYPTO_ARCH_HAVE_LIB_CURVE25519
66	bool
67	help
68	  Declares whether the architecture provides an arch-specific
69	  accelerated implementation of the Curve25519 library interface,
70	  either builtin or as a module.
71
72config CRYPTO_LIB_CURVE25519_GENERIC
73	tristate
74	select CRYPTO_LIB_UTILS
75	help
76	  This symbol can be depended upon by arch implementations of the
77	  Curve25519 library interface that require the generic code as a
78	  fallback, e.g., for SIMD implementations. If no arch specific
79	  implementation is enabled, this implementation serves the users
80	  of CRYPTO_LIB_CURVE25519.
81
82config CRYPTO_LIB_CURVE25519_INTERNAL
83	tristate
84	select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n
85
86config CRYPTO_LIB_CURVE25519
87	tristate
88	select CRYPTO
89	select CRYPTO_LIB_CURVE25519_INTERNAL
90	help
91	  Enable the Curve25519 library interface. This interface may be
92	  fulfilled by either the generic implementation or an arch-specific
93	  one, if one is available and enabled.
94
95config CRYPTO_LIB_DES
96	tristate
97
98config CRYPTO_LIB_MD5
99	tristate
100	help
101	  The MD5 and HMAC-MD5 library functions.  Select this if your module
102	  uses any of the functions from <crypto/md5.h>.
103
104config CRYPTO_LIB_MD5_ARCH
105	bool
106	depends on CRYPTO_LIB_MD5 && !UML
107	default y if MIPS && CPU_CAVIUM_OCTEON
108	default y if PPC
109	default y if SPARC64
110
111config CRYPTO_LIB_POLY1305
112	tristate
113	help
114	  The Poly1305 library functions.  Select this if your module uses any
115	  of the functions from <crypto/poly1305.h>.
116
117config CRYPTO_LIB_POLY1305_ARCH
118	bool
119	depends on CRYPTO_LIB_POLY1305 && !UML
120	default y if ARM
121	default y if ARM64 && KERNEL_MODE_NEON
122	default y if MIPS
123	# The PPC64 code needs to be fixed to work in softirq context.
124	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
125	default y if RISCV
126	default y if X86_64
127
128# This symbol controls the inclusion of the Poly1305 generic code.  This differs
129# from most of the other algorithms, which handle the generic code
130# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
131# which calls the poly1305_core_*() functions directly, can enable them.
132config CRYPTO_LIB_POLY1305_GENERIC
133	bool
134	depends on CRYPTO_LIB_POLY1305
135	# Enable if there's no arch impl or the arch impl requires the generic
136	# impl as a fallback.  (Or if selected explicitly.)
137	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
138
139config CRYPTO_LIB_POLY1305_RSIZE
140	int
141	default 2 if MIPS || RISCV
142	default 11 if X86_64
143	default 9 if ARM || ARM64
144	default 1
145
146config CRYPTO_LIB_CHACHA20POLY1305
147	tristate
148	select CRYPTO_LIB_CHACHA
149	select CRYPTO_LIB_POLY1305
150	select CRYPTO_LIB_UTILS
151
152config CRYPTO_LIB_SHA1
153	tristate
154	help
155	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
156	  uses any of the functions from <crypto/sha1.h>.
157
158config CRYPTO_LIB_SHA1_ARCH
159	bool
160	depends on CRYPTO_LIB_SHA1 && !UML
161	default y if ARM
162	default y if ARM64 && KERNEL_MODE_NEON
163	default y if MIPS && CPU_CAVIUM_OCTEON
164	default y if PPC
165	default y if S390
166	default y if SPARC64
167	default y if X86_64
168
169config CRYPTO_LIB_SHA256
170	tristate
171	help
172	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
173	  Select this if your module uses any of these functions from
174	  <crypto/sha2.h>.
175
176config CRYPTO_LIB_SHA256_ARCH
177	bool
178	depends on CRYPTO_LIB_SHA256 && !UML
179	default y if ARM && !CPU_V7M
180	default y if ARM64
181	default y if MIPS && CPU_CAVIUM_OCTEON
182	default y if PPC && SPE
183	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
184	default y if S390
185	default y if SPARC64
186	default y if X86_64
187
188config CRYPTO_LIB_SHA512
189	tristate
190	help
191	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
192	  Select this if your module uses any of these functions from
193	  <crypto/sha2.h>.
194
195config CRYPTO_LIB_SHA512_ARCH
196	bool
197	depends on CRYPTO_LIB_SHA512 && !UML
198	default y if ARM && !CPU_V7M
199	default y if ARM64
200	default y if MIPS && CPU_CAVIUM_OCTEON
201	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
202	default y if S390
203	default y if SPARC64
204	default y if X86_64
205
206config CRYPTO_LIB_SM3
207	tristate
208
209source "lib/crypto/tests/Kconfig"
210
211if !KMSAN # avoid false positives from assembly
212if ARM
213source "lib/crypto/arm/Kconfig"
214endif
215if X86
216source "lib/crypto/x86/Kconfig"
217endif
218endif
219
220endmenu
221