From bac83ee5ded09b9fd9d2c245fbedbb74de32f0a4 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Tue, 9 Jun 2026 08:32:20 +0100 Subject: [PATCH] Add additional verification that output hasn't been modified Signed-off-by: Ben Taylor (cherry picked from commit 720ee2392a6ced5ee0220a87c20d6c3d43a10650) --- tests/suites/test_suite_chachapoly.function | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/suites/test_suite_chachapoly.function b/tests/suites/test_suite_chachapoly.function index bdea57b8f2..670160b2fd 100644 --- a/tests/suites/test_suite_chachapoly.function +++ b/tests/suites/test_suite_chachapoly.function @@ -84,6 +84,7 @@ void chachapoly_update_too_long() unsigned char input[65] = { 0 }; unsigned char output[65] = { 0 }; mbedtls_chachapoly_context ctx; + size_t i; mbedtls_chachapoly_init(&ctx); @@ -93,8 +94,12 @@ void chachapoly_update_too_long() /* Force the next update to be too long without processing a huge buffer. */ ctx.chacha20_ctx.state[12] = UINT32_MAX; + memset(output, 0x2a, sizeof(output)); TEST_EQUAL(mbedtls_chachapoly_update(&ctx, sizeof(input), input, output), MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA); + for (i = 0; i < sizeof(output); i++) { + TEST_EQUAL(output[i], 0x2a); + } exit: mbedtls_chachapoly_free(&ctx);