Skip to content

Commit

Permalink
Merge pull request #7139 from daverodgman/fix-test-output-length-on-s…
Browse files Browse the repository at this point in the history
…uccess-only-2.28

Backport 2.28 - Fix test to check output length on PSA_SUCCESS only
  • Loading branch information
gilles-peskine-arm authored Feb 28, 2023
2 parents 7a5168e + 6ed1436 commit 14b6166
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/suites/test_suite_psa_crypto.function
Original file line number Diff line number Diff line change
Expand Up @@ -4173,7 +4173,11 @@ void asymmetric_encrypt(int key_type_arg,
output, output_size,
&output_length);
TEST_EQUAL(actual_status, expected_status);
TEST_EQUAL(output_length, expected_output_length);
if (actual_status == PSA_SUCCESS) {
TEST_EQUAL(output_length, expected_output_length);
} else {
TEST_LE_U(output_length, output_size);
}

/* If the label is empty, the test framework puts a non-null pointer
* in label->x. Test that a null pointer works as well. */
Expand All @@ -4188,7 +4192,11 @@ void asymmetric_encrypt(int key_type_arg,
output, output_size,
&output_length);
TEST_EQUAL(actual_status, expected_status);
TEST_EQUAL(output_length, expected_output_length);
if (actual_status == PSA_SUCCESS) {
TEST_EQUAL(output_length, expected_output_length);
} else {
TEST_LE_U(output_length, output_size);
}
}

exit:
Expand Down

0 comments on commit 14b6166

Please sign in to comment.