Add improvement to chacha20 tests

Co-authored-by: minosgalanakis <[email protected]>
Signed-off-by: Ben Taylor <[email protected]>
(cherry picked from commit 9d6a54795c96f7f0d7dfc230071dc16c5f47f94a)
This commit is contained in:
Ben Taylor
2026-06-11 14:10:14 +01:00
committed by Ben Taylor
parent a6023aef67
commit 8b7fca9ede
+3 -1
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. */