crypto: lib/chacha - add array bounds to function prototypes

Add explicit array bounds to the function prototypes for the parameters
that didn't already get handled by the conversion to use chacha_state:

- chacha_block_*():
  Change 'u8 *out' or 'u8 *stream' to u8 out[CHACHA_BLOCK_SIZE].

- hchacha_block_*():
  Change 'u32 *out' or 'u32 *stream' to u32 out[HCHACHA_OUT_WORDS].

- chacha_init():
  Change 'const u32 *key' to 'const u32 key[CHACHA_KEY_WORDS]'.
  Change 'const u8 *iv' to 'const u8 iv[CHACHA_IV_SIZE]'.

No functional changes.  This just makes it clear when fixed-size arrays
are expected.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Eric Biggers
2025-05-05 11:18:24 -07:00
committed by Herbert Xu
parent 607c92141c
commit bdc2a55687
12 changed files with 49 additions and 44 deletions

View File

@@ -46,8 +46,8 @@ static int chacha12_setkey(struct crypto_skcipher *tfm,
}
static int chacha_stream_xor(struct skcipher_request *req,
const struct chacha_ctx *ctx, const u8 *iv,
bool arch)
const struct chacha_ctx *ctx,
const u8 iv[CHACHA_IV_SIZE], bool arch)
{
struct skcipher_walk walk;
struct chacha_state state;