lib/crypto/tests/nh_kunit.c
Source file repositories/reference/linux-study-clean/lib/crypto/tests/nh_kunit.c
File Facts
- System
- Linux kernel
- Corpus path
lib/crypto/tests/nh_kunit.c- Extension
.c- Size
- 1064 bytes
- Lines
- 44
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/nh.hkunit/test.hnh-testvecs.h
Detected Declarations
function test_nh
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2025 Google LLC
*/
#include <crypto/nh.h>
#include <kunit/test.h>
#include "nh-testvecs.h"
static void test_nh(struct kunit *test)
{
u32 *key = kunit_kmalloc(test, NH_KEY_BYTES, GFP_KERNEL);
__le64 hash[NH_NUM_PASSES];
KUNIT_ASSERT_NOT_NULL(test, key);
memcpy(key, nh_test_key, NH_KEY_BYTES);
le32_to_cpu_array(key, NH_KEY_WORDS);
nh(key, nh_test_msg, 16, hash);
KUNIT_ASSERT_MEMEQ(test, hash, nh_test_val16, NH_HASH_BYTES);
nh(key, nh_test_msg, 96, hash);
KUNIT_ASSERT_MEMEQ(test, hash, nh_test_val96, NH_HASH_BYTES);
nh(key, nh_test_msg, 256, hash);
KUNIT_ASSERT_MEMEQ(test, hash, nh_test_val256, NH_HASH_BYTES);
nh(key, nh_test_msg, 1024, hash);
KUNIT_ASSERT_MEMEQ(test, hash, nh_test_val1024, NH_HASH_BYTES);
}
static struct kunit_case nh_test_cases[] = {
KUNIT_CASE(test_nh),
{},
};
static struct kunit_suite nh_test_suite = {
.name = "nh",
.test_cases = nh_test_cases,
};
kunit_test_suite(nh_test_suite);
MODULE_DESCRIPTION("KUnit tests for NH");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `crypto/nh.h`, `kunit/test.h`, `nh-testvecs.h`.
- Detected declarations: `function test_nh`.
- Atlas domain: Kernel Services / lib.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.