From 98b1bf9f2eaea2889a9ac0ac1e21b3f3dfc689c8 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Wed, 3 Jun 2026 14:14:31 +0100 Subject: [PATCH] fix asserts in old chachapoly_update_too_long_preserves_state function Signed-off-by: Ben Taylor (cherry picked from commit 57ac277339e9e9684caf1e8a3bad20c57678ea83) --- tests/suites/test_suite_chachapoly.data | 4 ++-- tests/suites/test_suite_chachapoly.function | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/suites/test_suite_chachapoly.data b/tests/suites/test_suite_chachapoly.data index 1c4c670953..4dcac536c1 100644 --- a/tests/suites/test_suite_chachapoly.data +++ b/tests/suites/test_suite_chachapoly.data @@ -19,8 +19,8 @@ mbedtls_chachapoly_dec:"1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc ChaCha20-Poly1305 State Flow chachapoly_state: -ChaCha20-Poly1305 overlong update preserves state -chachapoly_update_too_long_preserves_state: +ChaCha20-Poly1305 overlong generates the appropriate error +chachapoly_update_too_long: ChaCha20-Poly1305 Selftest depends_on:MBEDTLS_SELF_TEST diff --git a/tests/suites/test_suite_chachapoly.function b/tests/suites/test_suite_chachapoly.function index 594eb09101..fb4288ffb4 100644 --- a/tests/suites/test_suite_chachapoly.function +++ b/tests/suites/test_suite_chachapoly.function @@ -77,13 +77,12 @@ exit: /* END_CASE */ /* BEGIN_CASE */ -void chachapoly_update_too_long_preserves_state() +void chachapoly_update_too_long() { unsigned char key[32] = { 0 }; unsigned char nonce[12] = { 0 }; unsigned char input[65] = { 0 }; unsigned char output[65] = { 0 }; - unsigned char aad[1] = { 0 }; mbedtls_chachapoly_context ctx; mbedtls_chachapoly_init(&ctx); @@ -98,8 +97,6 @@ void chachapoly_update_too_long_preserves_state() MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA); TEST_EQUAL(ctx.ciphertext_len, 0); - TEST_EQUAL(mbedtls_chachapoly_update_aad(&ctx, aad, sizeof(aad)), 0); - exit: mbedtls_chachapoly_free(&ctx); }