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