include/crypto/sha1.h
Source file repositories/reference/linux-study-clean/include/crypto/sha1.h
File Facts
- System
- Linux kernel
- Corpus path
include/crypto/sha1.h- Extension
.h- Size
- 5929 bytes
- Lines
- 210
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.h
Detected Declarations
struct sha1_statestruct sha1_block_statestruct sha1_ctxstruct hmac_sha1_keystruct hmac_sha1_ctxfunction hmac_sha1_update
Annotated Snippet
struct sha1_state {
u32 state[SHA1_DIGEST_SIZE / 4];
u64 count;
u8 buffer[SHA1_BLOCK_SIZE];
};
/* State for the SHA-1 compression function */
struct sha1_block_state {
u32 h[SHA1_DIGEST_SIZE / 4];
};
/**
* struct sha1_ctx - Context for hashing a message with SHA-1
* @state: the compression function state
* @bytecount: number of bytes processed so far
* @buf: partial block buffer; bytecount % SHA1_BLOCK_SIZE bytes are valid
*/
struct sha1_ctx {
struct sha1_block_state state;
u64 bytecount;
u8 buf[SHA1_BLOCK_SIZE];
};
/**
* sha1_init() - Initialize a SHA-1 context for a new message
* @ctx: the context to initialize
*
* If you don't need incremental computation, consider sha1() instead.
*
* Context: Any context.
*/
void sha1_init(struct sha1_ctx *ctx);
/**
* sha1_update() - Update a SHA-1 context with message data
* @ctx: the context to update; must have been initialized
* @data: the message data
* @len: the data length in bytes
*
* This can be called any number of times.
*
* Context: Any context.
*/
void sha1_update(struct sha1_ctx *ctx, const u8 *data, size_t len);
/**
* sha1_final() - Finish computing a SHA-1 message digest
* @ctx: the context to finalize; must have been initialized
* @out: (output) the resulting SHA-1 message digest
*
* After finishing, this zeroizes @ctx. So the caller does not need to do it.
*
* Context: Any context.
*/
void sha1_final(struct sha1_ctx *ctx, u8 out[at_least SHA1_DIGEST_SIZE]);
/**
* sha1() - Compute SHA-1 message digest in one shot
* @data: the message data
* @len: the data length in bytes
* @out: (output) the resulting SHA-1 message digest
*
* Context: Any context.
*/
void sha1(const u8 *data, size_t len, u8 out[at_least SHA1_DIGEST_SIZE]);
/**
* struct hmac_sha1_key - Prepared key for HMAC-SHA1
* @istate: private
* @ostate: private
*/
struct hmac_sha1_key {
struct sha1_block_state istate;
struct sha1_block_state ostate;
};
/**
* struct hmac_sha1_ctx - Context for computing HMAC-SHA1 of a message
* @sha_ctx: private
* @ostate: private
*/
struct hmac_sha1_ctx {
struct sha1_ctx sha_ctx;
struct sha1_block_state ostate;
};
/**
* hmac_sha1_preparekey() - Prepare a key for HMAC-SHA1
* @key: (output) the key structure to initialize
* @raw_key: the raw HMAC-SHA1 key
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct sha1_state`, `struct sha1_block_state`, `struct sha1_ctx`, `struct hmac_sha1_key`, `struct hmac_sha1_ctx`, `function hmac_sha1_update`.
- Atlas domain: Repository Root And Misc / include.
- 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.