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