File: sha1_kunit.c

package info (click to toggle)
linux 6.17.10-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,734,900 kB
  • sloc: ansic: 26,684,436; asm: 271,195; sh: 147,406; python: 75,980; makefile: 57,306; perl: 36,943; xml: 19,562; cpp: 5,899; yacc: 4,909; lex: 2,943; awk: 1,556; sed: 29; ruby: 25
file content (39 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright 2025 Google LLC
 */
#include <crypto/sha1.h>
#include "sha1-testvecs.h"

#define HASH sha1
#define HASH_CTX sha1_ctx
#define HASH_SIZE SHA1_DIGEST_SIZE
#define HASH_INIT sha1_init
#define HASH_UPDATE sha1_update
#define HASH_FINAL sha1_final
#define HMAC_KEY hmac_sha1_key
#define HMAC_CTX hmac_sha1_ctx
#define HMAC_PREPAREKEY hmac_sha1_preparekey
#define HMAC_INIT hmac_sha1_init
#define HMAC_UPDATE hmac_sha1_update
#define HMAC_FINAL hmac_sha1_final
#define HMAC hmac_sha1
#define HMAC_USINGRAWKEY hmac_sha1_usingrawkey
#include "hash-test-template.h"

static struct kunit_case hash_test_cases[] = {
	HASH_KUNIT_CASES,
	KUNIT_CASE(benchmark_hash),
	{},
};

static struct kunit_suite hash_test_suite = {
	.name = "sha1",
	.test_cases = hash_test_cases,
	.suite_init = hash_suite_init,
	.suite_exit = hash_suite_exit,
};
kunit_test_suite(hash_test_suite);

MODULE_DESCRIPTION("KUnit tests and benchmark for SHA-1 and HMAC-SHA1");
MODULE_LICENSE("GPL");