Skip to content

Commit

Permalink
asymmetric_encrypt: check output length only if return code is PSA_SU…
Browse files Browse the repository at this point in the history
…CCESS.

Signed-off-by: Stephan Koch <[email protected]>
Signed-off-by: Dave Rodgman <[email protected]>
  • Loading branch information
oberon-sk authored and daverodgman committed Feb 28, 2023
1 parent 7a5168e commit 8a23f49
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 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,9 @@ 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);
}

/* 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 +4190,9 @@ 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);
}
}

exit:
Expand Down

0 comments on commit 8a23f49

Please sign in to comment.