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