From 7350fef56b7629a539897c332d7324629580671d Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 28 Apr 2025 10:00:38 -0700 Subject: crypto: lib/sha256 - improve function prototypes Follow best practices by changing the length parameters to size_t and explicitly specifying the length of the output digest arrays. Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu --- include/crypto/sha2.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/crypto') diff --git a/include/crypto/sha2.h b/include/crypto/sha2.h index 9a56286d736d..9853cd2d1291 100644 --- a/include/crypto/sha2.h +++ b/include/crypto/sha2.h @@ -100,9 +100,9 @@ static inline void sha256_init(struct sha256_state *sctx) sctx->state[7] = SHA256_H7; sctx->count = 0; } -void sha256_update(struct sha256_state *sctx, const u8 *data, unsigned int len); -void sha256_final(struct sha256_state *sctx, u8 *out); -void sha256(const u8 *data, unsigned int len, u8 *out); +void sha256_update(struct sha256_state *sctx, const u8 *data, size_t len); +void sha256_final(struct sha256_state *sctx, u8 out[SHA256_DIGEST_SIZE]); +void sha256(const u8 *data, size_t len, u8 out[SHA256_DIGEST_SIZE]); static inline void sha224_init(struct sha256_state *sctx) { @@ -117,6 +117,6 @@ static inline void sha224_init(struct sha256_state *sctx) sctx->count = 0; } /* Simply use sha256_update as it is equivalent to sha224_update. */ -void sha224_final(struct sha256_state *sctx, u8 *out); +void sha224_final(struct sha256_state *sctx, u8 out[SHA224_DIGEST_SIZE]); #endif /* _CRYPTO_SHA2_H */ -- cgit v1.2.3