From: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
To: <sjg@chromium.org>, <trini@konsulko.com>, <u-boot@lists.denx.de>
Subject: [PATCH 1/4] lib/md5: Export progressive APIs
Date: Fri, 30 Jul 2021 09:08:02 +0800 [thread overview]
Message-ID: <20210730010805.17845-2-chiawei_wang@aspeedtech.com> (raw)
In-Reply-To: <20210730010805.17845-1-chiawei_wang@aspeedtech.com>
Export the MD5 hash init/update/finish progressive APIs
for better flexibility.
Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
---
include/u-boot/md5.h | 4 ++++
lib/md5.c | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/u-boot/md5.h b/include/u-boot/md5.h
index e09c16a6e3..e5cb923d77 100644
--- a/include/u-boot/md5.h
+++ b/include/u-boot/md5.h
@@ -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
* 'input'. 'output' must have enough space to hold 16 bytes.
diff --git a/lib/md5.c b/lib/md5.c
index 2ae4a06319..688b7254c6 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -55,7 +55,7 @@ byteReverse(unsigned char *buf, unsigned longs)
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
-static void
+void
MD5Init(struct MD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
@@ -71,7 +71,7 @@ MD5Init(struct MD5Context *ctx)
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
-static void
+void
MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
{
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
* 1 0* (64-bit count of bits processed, MSB-first)
*/
-static void
+void
MD5Final(unsigned char digest[16], struct MD5Context *ctx)
{
unsigned int count;
--
2.17.1
next prev parent reply other threads:[~2021-07-30 1:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 1:08 [PATCH 0/4] crypto: Add new UCLASS_HASH Chia-Wei Wang
2021-07-30 1:08 ` Chia-Wei Wang [this message]
2021-09-02 13:28 ` [PATCH 1/4] lib/md5: Export progressive APIs Tom Rini
2021-07-30 1:08 ` [PATCH 2/4] dm: hash: Add new UCLASS_HASH support Chia-Wei Wang
2021-09-02 13:28 ` Tom Rini
2021-09-22 16:19 ` Simon Glass
2021-09-22 23:56 ` ChiaWei Wang
2021-09-24 2:49 ` Simon Glass
2021-09-16 15:43 ` Alex G.
2021-09-22 3:18 ` ChiaWei Wang
2021-09-24 2:49 ` Simon Glass
2021-09-27 15:37 ` Alex G.
2021-09-27 20:17 ` Simon Glass
2021-07-30 1:08 ` [PATCH 3/4] crypto: hash: Add software hash DM driver Chia-Wei Wang
2021-09-02 13:28 ` Tom Rini
2021-09-16 15:48 ` Alex G.
2021-09-22 3:18 ` ChiaWei Wang
2021-07-30 1:08 ` [PATCH 4/4] fit: Use DM hash driver if supported Chia-Wei Wang
2021-09-02 13:28 ` Tom Rini
2021-09-16 15:59 ` Alex G.
2021-09-22 3:18 ` ChiaWei Wang
2021-08-25 1:21 ` [PATCH 0/4] crypto: Add new UCLASS_HASH ChiaWei Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210730010805.17845-2-chiawei_wang@aspeedtech.com \
--to=chiawei_wang@aspeedtech.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).