remove duplicate chacha20_check_counter_wrap functionality in chacha20 and chacha20_neon

Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
This commit is contained in:
Ben Taylor 2026-05-27 09:02:12 +01:00
parent 0e9be79ea3
commit 130b914ff2

View File

@ -233,7 +233,8 @@ static int chacha20_check_counter_wrap(const mbedtls_chacha20_context *ctx,
needed_blocks++;
}
if (needed_blocks > (uint64_t) CHACHA20_MAX_BLOCKS + 1 - ctx->state[CHACHA20_CTR_INDEX]) {
if (needed_blocks >
(uint64_t) CHACHA20_MAX_BLOCKS + 1U - ctx->state[CHACHA20_CTR_INDEX]) {
return MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA;
}