mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
lib/md5: Export progressive APIs
Export the MD5 hash init/update/finish progressive APIs for better flexibility. Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
This commit is contained in:
parent
fe68a67a5f
commit
74bda4fe3d
2 changed files with 7 additions and 3 deletions
|
@ -17,6 +17,10 @@ struct MD5Context {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void MD5Init(struct MD5Context *ctx);
|
||||||
|
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len);
|
||||||
|
void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate and store in 'output' the MD5 digest of 'len' bytes at
|
* Calculate and store in 'output' the MD5 digest of 'len' bytes at
|
||||||
* 'input'. 'output' must have enough space to hold 16 bytes.
|
* 'input'. 'output' must have enough space to hold 16 bytes.
|
||||||
|
|
|
@ -55,7 +55,7 @@ byteReverse(unsigned char *buf, unsigned longs)
|
||||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||||
* initialization constants.
|
* initialization constants.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
MD5Init(struct MD5Context *ctx)
|
MD5Init(struct MD5Context *ctx)
|
||||||
{
|
{
|
||||||
ctx->buf[0] = 0x67452301;
|
ctx->buf[0] = 0x67452301;
|
||||||
|
@ -71,7 +71,7 @@ MD5Init(struct MD5Context *ctx)
|
||||||
* Update context to reflect the concatenation of another buffer full
|
* Update context to reflect the concatenation of another buffer full
|
||||||
* of bytes.
|
* of bytes.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
||||||
{
|
{
|
||||||
register __u32 t;
|
register __u32 t;
|
||||||
|
@ -120,7 +120,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
||||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
||||||
{
|
{
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue