include/crypto/md5.h

Source file repositories/reference/linux-study-clean/include/crypto/md5.h

File Facts

System
Linux kernel
Corpus path
include/crypto/md5.h
Extension
.h
Size
5917 bytes
Lines
211
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct md5_state {
	u32 hash[MD5_HASH_WORDS];
	u64 byte_count;
	u32 block[MD5_BLOCK_WORDS];
};

/* State for the MD5 compression function */
struct md5_block_state {
	u32 h[MD5_HASH_WORDS];
};

/**
 * struct md5_ctx - Context for hashing a message with MD5
 * @state: the compression function state
 * @bytecount: number of bytes processed so far
 * @buf: partial block buffer; bytecount % MD5_BLOCK_SIZE bytes are valid
 */
struct md5_ctx {
	struct md5_block_state state;
	u64 bytecount;
	u8 buf[MD5_BLOCK_SIZE] __aligned(__alignof__(__le64));
};

/**
 * md5_init() - Initialize an MD5 context for a new message
 * @ctx: the context to initialize
 *
 * If you don't need incremental computation, consider md5() instead.
 *
 * Context: Any context.
 */
void md5_init(struct md5_ctx *ctx);

/**
 * md5_update() - Update an MD5 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 md5_update(struct md5_ctx *ctx, const u8 *data, size_t len);

/**
 * md5_final() - Finish computing an MD5 message digest
 * @ctx: the context to finalize; must have been initialized
 * @out: (output) the resulting MD5 message digest
 *
 * After finishing, this zeroizes @ctx.  So the caller does not need to do it.
 *
 * Context: Any context.
 */
void md5_final(struct md5_ctx *ctx, u8 out[at_least MD5_DIGEST_SIZE]);

/**
 * md5() - Compute MD5 message digest in one shot
 * @data: the message data
 * @len: the data length in bytes
 * @out: (output) the resulting MD5 message digest
 *
 * Context: Any context.
 */
void md5(const u8 *data, size_t len, u8 out[at_least MD5_DIGEST_SIZE]);

/**
 * struct hmac_md5_key - Prepared key for HMAC-MD5
 * @istate: private
 * @ostate: private
 */
struct hmac_md5_key {
	struct md5_block_state istate;
	struct md5_block_state ostate;
};

/**
 * struct hmac_md5_ctx - Context for computing HMAC-MD5 of a message
 * @hash_ctx: private
 * @ostate: private
 */
struct hmac_md5_ctx {
	struct md5_ctx hash_ctx;
	struct md5_block_state ostate;
};

/**
 * hmac_md5_preparekey() - Prepare a key for HMAC-MD5
 * @key: (output) the key structure to initialize
 * @raw_key: the raw HMAC-MD5 key

Annotation

Implementation Notes