xref: /linux/lib/crypto/tests/Kconfig (revision 9e4e86a604dfd06402933467578c4b79f5412b2c)
14dcf6cadSEric Biggers# SPDX-License-Identifier: GPL-2.0-or-later
24dcf6cadSEric Biggers
36401fd33SEric Biggersconfig CRYPTO_LIB_AES_CBC_MACS_KUNIT_TEST
46401fd33SEric Biggers	tristate "KUnit tests for AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC" if !KUNIT_ALL_TESTS
5*4478e8eeSEric Biggers	depends on KUNIT && CRYPTO_LIB_AES_CBC_MACS
66401fd33SEric Biggers	default KUNIT_ALL_TESTS
76401fd33SEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
86401fd33SEric Biggers	help
96401fd33SEric Biggers	  KUnit tests for the AES-CMAC, AES-XCBC-MAC, and AES-CBC-MAC message
106401fd33SEric Biggers	  authentication codes.
11362f9228SEric Biggers
12362f9228SEric Biggersconfig CRYPTO_LIB_BLAKE2B_KUNIT_TEST
13362f9228SEric Biggers	tristate "KUnit tests for BLAKE2b" if !KUNIT_ALL_TESTS
14362f9228SEric Biggers	depends on KUNIT && CRYPTO_LIB_BLAKE2B
15362f9228SEric Biggers	default KUNIT_ALL_TESTS
16*4478e8eeSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
17362f9228SEric Biggers	help
18362f9228SEric Biggers	  KUnit tests for the BLAKE2b cryptographic hash function.
19362f9228SEric Biggers
20362f9228SEric Biggersconfig CRYPTO_LIB_BLAKE2S_KUNIT_TEST
21afc4e4a5SEric Biggers	tristate "KUnit tests for BLAKE2s" if !KUNIT_ALL_TESTS
22afc4e4a5SEric Biggers	depends on KUNIT
23*4478e8eeSEric Biggers	default KUNIT_ALL_TESTS
24cb2d6b13SEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
25afc4e4a5SEric Biggers	# No need to depend on CRYPTO_LIB_BLAKE2S here, as that option doesn't
26afc4e4a5SEric Biggers	# exist; the BLAKE2s code is always built-in for the /dev/random driver.
27afc4e4a5SEric Biggers	help
28afc4e4a5SEric Biggers	  KUnit tests for the BLAKE2s cryptographic hash function.
29d6b6aac0SEric Biggers
30d6b6aac0SEric Biggersconfig CRYPTO_LIB_CHACHA20POLY1305_KUNIT_TEST
31*4478e8eeSEric Biggers	tristate "KUnit tests for ChaCha20Poly1305" if !KUNIT_ALL_TESTS
32d6b6aac0SEric Biggers	depends on KUNIT && CRYPTO_LIB_CHACHA20POLY1305
33d6b6aac0SEric Biggers	default KUNIT_ALL_TESTS
34d6b6aac0SEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
35d6b6aac0SEric Biggers	help
36d6b6aac0SEric Biggers	  KUnit tests for the ChaCha20Poly1305 authenticated encryption
37d6b6aac0SEric Biggers	  algorithm.
38ed894facSEric Biggers
39ed894facSEric Biggersconfig CRYPTO_LIB_CURVE25519_KUNIT_TEST
40*4478e8eeSEric Biggers	tristate "KUnit tests for Curve25519" if !KUNIT_ALL_TESTS
41ed894facSEric Biggers	depends on KUNIT && CRYPTO_LIB_CURVE25519
42ed894facSEric Biggers	default KUNIT_ALL_TESTS
43ed894facSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
44ed894facSEric Biggers	help
45ed894facSEric Biggers	  KUnit tests for the Curve25519 Diffie-Hellman function.
467246fe6cSEric Biggers
477246fe6cSEric Biggersconfig CRYPTO_LIB_GHASH_KUNIT_TEST
48*4478e8eeSEric Biggers	tristate "KUnit tests for GHASH" if !KUNIT_ALL_TESTS
497246fe6cSEric Biggers	depends on KUNIT && CRYPTO_LIB_GF128HASH
507246fe6cSEric Biggers	default KUNIT_ALL_TESTS
517246fe6cSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
527246fe6cSEric Biggers	help
536dd4d9f7SEric Biggers	  KUnit tests for the GHASH library functions.
546dd4d9f7SEric Biggers
55*4478e8eeSEric Biggersconfig CRYPTO_LIB_MD5_KUNIT_TEST
566dd4d9f7SEric Biggers	tristate "KUnit tests for MD5" if !KUNIT_ALL_TESTS
576dd4d9f7SEric Biggers	depends on KUNIT && CRYPTO_LIB_MD5
586dd4d9f7SEric Biggers	default KUNIT_ALL_TESTS
596dd4d9f7SEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
606dd4d9f7SEric Biggers	help
61b3aed551SEric Biggers	  KUnit tests for the MD5 cryptographic hash function and its
62b3aed551SEric Biggers	  corresponding HMAC.
63*4478e8eeSEric Biggers
64b3aed551SEric Biggersconfig CRYPTO_LIB_MLDSA_KUNIT_TEST
65b3aed551SEric Biggers	tristate "KUnit tests for ML-DSA" if !KUNIT_ALL_TESTS
66b3aed551SEric Biggers	depends on KUNIT && CRYPTO_LIB_MLDSA
67b3aed551SEric Biggers	default KUNIT_ALL_TESTS
68b3aed551SEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
6966b13060SEric Biggers	help
7066b13060SEric Biggers	  KUnit tests for the ML-DSA digital signature algorithm.
71*4478e8eeSEric Biggers
7266b13060SEric Biggersconfig CRYPTO_LIB_NH_KUNIT_TEST
7366b13060SEric Biggers	tristate "KUnit tests for NH" if !KUNIT_ALL_TESTS
7466b13060SEric Biggers	depends on KUNIT && CRYPTO_LIB_NH
7566b13060SEric Biggers	default KUNIT_ALL_TESTS
7666b13060SEric Biggers	help
7766b13060SEric Biggers	  KUnit tests for the NH almost-universal hash function.
784dcf6cadSEric Biggers
794dcf6cadSEric Biggersconfig CRYPTO_LIB_POLY1305_KUNIT_TEST
804dcf6cadSEric Biggers	tristate "KUnit tests for Poly1305" if !KUNIT_ALL_TESTS
814dcf6cadSEric Biggers	depends on KUNIT && CRYPTO_LIB_POLY1305
82*4478e8eeSEric Biggers	default KUNIT_ALL_TESTS
834dcf6cadSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
844dcf6cadSEric Biggers	help
854dcf6cadSEric Biggers	  KUnit tests for the Poly1305 library functions.
864dcf6cadSEric Biggers
874dcf6cadSEric Biggersconfig CRYPTO_LIB_POLYVAL_KUNIT_TEST
884dcf6cadSEric Biggers	tristate "KUnit tests for POLYVAL" if !KUNIT_ALL_TESTS
89571eaeddSEric Biggers	depends on KUNIT && CRYPTO_LIB_GF128HASH
90571eaeddSEric Biggers	default KUNIT_ALL_TESTS
91571eaeddSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
92571eaeddSEric Biggers	help
93*4478e8eeSEric Biggers	  KUnit tests for the POLYVAL library functions.
94571eaeddSEric Biggers
95571eaeddSEric Biggersconfig CRYPTO_LIB_SHA1_KUNIT_TEST
96571eaeddSEric Biggers	tristate "KUnit tests for SHA-1" if !KUNIT_ALL_TESTS
97571eaeddSEric Biggers	depends on KUNIT && CRYPTO_LIB_SHA1
98571eaeddSEric Biggers	default KUNIT_ALL_TESTS
99571eaeddSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
10015c64c47SDavid Howells	help
10115c64c47SDavid Howells	  KUnit tests for the SHA-1 cryptographic hash function and its
102*4478e8eeSEric Biggers	  corresponding HMAC.
10315c64c47SDavid Howells
10415c64c47SDavid Howells# Option is named *_SHA256_KUNIT_TEST, though both SHA-224 and SHA-256 tests are
10515c64c47SDavid Howells# included, for consistency with the naming used elsewhere (e.g. CRYPTO_SHA256).
10615c64c47SDavid Howellsconfig CRYPTO_LIB_SHA256_KUNIT_TEST
10715c64c47SDavid Howells	tristate "KUnit tests for SHA-224 and SHA-256" if !KUNIT_ALL_TESTS
10815c64c47SDavid Howells	depends on KUNIT && CRYPTO_LIB_SHA256
10915c64c47SDavid Howells	default KUNIT_ALL_TESTS
1104dcf6cadSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
1114dcf6cadSEric Biggers	help
1124dcf6cadSEric Biggers	  KUnit tests for the SHA-224 and SHA-256 cryptographic hash functions
1134dcf6cadSEric Biggers	  and their corresponding HMACs.
1144dcf6cadSEric Biggers
1154dcf6cadSEric Biggers# Option is named *_SHA512_KUNIT_TEST, though both SHA-384 and SHA-512 tests are
1164dcf6cadSEric Biggers# included, for consistency with the naming used elsewhere (e.g. CRYPTO_SHA512).
1174dcf6cadSEric Biggersconfig CRYPTO_LIB_SHA512_KUNIT_TEST
1184dcf6cadSEric Biggers	tristate "KUnit tests for SHA-384 and SHA-512" if !KUNIT_ALL_TESTS
1194dcf6cadSEric Biggers	depends on KUNIT && CRYPTO_LIB_SHA512
1204dcf6cadSEric Biggers	default KUNIT_ALL_TESTS
1214dcf6cadSEric Biggers	select CRYPTO_LIB_BENCHMARK_VISIBLE
1224dcf6cadSEric Biggers	help
1234dcf6cadSEric Biggers	  KUnit tests for the SHA-384 and SHA-512 cryptographic hash functions
1244dcf6cadSEric Biggers	  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