crypto/internal.h
Source file repositories/reference/linux-study-clean/crypto/internal.h
File Facts
- System
- Linux kernel
- Corpus path
crypto/internal.h- Extension
.h- Size
- 5533 bytes
- Lines
- 211
- Domain
- Kernel Services
- Bucket
- crypto
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/algapi.hlinux/completion.hlinux/jump_label.hlinux/list.hlinux/module.hlinux/notifier.hlinux/numa.hlinux/refcount.hlinux/rwsem.hlinux/scatterlist.hlinux/sched.hlinux/types.h
Detected Declarations
struct crypto_instancestruct crypto_templatestruct crypto_larvalstruct crypto_typefunction crypto_boot_test_finishedfunction set_crypto_boot_test_finishedfunction crypto_boot_test_finishedfunction set_crypto_boot_test_finishedfunction crypto_init_procfunction crypto_compress_ctxsizefunction crypto_alg_putfunction crypto_tmpl_getfunction crypto_tmpl_putfunction crypto_is_larvalfunction crypto_is_deadfunction crypto_is_moribundfunction crypto_notifyfunction crypto_yieldfunction crypto_is_test_larval
Annotated Snippet
struct crypto_larval {
struct crypto_alg alg;
struct crypto_alg *adult;
struct completion completion;
u32 mask;
bool test_started;
};
struct crypto_type {
unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask);
unsigned int (*extsize)(struct crypto_alg *alg);
int (*init_tfm)(struct crypto_tfm *tfm);
void (*show)(struct seq_file *m, struct crypto_alg *alg);
int (*report)(struct sk_buff *skb, struct crypto_alg *alg);
void (*free)(struct crypto_instance *inst);
void (*destroy)(struct crypto_alg *alg);
unsigned int type;
unsigned int maskclear;
unsigned int maskset;
unsigned int tfmsize;
unsigned int algsize;
};
enum {
CRYPTOA_UNSPEC,
CRYPTOA_ALG,
CRYPTOA_TYPE,
__CRYPTOA_MAX,
};
#define CRYPTOA_MAX (__CRYPTOA_MAX - 1)
/* Maximum number of (rtattr) parameters for each template. */
#define CRYPTO_MAX_ATTRS 32
extern struct rw_semaphore crypto_alg_sem;
extern struct list_head crypto_alg_list __guarded_by(&crypto_alg_sem);
extern struct blocking_notifier_head crypto_chain;
int alg_test(const char *driver, const char *alg, u32 type, u32 mask);
#if !IS_BUILTIN(CONFIG_CRYPTO_ALGAPI) || !IS_ENABLED(CONFIG_CRYPTO_SELFTESTS)
static inline bool crypto_boot_test_finished(void)
{
return true;
}
static inline void set_crypto_boot_test_finished(void)
{
}
#else
DECLARE_STATIC_KEY_FALSE(__crypto_boot_test_finished);
static inline bool crypto_boot_test_finished(void)
{
return static_branch_likely(&__crypto_boot_test_finished);
}
static inline void set_crypto_boot_test_finished(void)
{
static_branch_enable(&__crypto_boot_test_finished);
}
#endif /* !IS_BUILTIN(CONFIG_CRYPTO_ALGAPI) ||
* !IS_ENABLED(CONFIG_CRYPTO_SELFTESTS)
*/
#ifdef CONFIG_PROC_FS
void __init crypto_init_proc(void);
void __exit crypto_exit_proc(void);
#else
static inline void crypto_init_proc(void)
{ }
static inline void crypto_exit_proc(void)
{ }
#endif
static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg)
{
return alg->cra_ctxsize;
}
static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg)
{
return alg->cra_ctxsize;
}
struct crypto_alg *crypto_mod_get(struct crypto_alg *alg);
struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask);
struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask);
void crypto_schedule_test(struct crypto_larval *larval);
void crypto_alg_tested(const char *name, int err);
Annotation
- Immediate include surface: `crypto/algapi.h`, `linux/completion.h`, `linux/jump_label.h`, `linux/list.h`, `linux/module.h`, `linux/notifier.h`, `linux/numa.h`, `linux/refcount.h`.
- Detected declarations: `struct crypto_instance`, `struct crypto_template`, `struct crypto_larval`, `struct crypto_type`, `function crypto_boot_test_finished`, `function set_crypto_boot_test_finished`, `function crypto_boot_test_finished`, `function set_crypto_boot_test_finished`, `function crypto_init_proc`, `function crypto_compress_ctxsize`.
- Atlas domain: Kernel Services / crypto.
- 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.