Merge pull request #7124 from oberon-microsystems/fix-test-output-length-on-success-only

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

View File

@ -7853,7 +7853,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. */
@ -7868,7 +7872,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: