From 9502b56192aee26d1a9ff467fdb8bfa7b5387029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 4 Jan 2023 13:16:53 +0100 Subject: [PATCH] Fix test function derive_key_exercise() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mbedtls_test_psa_setup_key_derivation_wrap() returns 1 for success, 0 for error, so the test here was wrong. This is just a hotfix in order to avoid a testing gap. Larger issues not addressed here: - I don't think we should just exit and mark the test as passed; if we're not doing the actual testing this should be marked as SKIP. - Returning 1 for success and 0 for failure is a violation of our documented coding guidelines. We're also supposed to test with == 0 or != 0. Having consistent conventions is supposed to help avoid errors like this. Signed-off-by: Manuel Pégourié-Gonnard --- tests/suites/test_suite_psa_crypto.function | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index a4c19b8b03..b236ea8f8c 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -7946,7 +7946,7 @@ void derive_key_exercise( int alg_arg, &base_key ) ); /* Derive a key. */ - if ( mbedtls_test_psa_setup_key_derivation_wrap( &operation, base_key, alg, + if ( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, base_key, alg, input1->x, input1->len, input2->x, input2->len, capacity ) )