| 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
|---|---|
| 2 | /* |
| 3 | * Copyright 2025 Google LLC |
| 4 | */ |
| 5 | #include <crypto/sha1.h> |
| 6 | #include "sha1-testvecs.h" |
| 7 | |
| 8 | #define HASH sha1 |
| 9 | #define HASH_CTX sha1_ctx |
| 10 | #define HASH_SIZE SHA1_DIGEST_SIZE |
| 11 | #define HASH_INIT sha1_init |
| 12 | #define HASH_UPDATE sha1_update |
| 13 | #define HASH_FINAL sha1_final |
| 14 | #define HMAC_KEY hmac_sha1_key |
| 15 | #define HMAC_CTX hmac_sha1_ctx |
| 16 | #define HMAC_PREPAREKEY hmac_sha1_preparekey |
| 17 | #define HMAC_INIT hmac_sha1_init |
| 18 | #define HMAC_UPDATE hmac_sha1_update |
| 19 | #define HMAC_FINAL hmac_sha1_final |
| 20 | #define HMAC hmac_sha1 |
| 21 | #define HMAC_USINGRAWKEY hmac_sha1_usingrawkey |
| 22 | #include "hash-test-template.h" |
| 23 | |
| 24 | static struct kunit_case hash_test_cases[] = { |
| 25 | HASH_KUNIT_CASES, |
| 26 | KUNIT_CASE(benchmark_hash), |
| 27 | {}, |
| 28 | }; |
| 29 | |
| 30 | static struct kunit_suite hash_test_suite = { |
| 31 | .name = "sha1", |
| 32 | .test_cases = hash_test_cases, |
| 33 | .suite_init = hash_suite_init, |
| 34 | .suite_exit = hash_suite_exit, |
| 35 | }; |
| 36 | kunit_test_suite(hash_test_suite); |
| 37 | |
| 38 | MODULE_DESCRIPTION("KUnit tests and benchmark for SHA-1 and HMAC-SHA1"); |
| 39 | MODULE_LICENSE("GPL"); |
| 40 |
