Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/crypto: md5: 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 md5 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-4-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+6 -5
+6 -5
include/crypto/md5.h
··· 76 76 * 77 77 * Context: Any context. 78 78 */ 79 - void md5_final(struct md5_ctx *ctx, u8 out[MD5_DIGEST_SIZE]); 79 + void md5_final(struct md5_ctx *ctx, u8 out[at_least MD5_DIGEST_SIZE]); 80 80 81 81 /** 82 82 * md5() - Compute MD5 message digest in one shot ··· 86 86 * 87 87 * Context: Any context. 88 88 */ 89 - void md5(const u8 *data, size_t len, u8 out[MD5_DIGEST_SIZE]); 89 + void md5(const u8 *data, size_t len, u8 out[at_least MD5_DIGEST_SIZE]); 90 90 91 91 /** 92 92 * struct hmac_md5_key - Prepared key for HMAC-MD5 ··· 173 173 * 174 174 * Context: Any context. 175 175 */ 176 - void hmac_md5_final(struct hmac_md5_ctx *ctx, u8 out[MD5_DIGEST_SIZE]); 176 + void hmac_md5_final(struct hmac_md5_ctx *ctx, u8 out[at_least MD5_DIGEST_SIZE]); 177 177 178 178 /** 179 179 * hmac_md5() - Compute HMAC-MD5 in one shot, using a prepared key ··· 187 187 * Context: Any context. 188 188 */ 189 189 void hmac_md5(const struct hmac_md5_key *key, 190 - const u8 *data, size_t data_len, u8 out[MD5_DIGEST_SIZE]); 190 + const u8 *data, size_t data_len, 191 + u8 out[at_least MD5_DIGEST_SIZE]); 191 192 192 193 /** 193 194 * hmac_md5_usingrawkey() - Compute HMAC-MD5 in one shot, using a raw key ··· 205 204 */ 206 205 void hmac_md5_usingrawkey(const u8 *raw_key, size_t raw_key_len, 207 206 const u8 *data, size_t data_len, 208 - u8 out[MD5_DIGEST_SIZE]); 207 + u8 out[at_least MD5_DIGEST_SIZE]); 209 208 210 209 #endif /* _CRYPTO_MD5_H */