Skip to content

Commit de1f086

Browse files
author
Nir Sonnenschein
authored
Merge pull request #9996 from kfnta/attest_ipc_fix
PSA: Fix error codes masking in psa_attestation_inject_key()
2 parents 774294d + d0021b5 commit de1f086

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

TESTS/psa/attestation/main.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "greentea-client/test_env.h"
2424
#include "unity/unity.h"
2525
#include "utest/utest.h"
26+
#include "psa/lifecycle.h"
2627
#include "psa_initial_attestation_api.h"
2728
#include "psa_attest_inject_key.h"
2829
#include <string.h>
@@ -126,11 +127,6 @@ utest::v1::status_t case_teardown_handler(const Case *const source, const size_t
126127
return greentea_case_teardown_handler(source, passed, failed, reason);
127128
}
128129

129-
utest::v1::status_t case_setup_handler(const Case *const source, const size_t index_of_case)
130-
{
131-
return greentea_case_setup_handler(source, index_of_case);
132-
}
133-
134130
Case cases[] = {
135131
Case("PSA attestation get token", check_initial_attestation_get_token, case_teardown_handler),
136132
};
@@ -139,6 +135,8 @@ Specification specification(greentea_test_setup, cases);
139135

140136
int main()
141137
{
138+
psa_status_t status = mbed_psa_reboot_and_request_new_security_state(PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
139+
TEST_ASSERT_EQUAL(PSA_LIFECYCLE_SUCCESS, status);
142140
#if (defined(COMPONENT_PSA_SRV_IPC) || defined(MBEDTLS_ENTROPY_NV_SEED))
143141
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
144142
/* inject some seed for test*/

components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IPC/psa_attest_inject_key.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,5 @@ psa_attestation_inject_key(const uint8_t *key_data,
5151
call_error = psa_call(handle, in_vec, 2, out_vec, 2);
5252

5353
psa_close(handle);
54-
55-
if (call_error < 0) {
56-
call_error = PSA_ERROR_COMMUNICATION_FAILURE;
57-
}
5854
return call_error;
5955
}

components/TARGET_PSA/services/attestation/COMPONENT_SPE/psa_attestation_partition.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static void psa_attest_inject_key(void)
175175
uint32_t bytes_read = 0;
176176

177177
if (msg.in_size[0] != sizeof(psa_key_type_t)) {
178-
status = PSA_ERROR_COMMUNICATION_FAILURE;
178+
status = PSA_ERROR_INVALID_ARGUMENT;
179179
break;
180180
}
181181

0 commit comments

Comments
 (0)