Skip to content

PSA: Fix error codes masking in psa_attestation_inject_key() #9996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions TESTS/psa/attestation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "greentea-client/test_env.h"
#include "unity/unity.h"
#include "utest/utest.h"
#include "psa/lifecycle.h"
#include "psa_initial_attestation_api.h"
#include "psa_attest_inject_key.h"
#include <string.h>
Expand Down Expand Up @@ -126,11 +127,6 @@ utest::v1::status_t case_teardown_handler(const Case *const source, const size_t
return greentea_case_teardown_handler(source, passed, failed, reason);
}

utest::v1::status_t case_setup_handler(const Case *const source, const size_t index_of_case)
{
return greentea_case_setup_handler(source, index_of_case);
}

Case cases[] = {
Case("PSA attestation get token", check_initial_attestation_get_token, case_teardown_handler),
};
Expand All @@ -139,6 +135,8 @@ Specification specification(greentea_test_setup, cases);

int main()
{
psa_status_t status = mbed_psa_reboot_and_request_new_security_state(PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
TEST_ASSERT_EQUAL(PSA_LIFECYCLE_SUCCESS, status);
#if (defined(COMPONENT_PSA_SRV_IPC) || defined(MBEDTLS_ENTROPY_NV_SEED))
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
/* inject some seed for test*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,5 @@ psa_attestation_inject_key(const uint8_t *key_data,
call_error = psa_call(handle, in_vec, 2, out_vec, 2);

psa_close(handle);

if (call_error < 0) {
call_error = PSA_ERROR_COMMUNICATION_FAILURE;
}
return call_error;
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void psa_attest_inject_key(void)
uint32_t bytes_read = 0;

if (msg.in_size[0] != sizeof(psa_key_type_t)) {
status = PSA_ERROR_COMMUNICATION_FAILURE;
status = PSA_ERROR_INVALID_ARGUMENT;
break;
}

Expand Down