xref: /linux/lib/crypto/Kconfig (revision c4b846ff6ecab0427cc7dcccbe0af60b244a6d56)
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_ARCH_HAVE_LIB_CHACHA
48	bool
49	help
50	  Declares whether the architecture provides an arch-specific
51	  accelerated implementation of the ChaCha library interface,
52	  either builtin or as a module.
53
54config CRYPTO_LIB_CHACHA_GENERIC
55	tristate
56	default CRYPTO_LIB_CHACHA if !CRYPTO_ARCH_HAVE_LIB_CHACHA
57	select CRYPTO_LIB_UTILS
58	help
59	  This symbol can be selected by arch implementations of the ChaCha
60	  library interface that require the generic code as a fallback, e.g.,
61	  for SIMD implementations. If no arch specific implementation is
62	  enabled, this implementation serves the users of CRYPTO_LIB_CHACHA.
63
64config CRYPTO_LIB_CHACHA
65	tristate
66	help
67	  Enable the ChaCha library interface. This interface may be fulfilled
68	  by either the generic implementation or an arch-specific one, if one
69	  is available and enabled.
70
71config CRYPTO_ARCH_HAVE_LIB_CURVE25519
72	bool
73	help
74	  Declares whether the architecture provides an arch-specific
75	  accelerated implementation of the Curve25519 library interface,
76	  either builtin or as a module.
77
78config CRYPTO_LIB_CURVE25519_GENERIC
79	tristate
80	select CRYPTO_LIB_UTILS
81	help
82	  This symbol can be depended upon by arch implementations of the
83	  Curve25519 library interface that require the generic code as a
84	  fallback, e.g., for SIMD implementations. If no arch specific
85	  implementation is enabled, this implementation serves the users
86	  of CRYPTO_LIB_CURVE25519.
87
88config CRYPTO_LIB_CURVE25519_INTERNAL
89	tristate
90	select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519=n
91
92config CRYPTO_LIB_CURVE25519
93	tristate
94	select CRYPTO
95	select CRYPTO_LIB_CURVE25519_INTERNAL
96	help
97	  Enable the Curve25519 library interface. This interface may be
98	  fulfilled by either the generic implementation or an arch-specific
99	  one, if one is available and enabled.
100
101config CRYPTO_LIB_DES
102	tristate
103
104config CRYPTO_LIB_MD5
105	tristate
106	help
107	  The MD5 and HMAC-MD5 library functions.  Select this if your module
108	  uses any of the functions from <crypto/md5.h>.
109
110config CRYPTO_LIB_MD5_ARCH
111	bool
112	depends on CRYPTO_LIB_MD5 && !UML
113	default y if MIPS && CPU_CAVIUM_OCTEON
114	default y if PPC
115	default y if SPARC64
116
117config CRYPTO_LIB_POLY1305
118	tristate
119	help
120	  The Poly1305 library functions.  Select this if your module uses any
121	  of the functions from <crypto/poly1305.h>.
122
123config CRYPTO_LIB_POLY1305_ARCH
124	bool
125	depends on CRYPTO_LIB_POLY1305 && !UML
126	default y if ARM
127	default y if ARM64 && KERNEL_MODE_NEON
128	default y if MIPS
129	# The PPC64 code needs to be fixed to work in softirq context.
130	default y if PPC64 && CPU_LITTLE_ENDIAN && VSX && BROKEN
131	default y if RISCV
132	default y if X86_64
133
134# This symbol controls the inclusion of the Poly1305 generic code.  This differs
135# from most of the other algorithms, which handle the generic code
136# "automatically" via __maybe_unused.  This is needed so that the Adiantum code,
137# which calls the poly1305_core_*() functions directly, can enable them.
138config CRYPTO_LIB_POLY1305_GENERIC
139	bool
140	depends on CRYPTO_LIB_POLY1305
141	# Enable if there's no arch impl or the arch impl requires the generic
142	# impl as a fallback.  (Or if selected explicitly.)
143	default y if !CRYPTO_LIB_POLY1305_ARCH || PPC64
144
145config CRYPTO_LIB_POLY1305_RSIZE
146	int
147	default 2 if MIPS || RISCV
148	default 11 if X86_64
149	default 9 if ARM || ARM64
150	default 1
151
152config CRYPTO_LIB_CHACHA20POLY1305
153	tristate
154	select CRYPTO_LIB_CHACHA
155	select CRYPTO_LIB_POLY1305
156	select CRYPTO_LIB_UTILS
157
158config CRYPTO_LIB_SHA1
159	tristate
160	help
161	  The SHA-1 and HMAC-SHA1 library functions.  Select this if your module
162	  uses any of the functions from <crypto/sha1.h>.
163
164config CRYPTO_LIB_SHA1_ARCH
165	bool
166	depends on CRYPTO_LIB_SHA1 && !UML
167	default y if ARM
168	default y if ARM64 && KERNEL_MODE_NEON
169	default y if MIPS && CPU_CAVIUM_OCTEON
170	default y if PPC
171	default y if S390
172	default y if SPARC64
173	default y if X86_64
174
175config CRYPTO_LIB_SHA256
176	tristate
177	help
178	  The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
179	  Select this if your module uses any of these functions from
180	  <crypto/sha2.h>.
181
182config CRYPTO_LIB_SHA256_ARCH
183	bool
184	depends on CRYPTO_LIB_SHA256 && !UML
185	default y if ARM && !CPU_V7M
186	default y if ARM64
187	default y if MIPS && CPU_CAVIUM_OCTEON
188	default y if PPC && SPE
189	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
190	default y if S390
191	default y if SPARC64
192	default y if X86_64
193
194config CRYPTO_LIB_SHA512
195	tristate
196	help
197	  The SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512 library functions.
198	  Select this if your module uses any of these functions from
199	  <crypto/sha2.h>.
200
201config CRYPTO_LIB_SHA512_ARCH
202	bool
203	depends on CRYPTO_LIB_SHA512 && !UML
204	default y if ARM && !CPU_V7M
205	default y if ARM64
206	default y if MIPS && CPU_CAVIUM_OCTEON
207	default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
208	default y if S390
209	default y if SPARC64
210	default y if X86_64
211
212config CRYPTO_LIB_SM3
213	tristate
214
215source "lib/crypto/tests/Kconfig"
216
217if !KMSAN # avoid false positives from assembly
218if ARM
219source "lib/crypto/arm/Kconfig"
220endif
221if ARM64
222source "lib/crypto/arm64/Kconfig"
223endif
224if MIPS
225source "lib/crypto/mips/Kconfig"
226endif
227if PPC
228source "lib/crypto/powerpc/Kconfig"
229endif
230if RISCV
231source "lib/crypto/riscv/Kconfig"
232endif
233if S390
234source "lib/crypto/s390/Kconfig"
235endif
236if X86
237source "lib/crypto/x86/Kconfig"
238endif
239endif
240
241endmenu
242