lib/crypto: tests: Add KUnit tests for SM3

Add a KUnit test suite for the SM3 library.  It closely mirrors the test
suites for the other cryptographic hash functions.  The actual test and
benchmark logic is already in hash-test-template.h; this just wires it
up for SM3 in the usual way.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260321040935.410034-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
This commit is contained in:
Eric Biggers
2026-03-20 21:09:28 -07:00
parent 324bb3bb75
commit d6781b8ba3
6 changed files with 276 additions and 0 deletions

View File

@@ -356,6 +356,9 @@ elif alg == 'sha3':
print()
print('/* SHAKE test vectors */')
gen_additional_sha3_testvecs()
elif alg == 'sm3':
gen_unkeyed_testvecs(alg)
# Kernel doesn't implement HMAC-SM3 library functions yet.
else:
gen_unkeyed_testvecs(alg)
gen_hmac_testvecs(alg)