From dd921414d3f8c126bb5924f151e3dbfd15c3f9b2 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 10 Apr 2026 11:39:09 +0200 Subject: [PATCH] Don't assert anything about uninitialized parts of structures In a PAKE operation that has been initialized with `PSA_PAKE_OPERATION_INIT` or `psa_pake_operation_init()`, the content of the driver-specific part is indeterminate. It is actually all-bits-zero on most platforms, but not all, e.g. not with GCC 15 or CompCert. So don't assert anything about it. Signed-off-by: Gilles Peskine --- tests/suites/test_suite_psa_crypto_pake.function | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto_pake.function b/tests/suites/test_suite_psa_crypto_pake.function index 2225959cfc..125c9e1245 100644 --- a/tests/suites/test_suite_psa_crypto_pake.function +++ b/tests/suites/test_suite_psa_crypto_pake.function @@ -1058,9 +1058,6 @@ void pake_input_getters_cipher_suite() psa_pake_cs_set_primitive(&cipher_suite, primitive); psa_pake_cs_set_hash(&cipher_suite, PSA_ALG_SHA_256); - TEST_EQUAL(psa_crypto_driver_pake_get_cipher_suite(&operation.data.inputs, &cipher_suite_ret), - PSA_ERROR_BAD_STATE); - PSA_ASSERT(psa_pake_setup(&operation, &cipher_suite)); TEST_EQUAL(psa_crypto_driver_pake_get_cipher_suite(&operation.data.inputs, &cipher_suite_ret), @@ -1069,6 +1066,10 @@ void pake_input_getters_cipher_suite() TEST_MEMORY_COMPARE(&cipher_suite_ret, sizeof(cipher_suite_ret), &cipher_suite, sizeof(cipher_suite)); + PSA_ASSERT(psa_pake_abort(&operation)); + TEST_EQUAL(psa_crypto_driver_pake_get_cipher_suite(&operation.data.inputs, &cipher_suite_ret), + PSA_ERROR_BAD_STATE); + exit: PSA_ASSERT(psa_pake_abort(&operation)); PSA_DONE();