Skip to content

Commit

Permalink
Feedback from Arm: guarantee that output_length <= output_size even o…
Browse files Browse the repository at this point in the history
…n error, to reduce the risk that a missing error check

escalates into a buffer overflow in the application code

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 8a23f49 commit 6ed1436
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/suites/test_suite_psa_crypto.function
Original file line number Diff line number Diff line change
Expand Up @@ -4175,6 +4175,8 @@ void asymmetric_encrypt(int key_type_arg,
TEST_EQUAL(actual_status, expected_status);
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
Expand All @@ -4192,6 +4194,8 @@ void asymmetric_encrypt(int key_type_arg,
TEST_EQUAL(actual_status, expected_status);
if (actual_status == PSA_SUCCESS) {
TEST_EQUAL(output_length, expected_output_length);
} else {
TEST_LE_U(output_length, output_size);
}
}

Expand Down

0 comments on commit 6ed1436

Please sign in to comment.