mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
lib/crypto: sha1: Add at_least decoration to fixed-size array params
Add the at_least (i.e. 'static') decoration to the fixed-size array parameters of the sha1 library functions. This causes clang to warn when a too-small array of known size is passed. Acked-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: "Jason A. Donenfeld" <Jason@zx2c4.com> Link: https://lore.kernel.org/r/20251122194206.31822-6-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
This commit is contained in:
@@ -84,7 +84,7 @@ void sha1_update(struct sha1_ctx *ctx, const u8 *data, size_t len);
|
||||
*
|
||||
* Context: Any context.
|
||||
*/
|
||||
void sha1_final(struct sha1_ctx *ctx, u8 out[SHA1_DIGEST_SIZE]);
|
||||
void sha1_final(struct sha1_ctx *ctx, u8 out[at_least SHA1_DIGEST_SIZE]);
|
||||
|
||||
/**
|
||||
* sha1() - Compute SHA-1 message digest in one shot
|
||||
@@ -94,7 +94,7 @@ void sha1_final(struct sha1_ctx *ctx, u8 out[SHA1_DIGEST_SIZE]);
|
||||
*
|
||||
* Context: Any context.
|
||||
*/
|
||||
void sha1(const u8 *data, size_t len, u8 out[SHA1_DIGEST_SIZE]);
|
||||
void sha1(const u8 *data, size_t len, u8 out[at_least SHA1_DIGEST_SIZE]);
|
||||
|
||||
/**
|
||||
* struct hmac_sha1_key - Prepared key for HMAC-SHA1
|
||||
@@ -181,7 +181,8 @@ static inline void hmac_sha1_update(struct hmac_sha1_ctx *ctx,
|
||||
*
|
||||
* Context: Any context.
|
||||
*/
|
||||
void hmac_sha1_final(struct hmac_sha1_ctx *ctx, u8 out[SHA1_DIGEST_SIZE]);
|
||||
void hmac_sha1_final(struct hmac_sha1_ctx *ctx,
|
||||
u8 out[at_least SHA1_DIGEST_SIZE]);
|
||||
|
||||
/**
|
||||
* hmac_sha1() - Compute HMAC-SHA1 in one shot, using a prepared key
|
||||
@@ -195,7 +196,8 @@ void hmac_sha1_final(struct hmac_sha1_ctx *ctx, u8 out[SHA1_DIGEST_SIZE]);
|
||||
* Context: Any context.
|
||||
*/
|
||||
void hmac_sha1(const struct hmac_sha1_key *key,
|
||||
const u8 *data, size_t data_len, u8 out[SHA1_DIGEST_SIZE]);
|
||||
const u8 *data, size_t data_len,
|
||||
u8 out[at_least SHA1_DIGEST_SIZE]);
|
||||
|
||||
/**
|
||||
* hmac_sha1_usingrawkey() - Compute HMAC-SHA1 in one shot, using a raw key
|
||||
@@ -212,6 +214,6 @@ void hmac_sha1(const struct hmac_sha1_key *key,
|
||||
*/
|
||||
void hmac_sha1_usingrawkey(const u8 *raw_key, size_t raw_key_len,
|
||||
const u8 *data, size_t data_len,
|
||||
u8 out[SHA1_DIGEST_SIZE]);
|
||||
u8 out[at_least SHA1_DIGEST_SIZE]);
|
||||
|
||||
#endif /* _CRYPTO_SHA1_H */
|
||||
|
||||
Reference in New Issue
Block a user