xref: /linux/lib/crypto/tests/Kconfig (revision 12d5fc96ebbb3b948861805b32a4c3a96105ccd9)
1# SPDX-License-Identifier: GPL-2.0-or-later
2
3config CRYPTO_LIB_AES_CBC_MACS_KUNIT_TEST
4	tristate "KUnit tests for AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC" if !KUNIT_ALL_TESTS
5	depends on KUNIT && CRYPTO_LIB_AES_CBC_MACS
6	default KUNIT_ALL_TESTS
7	select CRYPTO_LIB_BENCHMARK_VISIBLE
8	help
9	  KUnit tests for the AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC message
10	  authentication codes.
11
12config CRYPTO_LIB_AES_CCM_KUNIT_TEST
13	tristate "KUnit tests for AES-CCM" if !KUNIT_ALL_TESTS
14	depends on KUNIT && CRYPTO_LIB_AES_CCM
15	default KUNIT_ALL_TESTS
16	select CRYPTO_LIB_BENCHMARK_VISIBLE
17	# This test uses BLAKE2s, but that's always built-in.
18	help
19	  KUnit tests for the AES-CCM authenticated encryption algorithm.
20
21config CRYPTO_LIB_AES_GCM_KUNIT_TEST
22	tristate "KUnit tests for AES-GCM" if !KUNIT_ALL_TESTS
23	depends on KUNIT && CRYPTO_LIB_AES_GCM
24	default KUNIT_ALL_TESTS
25	select CRYPTO_LIB_BENCHMARK_VISIBLE
26	# This test uses BLAKE2s, but that's always built-in.
27	help
28	  KUnit tests for the AES-GCM authenticated encryption algorithm.
29
30config CRYPTO_LIB_BLAKE2B_KUNIT_TEST
31	tristate "KUnit tests for BLAKE2b" if !KUNIT_ALL_TESTS
32	depends on KUNIT && CRYPTO_LIB_BLAKE2B
33	default KUNIT_ALL_TESTS
34	select CRYPTO_LIB_BENCHMARK_VISIBLE
35	help
36	  KUnit tests for the BLAKE2b cryptographic hash function.
37
38config CRYPTO_LIB_BLAKE2S_KUNIT_TEST
39	tristate "KUnit tests for BLAKE2s" if !KUNIT_ALL_TESTS
40	depends on KUNIT
41	default KUNIT_ALL_TESTS
42	select CRYPTO_LIB_BENCHMARK_VISIBLE
43	# No need to depend on CRYPTO_LIB_BLAKE2S here, as that option doesn't
44	# exist; the BLAKE2s code is always built-in for the /dev/random driver.
45	help
46	  KUnit tests for the BLAKE2s cryptographic hash function.
47
48config CRYPTO_LIB_CHACHA20POLY1305_KUNIT_TEST
49	tristate "KUnit tests for ChaCha20Poly1305" if !KUNIT_ALL_TESTS
50	depends on KUNIT && CRYPTO_LIB_CHACHA20POLY1305
51	default KUNIT_ALL_TESTS
52	select CRYPTO_LIB_BENCHMARK_VISIBLE
53	help
54	  KUnit tests for the ChaCha20Poly1305 authenticated encryption
55	  algorithm.
56
57config CRYPTO_LIB_CURVE25519_KUNIT_TEST
58	tristate "KUnit tests for Curve25519" if !KUNIT_ALL_TESTS
59	depends on KUNIT && CRYPTO_LIB_CURVE25519
60	default KUNIT_ALL_TESTS
61	select CRYPTO_LIB_BENCHMARK_VISIBLE
62	help
63	  KUnit tests for the Curve25519 Diffie-Hellman function.
64
65config CRYPTO_LIB_GHASH_KUNIT_TEST
66	tristate "KUnit tests for GHASH" if !KUNIT_ALL_TESTS
67	depends on KUNIT && CRYPTO_LIB_GF128HASH
68	default KUNIT_ALL_TESTS
69	select CRYPTO_LIB_BENCHMARK_VISIBLE
70	help
71	  KUnit tests for the GHASH library functions.
72
73config CRYPTO_LIB_MD5_KUNIT_TEST
74	tristate "KUnit tests for MD5" if !KUNIT_ALL_TESTS
75	depends on KUNIT && CRYPTO_LIB_MD5
76	default KUNIT_ALL_TESTS
77	select CRYPTO_LIB_BENCHMARK_VISIBLE
78	help
79	  KUnit tests for the MD5 cryptographic hash function and its
80	  corresponding HMAC.
81
82config CRYPTO_LIB_MLDSA_KUNIT_TEST
83	tristate "KUnit tests for ML-DSA" if !KUNIT_ALL_TESTS
84	depends on KUNIT && CRYPTO_LIB_MLDSA
85	default KUNIT_ALL_TESTS
86	select CRYPTO_LIB_BENCHMARK_VISIBLE
87	help
88	  KUnit tests for the ML-DSA digital signature algorithm.
89
90config CRYPTO_LIB_NH_KUNIT_TEST
91	tristate "KUnit tests for NH" if !KUNIT_ALL_TESTS
92	depends on KUNIT && CRYPTO_LIB_NH
93	default KUNIT_ALL_TESTS
94	help
95	  KUnit tests for the NH almost-universal hash function.
96
97config CRYPTO_LIB_POLY1305_KUNIT_TEST
98	tristate "KUnit tests for Poly1305" if !KUNIT_ALL_TESTS
99	depends on KUNIT && CRYPTO_LIB_POLY1305
100	default KUNIT_ALL_TESTS
101	select CRYPTO_LIB_BENCHMARK_VISIBLE
102	help
103	  KUnit tests for the Poly1305 library functions.
104
105config CRYPTO_LIB_POLYVAL_KUNIT_TEST
106	tristate "KUnit tests for POLYVAL" if !KUNIT_ALL_TESTS
107	depends on KUNIT && CRYPTO_LIB_GF128HASH
108	default KUNIT_ALL_TESTS
109	select CRYPTO_LIB_BENCHMARK_VISIBLE
110	help
111	  KUnit tests for the POLYVAL library functions.
112
113config CRYPTO_LIB_SHA1_KUNIT_TEST
114	tristate "KUnit tests for SHA-1" if !KUNIT_ALL_TESTS
115	depends on KUNIT && CRYPTO_LIB_SHA1
116	default KUNIT_ALL_TESTS
117	select CRYPTO_LIB_BENCHMARK_VISIBLE
118	help
119	  KUnit tests for the SHA-1 cryptographic hash function and its
120	  corresponding HMAC.
121
122# Option is named *_SHA256_KUNIT_TEST, though both SHA-224 and SHA-256 tests are
123# included, for consistency with the naming used elsewhere (e.g. CRYPTO_SHA256).
124config CRYPTO_LIB_SHA256_KUNIT_TEST
125	tristate "KUnit tests for SHA-224 and SHA-256" if !KUNIT_ALL_TESTS
126	depends on KUNIT && CRYPTO_LIB_SHA256
127	default KUNIT_ALL_TESTS
128	select CRYPTO_LIB_BENCHMARK_VISIBLE
129	help
130	  KUnit tests for the SHA-224 and SHA-256 cryptographic hash functions
131	  and their corresponding HMACs.
132
133# Option is named *_SHA512_KUNIT_TEST, though both SHA-384 and SHA-512 tests are
134# included, for consistency with the naming used elsewhere (e.g. CRYPTO_SHA512).
135config CRYPTO_LIB_SHA512_KUNIT_TEST
136	tristate "KUnit tests for SHA-384 and SHA-512" if !KUNIT_ALL_TESTS
137	depends on KUNIT && CRYPTO_LIB_SHA512
138	default KUNIT_ALL_TESTS
139	select CRYPTO_LIB_BENCHMARK_VISIBLE
140	help
141	  KUnit tests for the SHA-384 and SHA-512 cryptographic hash functions
142	  and their corresponding HMACs.
143
144config CRYPTO_LIB_SHA3_KUNIT_TEST
145	tristate "KUnit tests for SHA-3" if !KUNIT_ALL_TESTS
146	depends on KUNIT && CRYPTO_LIB_SHA3
147	default KUNIT_ALL_TESTS
148	select CRYPTO_LIB_BENCHMARK_VISIBLE
149	help
150	  KUnit tests for the SHA3 cryptographic hash and XOF functions,
151	  including SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE128 and
152	  SHAKE256.
153
154config CRYPTO_LIB_SIPHASH_KUNIT_TEST
155	tristate "KUnit tests for SipHash" if !KUNIT_ALL_TESTS
156	depends on KUNIT
157	default KUNIT_ALL_TESTS
158	# SipHash support is always built-in, so there's no kconfig option for
159	# it that needs to be depended on here.
160	help
161	  KUnit tests for the SipHash cryptographically secure PRF.
162
163config CRYPTO_LIB_SM3_KUNIT_TEST
164	tristate "KUnit tests for SM3" if !KUNIT_ALL_TESTS
165	depends on KUNIT && CRYPTO_LIB_SM3
166	default KUNIT_ALL_TESTS
167	select CRYPTO_LIB_BENCHMARK_VISIBLE
168	help
169	  KUnit tests for the SM3 cryptographic hash function.
170
171config CRYPTO_LIB_ENABLE_ALL_FOR_KUNIT
172	tristate "Enable all crypto library code for KUnit tests"
173	depends on KUNIT
174	select CRYPTO_LIB_AES_CBC
175	select CRYPTO_LIB_AES_CBC_MACS
176	select CRYPTO_LIB_AES_CCM
177	select CRYPTO_LIB_AES_CTR
178	select CRYPTO_LIB_AES_ECB
179	select CRYPTO_LIB_AES_GCM
180	select CRYPTO_LIB_AES_XTS
181	select CRYPTO_LIB_BLAKE2B
182	select CRYPTO_LIB_CHACHA20POLY1305
183	select CRYPTO_LIB_CURVE25519
184	select CRYPTO_LIB_GF128HASH
185	select CRYPTO_LIB_MD5
186	select CRYPTO_LIB_MLDSA
187	select CRYPTO_LIB_NH
188	select CRYPTO_LIB_POLY1305
189	select CRYPTO_LIB_SHA1
190	select CRYPTO_LIB_SHA256
191	select CRYPTO_LIB_SHA512
192	select CRYPTO_LIB_SHA3
193	select CRYPTO_LIB_SM3
194	help
195	  Enable all the crypto library code that has KUnit tests.
196
197	  Enable this only if you'd like to test all the crypto library code,
198	  even code that wouldn't otherwise need to be built.
199
200	  You'll still need to enable the tests themselves, either individually
201	  or using KUNIT_ALL_TESTS.
202
203config CRYPTO_LIB_BENCHMARK_VISIBLE
204	bool
205
206config CRYPTO_LIB_BENCHMARK
207	bool "Include benchmarks in KUnit tests for cryptographic functions"
208	depends on CRYPTO_LIB_BENCHMARK_VISIBLE
209	help
210	  Include benchmarks in the KUnit tests for cryptographic functions.
211	  The benchmark results are printed to the kernel log when the
212	  corresponding KUnit test suite runs.
213
214	  This is useful for evaluating the performance of the cryptographic
215	  functions.  However, it will increase the runtime of the KUnit tests.
216
217	  If you're only interested in correctness testing, leave this disabled.
218