From c018204019a6a935ae0bf3ab888cd7a6d7fc2039 Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Tue, 8 Nov 2022 08:12:56 -0500 Subject: [PATCH] Improve error injection in EC J-PAKE tests Instead of corrupting the public key part of the message, corrupt the proof part. A proof is conceptually similar to a signature, and changing anything in it should make it invalid with a high probability. Also, instead of shifting data, perform a bitflip. Signed-off-by: Andrzej Kurek --- tests/suites/test_suite_psa_crypto.function | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index 36a8efaae5..779f594dca 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -790,8 +790,8 @@ static void ecjpake_do_round( psa_algorithm_t alg, unsigned int primitive, if( inject_error == 1 ) { - buffer0[s_x1_pk_off + 8] >>= 4; - buffer0[s_x2_pk_off + 7] <<= 4; + buffer0[s_x1_pr_off + 8] ^= 1; + buffer0[s_x2_pr_off + 7] ^= 1; expected_status = PSA_ERROR_DATA_INVALID; } @@ -1013,8 +1013,8 @@ static void ecjpake_do_round( psa_algorithm_t alg, unsigned int primitive, if( inject_error == 2 ) { - buffer1[c_x1_pk_off + 12] >>= 4; - buffer1[c_x2_pk_off + 7] <<= 4; + buffer1[c_x1_pr_off + 12] ^= 1; + buffer1[c_x2_pr_off + 7] ^= 1; expected_status = PSA_ERROR_DATA_INVALID; }