mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-11-09 14:50:17 +08:00
Add simplification of if statement in chacha20
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
This commit is contained in:
parent
56b050d738
commit
0e9be79ea3
@ -233,9 +233,7 @@ static int chacha20_check_counter_wrap(const mbedtls_chacha20_context *ctx,
|
||||
needed_blocks++;
|
||||
}
|
||||
|
||||
if (needed_blocks != 0U &&
|
||||
needed_blocks - 1U >
|
||||
(uint64_t) CHACHA20_MAX_BLOCKS - ctx->state[CHACHA20_CTR_INDEX]) {
|
||||
if (needed_blocks > (uint64_t) CHACHA20_MAX_BLOCKS + 1 - ctx->state[CHACHA20_CTR_INDEX]) {
|
||||
return MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user