xref: /linux/lib/crypto/tests/sm3_kunit.c (revision 370c3883195566ee3e7d79e0146c3d735a406573)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright 2026 Google LLC
4  */
5 #include <crypto/sm3.h>
6 #include "sm3-testvecs.h"
7 
8 #define HASH sm3
9 #define HASH_CTX sm3_ctx
10 #define HASH_SIZE SM3_DIGEST_SIZE
11 #define HASH_INIT sm3_init
12 #define HASH_UPDATE sm3_update
13 #define HASH_FINAL sm3_final
14 #include "hash-test-template.h"
15 
16 static struct kunit_case sm3_test_cases[] = {
17 	HASH_KUNIT_CASES,
18 	KUNIT_CASE(benchmark_hash),
19 	{},
20 };
21 
22 static struct kunit_suite sm3_test_suite = {
23 	.name = "sm3",
24 	.test_cases = sm3_test_cases,
25 	.suite_init = hash_suite_init,
26 	.suite_exit = hash_suite_exit,
27 };
28 kunit_test_suite(sm3_test_suite);
29 
30 MODULE_DESCRIPTION("KUnit tests and benchmark for SM3");
31 MODULE_LICENSE("GPL");
32