Merge pull request #7139 from daverodgman/fix-test-output-length-on-success-only-2.28

Backport 2.28 - Fix test to check output length on PSA_SUCCESS only
This commit is contained in:
Gilles Peskine 2023-02-28 18:09:25 +01:00 committed by GitHub
commit 14b61666a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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. */
@ -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: