Message ID | 20240507175132.1456512-9-raymond.mao@linaro.org |
---|---|
State | RFC |
Delegated to: | Tom Rini |
Headers | show |
Series | Integrate MbedTLS v3.6 LTS with U-Boot | expand |
On Tue, May 07, 2024 at 10:50:50AM -0700, Raymond Mao wrote: > The md5 header is updated to adapt to both original lib and MbedTLS. > Now we need to change the API callers accordingly. > > Signed-off-by: Raymond Mao <raymond.mao@linaro.org> > --- > Changes in v2 > - Initial patch. > > drivers/crypto/hash/hash_sw.c | 8 ++++---- > lib/md5.c | 10 +++++----- > 2 files changed, 9 insertions(+), 9 deletions(-) As this brings md5 in to a consistent state with the rest of the algorithms, going against the normal coding style of not adding typedefs makes sense. Reviewed-by: Tom Rini <trini@konsulko.com>
On Tue, 7 May 2024 at 20:55, Raymond Mao <raymond.mao@linaro.org> wrote: > > The md5 header is updated to adapt to both original lib and MbedTLS. > Now we need to change the API callers accordingly. > > Signed-off-by: Raymond Mao <raymond.mao@linaro.org> > --- > Changes in v2 > - Initial patch. > > drivers/crypto/hash/hash_sw.c | 8 ++++---- > lib/md5.c | 10 +++++----- > 2 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/crypto/hash/hash_sw.c b/drivers/crypto/hash/hash_sw.c > index d8065d68ea4..a5033677930 100644 > --- a/drivers/crypto/hash/hash_sw.c > +++ b/drivers/crypto/hash/hash_sw.c > @@ -51,17 +51,17 @@ static void hash_finish_crc32(void *ctx, void *obuf) > /* MD5 */ > static void hash_init_md5(void *ctx) > { > - MD5Init((struct MD5Context *)ctx); > + MD5Init((MD5Context *)ctx); > } > > static void hash_update_md5(void *ctx, const void *ibuf, uint32_t ilen) > { > - MD5Update((struct MD5Context *)ctx, ibuf, ilen); > + MD5Update((MD5Context *)ctx, ibuf, ilen); > } > > static void hash_finish_md5(void *ctx, void *obuf) > { > - MD5Final(obuf, (struct MD5Context *)ctx); > + MD5Final(obuf, (MD5Context *)ctx); > } > > /* SHA1 */ > @@ -159,7 +159,7 @@ static struct sw_hash_impl sw_hash_impl[HASH_ALGO_NUM] = { > .init = hash_init_md5, > .update = hash_update_md5, > .finish = hash_finish_md5, > - .ctx_alloc_sz = sizeof(struct MD5Context), > + .ctx_alloc_sz = sizeof(MD5Context), > }, > > [HASH_ALGO_SHA1] = { > diff --git a/lib/md5.c b/lib/md5.c > index faf3f78ab1e..34343cf8e23 100644 > --- a/lib/md5.c > +++ b/lib/md5.c > @@ -55,7 +55,7 @@ byteReverse(unsigned char *buf, unsigned longs) > * initialization constants. > */ > void > -MD5Init(struct MD5Context *ctx) > +MD5Init(MD5Context *ctx) > { > ctx->buf[0] = 0x67452301; > ctx->buf[1] = 0xefcdab89; > @@ -71,7 +71,7 @@ MD5Init(struct MD5Context *ctx) > * of bytes. > */ > void > -MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) > +MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len) > { > register __u32 t; > > @@ -120,7 +120,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) > * 1 0* (64-bit count of bits processed, MSB-first) > */ > void > -MD5Final(unsigned char digest[16], struct MD5Context *ctx) > +MD5Final(unsigned char digest[16], MD5Context *ctx) > { > unsigned int count; > unsigned char *p; > @@ -269,7 +269,7 @@ MD5Transform(__u32 buf[4], __u32 const in[16]) > void > md5 (unsigned char *input, int len, unsigned char output[16]) > { > - struct MD5Context context; > + MD5Context context; > > MD5Init(&context); > MD5Update(&context, input, len); > @@ -286,7 +286,7 @@ void > md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16], > unsigned int chunk_sz) > { > - struct MD5Context context; > + MD5Context context; > #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) > const unsigned char *end, *curr; > int chunk; > -- > 2.25.1 > Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/drivers/crypto/hash/hash_sw.c b/drivers/crypto/hash/hash_sw.c index d8065d68ea4..a5033677930 100644 --- a/drivers/crypto/hash/hash_sw.c +++ b/drivers/crypto/hash/hash_sw.c @@ -51,17 +51,17 @@ static void hash_finish_crc32(void *ctx, void *obuf) /* MD5 */ static void hash_init_md5(void *ctx) { - MD5Init((struct MD5Context *)ctx); + MD5Init((MD5Context *)ctx); } static void hash_update_md5(void *ctx, const void *ibuf, uint32_t ilen) { - MD5Update((struct MD5Context *)ctx, ibuf, ilen); + MD5Update((MD5Context *)ctx, ibuf, ilen); } static void hash_finish_md5(void *ctx, void *obuf) { - MD5Final(obuf, (struct MD5Context *)ctx); + MD5Final(obuf, (MD5Context *)ctx); } /* SHA1 */ @@ -159,7 +159,7 @@ static struct sw_hash_impl sw_hash_impl[HASH_ALGO_NUM] = { .init = hash_init_md5, .update = hash_update_md5, .finish = hash_finish_md5, - .ctx_alloc_sz = sizeof(struct MD5Context), + .ctx_alloc_sz = sizeof(MD5Context), }, [HASH_ALGO_SHA1] = { diff --git a/lib/md5.c b/lib/md5.c index faf3f78ab1e..34343cf8e23 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -55,7 +55,7 @@ byteReverse(unsigned char *buf, unsigned longs) * initialization constants. */ void -MD5Init(struct MD5Context *ctx) +MD5Init(MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; @@ -71,7 +71,7 @@ MD5Init(struct MD5Context *ctx) * of bytes. */ void -MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) +MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len) { register __u32 t; @@ -120,7 +120,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) * 1 0* (64-bit count of bits processed, MSB-first) */ void -MD5Final(unsigned char digest[16], struct MD5Context *ctx) +MD5Final(unsigned char digest[16], MD5Context *ctx) { unsigned int count; unsigned char *p; @@ -269,7 +269,7 @@ MD5Transform(__u32 buf[4], __u32 const in[16]) void md5 (unsigned char *input, int len, unsigned char output[16]) { - struct MD5Context context; + MD5Context context; MD5Init(&context); MD5Update(&context, input, len); @@ -286,7 +286,7 @@ void md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16], unsigned int chunk_sz) { - struct MD5Context context; + MD5Context context; #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) const unsigned char *end, *curr; int chunk;
The md5 header is updated to adapt to both original lib and MbedTLS. Now we need to change the API callers accordingly. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> --- Changes in v2 - Initial patch. drivers/crypto/hash/hash_sw.c | 8 ++++---- lib/md5.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-)