Add improvement to chacha20 tests

Co-authored-by: minosgalanakis <30719586+minosgalanakis@users.noreply.github.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
(cherry picked from commit 9d6a54795c96f7f0d7dfc230071dc16c5f47f94a)
This commit is contained in:
Ben Taylor 2026-06-03 10:55:23 +01:00 committed by Ben Taylor
parent a6023aef67
commit 8b7fca9ede

View File

@ -97,7 +97,9 @@ void chacha20_input_len_too_long(void)
/* Consume the rest of the final counter block, then reject more input. */
TEST_EQUAL(mbedtls_chacha20_update(&ctx, 63, input, output), 0);
TEST_EQUAL(mbedtls_chacha20_update(&ctx, 0, NULL, NULL), 0);
TEST_EQUAL(mbedtls_chacha20_update(&ctx, 1, input, output),
/*Test that zero length update does not break an exhausted context */
TEST_EQUAL(mbedtls_chacha20_update(&ctx, 0, NULL, NULL), 0);
TEST_EQUAL(mbedtls_chacha20_update(&ctx, 1, input, output),
MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA);
/* The final counter block is valid, but generating another block is not. */