aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2025-04-28 10:00:38 -0700
committerHerbert Xu <herbert@gondor.apana.org.au>2025-05-05 18:20:44 +0800
commit7350fef56b7629a539897c332d7324629580671d (patch)
tree2c5dbbdc0165378a0ca37ea7b922a4a1f61ede5e /include/crypto
parentcrypto: sha256 - remove sha256_base.h (diff)
downloadlinux-7350fef56b7629a539897c332d7324629580671d.tar.gz
linux-7350fef56b7629a539897c332d7324629580671d.zip
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 <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/sha2.h8
1 files changed, 4 insertions, 4 deletions
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 */