crypto/testmgr.c
Source file repositories/reference/linux-study-clean/crypto/testmgr.c
File Facts
- System
- Linux kernel
- Corpus path
crypto/testmgr.c- Extension
.c- Size
- 151526 bytes
- Lines
- 5723
- Domain
- Kernel Services
- Bucket
- crypto
- Inferred role
- Kernel Services: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/aead.hcrypto/hash.hcrypto/skcipher.hlinux/err.hlinux/fips.hlinux/module.hlinux/once.hlinux/prandom.hlinux/scatterlist.hlinux/slab.hlinux/string.hlinux/uio.hcrypto/akcipher.hcrypto/kpp.hcrypto/acompress.hcrypto/sig.hcrypto/internal/cipher.hcrypto/internal/rng.hcrypto/internal/simd.hinternal.htestmgr.h
Detected Declarations
struct aead_test_suitestruct cipher_test_suitestruct comp_test_suitestruct hash_test_suitestruct drbg_test_suitestruct akcipher_test_suitestruct sig_test_suitestruct kpp_test_suitestruct alg_test_descstruct test_sg_divisionstruct testvec_configstruct test_sgliststruct cipher_test_sglistsstruct aead_slow_tests_ctxenum flush_typeenum finalization_typeenum inplace_modefunction alg_testfunction hexdumpfunction __testmgr_alloc_buffunction testmgr_alloc_buffunction __testmgr_free_buffunction testmgr_free_buffunction testmgr_poisonfunction testmgr_is_poisonfunction count_test_sg_divisionsfunction valid_sg_divisionsfunction valid_testvec_configfunction init_test_sglistfunction destroy_test_sglistfunction build_test_sglistfunction verify_correct_outputfunction is_test_sglist_corruptedfunction free_cipher_test_sglistsfunction build_cipher_test_sglistsfunction destinationfunction setkeyfunction init_rnd_statefunction prandom_u8function prandom_u32_belowfunction prandom_boolfunction prandom_u32_inclusivefunction generate_random_lengthfunction flip_random_bitfunction flip_random_bytefunction mutate_bufferfunction generate_random_bytesfunction generate_random_testvec_config
Annotated Snippet
struct aead_test_suite {
const struct aead_testvec *vecs;
unsigned int count;
/*
* Set if trying to decrypt an inauthentic ciphertext with this
* algorithm might result in EINVAL rather than EBADMSG, due to other
* validation the algorithm does on the inputs such as length checks.
*/
unsigned int einval_allowed : 1;
/*
* Set if this algorithm requires that the IV be located at the end of
* the AAD buffer, in addition to being given in the normal way. The
* behavior when the two IV copies differ is implementation-defined.
*/
unsigned int aad_iv : 1;
};
struct cipher_test_suite {
const struct cipher_testvec *vecs;
unsigned int count;
};
struct comp_test_suite {
struct {
const struct comp_testvec *vecs;
unsigned int count;
} comp, decomp;
};
struct hash_test_suite {
const struct hash_testvec *vecs;
unsigned int count;
};
struct drbg_test_suite {
const struct drbg_testvec *vecs;
unsigned int count;
};
struct akcipher_test_suite {
const struct akcipher_testvec *vecs;
unsigned int count;
};
struct sig_test_suite {
const struct sig_testvec *vecs;
unsigned int count;
};
struct kpp_test_suite {
const struct kpp_testvec *vecs;
unsigned int count;
};
struct alg_test_desc {
const char *alg;
const char *generic_driver;
int (*test)(const struct alg_test_desc *desc, const char *driver,
u32 type, u32 mask);
int fips_allowed; /* set if alg is allowed in fips mode */
union {
struct aead_test_suite aead;
struct cipher_test_suite cipher;
struct comp_test_suite comp;
struct hash_test_suite hash;
struct drbg_test_suite drbg;
struct akcipher_test_suite akcipher;
struct sig_test_suite sig;
struct kpp_test_suite kpp;
} suite;
};
static void hexdump(unsigned char *buf, unsigned int len)
{
print_hex_dump(KERN_CONT, "", DUMP_PREFIX_OFFSET,
16, 1,
buf, len, false);
}
static int __testmgr_alloc_buf(char *buf[XBUFSIZE], int order)
{
int i;
for (i = 0; i < XBUFSIZE; i++) {
buf[i] = (char *)__get_free_pages(GFP_KERNEL, order);
if (!buf[i])
goto err_free_buf;
Annotation
- Immediate include surface: `crypto/aead.h`, `crypto/hash.h`, `crypto/skcipher.h`, `linux/err.h`, `linux/fips.h`, `linux/module.h`, `linux/once.h`, `linux/prandom.h`.
- Detected declarations: `struct aead_test_suite`, `struct cipher_test_suite`, `struct comp_test_suite`, `struct hash_test_suite`, `struct drbg_test_suite`, `struct akcipher_test_suite`, `struct sig_test_suite`, `struct kpp_test_suite`, `struct alg_test_desc`, `struct test_sg_division`.
- Atlas domain: Kernel Services / crypto.
- Implementation status: integration 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.