Skip to content

Commit c093978

Browse files
authored
Merge pull request #10067 from ARMmbed/release-candidate
Release candidate for mbed-os-5.12.0-rc2
2 parents 7dd791e + 1668a9d commit c093978

File tree

656 files changed

+252519
-94830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

656 files changed

+252519
-94830
lines changed

.astyleignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ components/802.15.4_RF
2424
components/wifi
2525
components/TARGET_PSA/TARGET_TFM
2626
tools
27+
components/TARGET_PSA/TESTS
2728
components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/tfm_impl
2829
components/TARGET_PSA/services/attestation/qcbor
29-
components/TARGET_PSA/services/attestation/attestation.h
30+
components/TARGET_PSA/services/attestation/attestation.h

TESTS/mbedmicro-rtos-mbed/heap_and_stack/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void test_isr_stack_in_range(void)
204204
{
205205
// MSP stack should be very near end (test using within 128 bytes)
206206
uint32_t msp = __get_MSP();
207-
bool result = inrange(msp, mbed_stack_isr_start + mbed_stack_isr_size - 128, 128);
207+
bool result = inrange(msp, mbed_stack_isr_start + mbed_stack_isr_size - 0x400, 0x400);
208208

209209
TEST_ASSERT_TRUE_MESSAGE(result, "Interrupt stack in wrong location");
210210
}

TESTS/mbedmicro-rtos-mbed/mail/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using namespace utest::v1;
3333
#define THREAD_STACK_SIZE 512
3434
#elif defined(__ARM_FM)
3535
#define THREAD_STACK_SIZE 512
36-
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
36+
#elif defined(TARGET_FUTURE_SEQUANA_PSA) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
3737
#define THREAD_STACK_SIZE 512
3838
#else
3939
#define THREAD_STACK_SIZE 320 /* larger stack cause out of heap memory on some 16kB RAM boards in multi thread test*/

TESTS/mbedmicro-rtos-mbed/malloc/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ volatile bool thread_should_continue = true;
4141
#define THREAD_STACK_SIZE 512
4242
#elif defined(__ARM_FM)
4343
#define THREAD_STACK_SIZE 512
44-
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
44+
#elif defined(TARGET_FUTURE_SEQUANA_PSA) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
4545
#define THREAD_STACK_SIZE 512
4646
#else
4747
#define THREAD_STACK_SIZE 256

TESTS/mbedmicro-rtos-mbed/threads/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define PARALLEL_THREAD_STACK_SIZE 512
3737
#elif defined(__ARM_FM)
3838
#define PARALLEL_THREAD_STACK_SIZE 512
39-
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
39+
#elif defined(TARGET_FUTURE_SEQUANA_PSA) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
4040
#define PARALLEL_THREAD_STACK_SIZE 512
4141
#else
4242
#define PARALLEL_THREAD_STACK_SIZE 384

TESTS/psa/attestation/main.cpp

Lines changed: 16 additions & 11 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>
@@ -128,17 +129,9 @@ utest::v1::status_t case_teardown_handler(const Case *const source, const size_t
128129

129130
utest::v1::status_t case_setup_handler(const Case *const source, const size_t index_of_case)
130131
{
131-
return greentea_case_setup_handler(source, index_of_case);
132-
}
133-
134-
Case cases[] = {
135-
Case("PSA attestation get token", check_initial_attestation_get_token, case_teardown_handler),
136-
};
137-
138-
Specification specification(greentea_test_setup, cases);
139-
140-
int main()
141-
{
132+
psa_status_t status;
133+
status = mbed_psa_reboot_and_request_new_security_state(PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
134+
TEST_ASSERT_EQUAL(PSA_SUCCESS, status);
142135
#if (defined(COMPONENT_PSA_SRV_IPC) || defined(MBEDTLS_ENTROPY_NV_SEED))
143136
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
144137
/* inject some seed for test*/
@@ -149,5 +142,17 @@ int main()
149142
/* don't really care if this succeeds this is just to make crypto init pass*/
150143
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
151144
#endif
145+
return greentea_case_setup_handler(source, index_of_case);
146+
}
147+
148+
149+
Case cases[] = {
150+
Case("PSA attestation get token", case_setup_handler, check_initial_attestation_get_token, case_teardown_handler),
151+
};
152+
153+
Specification specification(greentea_test_setup, cases);
154+
155+
int main()
156+
{
152157
return !Harness::run(specification);
153158
}

TESTS/psa/its_ps/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ utest::v1::status_t case_its_teardown_handler(const Case *const source, const si
157157
{
158158
psa_status_t status;
159159
status = mbed_psa_reboot_and_request_new_security_state(PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
160-
TEST_ASSERT_EQUAL(PSA_LIFECYCLE_SUCCESS, status);
160+
TEST_ASSERT_EQUAL(PSA_SUCCESS, status);
161161
return greentea_case_teardown_handler(source, passed, failed, reason);
162162
}
163163

@@ -167,7 +167,7 @@ utest::v1::status_t case_its_setup_handler(const Case *const source, const size_
167167
psa_status_t status;
168168
if (stype == its) {
169169
status = mbed_psa_reboot_and_request_new_security_state(PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
170-
TEST_ASSERT_EQUAL(PSA_LIFECYCLE_SUCCESS, status);
170+
TEST_ASSERT_EQUAL(PSA_SUCCESS, status);
171171
} else {
172172
status = psa_ps_reset();
173173
TEST_ASSERT_EQUAL(PSA_SUCCESS, status);

TESTS/psa/spm_client/COMPONENT_NSPE/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,16 @@ Case cases[] = {
460460
Case("Testing client tx_buff_null", tx_buff_null),
461461
Case("Testing client rx_tx_null", rx_tx_null),
462462
Case("Testing client multiple_call from a single thread", multiple_call),
463-
Case("Testing client exceed num of max channels allowed", exceed_num_of_max_channels),
464463
Case("Testing client close on NULL handle", client_close_null_handle),
465464
Case("Testing DROP_CONNECTION State", drop_connection),
466465
Case("Testing client psa_framework_version() API", verify_psa_framework_version),
467466
Case("Testing client psa_version() API on existing SID", psa_version_existing),
468467
Case("Testing client psa_version() API on non-existing SID", psa_version_non_existing),
469468
Case("Testing client psa_version() API to a service that is not NSPE callable", psa_version_secure_access_only),
470469
Case("Testing client multiple calls on different channels to the same SID", multi_thread_diff_handles),
470+
#if defined TARGET_MBED_SPM // TF-M issue: https://developer.trustedfirmware.org/T244
471+
Case("Testing client exceed num of max channels allowed", exceed_num_of_max_channels),
472+
#endif
471473
};
472474

473475
utest::v1::status_t test_setup(const size_t number_of_cases)

TESTS/psa/spm_server/COMPONENT_NSPE/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ Case cases[] = {
264264
SPM_UTEST_CASE("Try to skip more bytes than left while reading", skip_more_than_left),
265265
SPM_UTEST_CASE("Test rhandle implementation by calculating the factorial function", rhandle_factorial),
266266
SPM_UTEST_CASE("Test a call flow between 2 secure partitions", cross_partition_call),
267+
#if defined TARGET_MBED_SPM // TF-M issue: https://developer.trustedfirmware.org/T273
267268
SPM_UTEST_CASE("Test a common DOORBELL scenario", doorbell_test),
269+
#endif
268270
};
269271

270272
//Declare your test specification with a custom setup handler

TESTS/psa/spm_server/COMPONENT_SPE/tests.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@ psa_test_server_side_func test_list[] = {
698698
PSA_TEST_SERVER_NAME(skip_more_than_left),
699699
PSA_TEST_SERVER_NAME(rhandle_factorial),
700700
PSA_TEST_SERVER_NAME(cross_partition_call),
701+
#if defined TARGET_MBED_SPM // TF-M issue: https://developer.trustedfirmware.org/T273
701702
PSA_TEST_SERVER_NAME(doorbell_test),
703+
#endif
702704
NULL
703705
};

components/TARGET_PSA/TARGET_MBED_SPM/psa_defs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ extern "C" {
7777

7878
typedef uint32_t psa_signal_t;
7979
typedef int32_t psa_handle_t;
80-
typedef psa_status_t error_t;
8180

8281
/* -------------------------------------- Structs ------------------------------------ */
8382

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
22
"name": "tfm-s",
3-
"macros": ["MBED_FAULT_HANDLER_DISABLED", "BYPASS_NVSTORE_CHECK=1"]
3+
"macros": ["MBED_FAULT_HANDLER_DISABLED", "BYPASS_NVSTORE_CHECK=1"],
4+
"config": {
5+
"max_ns_thread_count": {
6+
"help": "maximum allowed number of non-secure threads",
7+
"macro_name": "TFM_MAX_NS_THREAD_COUNT",
8+
"value": 10
9+
}
10+
}
411
}

components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/include/tfm_svcalls.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ psa_handle_t tfm_svcall_psa_connect(uint32_t *args, int32_t ns_caller);
5858
* handle, in_vec, in_len, out_vec, out_len.
5959
* \param[in] ns_caller If 'non-zero', call from non-secure client.
6060
* Or from secure client.
61+
* \param[in] lr Link register to be stored
6162
*
6263
* \retval >=0 RoT Service-specific status value.
6364
* \retval <0 RoT Service-specific error code.
@@ -73,7 +74,7 @@ psa_handle_t tfm_svcall_psa_connect(uint32_t *args, int32_t ns_caller);
7374
* \arg The message is unrecognized by the RoT
7475
* Service or incorrectly formatted.
7576
*/
76-
psa_status_t tfm_svcall_psa_call(uint32_t *args, int32_t ns_caller);
77+
psa_status_t tfm_svcall_psa_call(uint32_t *args, int32_t ns_caller, uint32_t lr);
7778

7879
/**
7980
* \brief SVC handler for \ref psa_close.
@@ -96,10 +97,11 @@ void tfm_svcall_psa_close(uint32_t *args, int32_t ns_caller);
9697
*
9798
* \param[in] svc_num SVC number
9899
* \param[in] ctx Argument context
100+
* \param[in] lr Link register to be stored
99101
*
100102
* \returns Return values from those who has,
101103
* or PSA_SUCCESS.
102104
*/
103-
int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx);
105+
int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx, uint32_t lr);
104106

105107
#endif

components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_svcalls.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ psa_handle_t tfm_svcall_psa_connect(uint32_t *args, int32_t ns_caller)
107107
return PSA_NULL_HANDLE;
108108
}
109109

110-
psa_status_t tfm_svcall_psa_call(uint32_t *args, int32_t ns_caller)
110+
psa_status_t tfm_svcall_psa_call(uint32_t *args, int32_t ns_caller, uint32_t lr)
111111
{
112112
psa_handle_t handle;
113113
psa_invec *inptr, invecs[PSA_MAX_IOVEC];
@@ -124,14 +124,17 @@ psa_status_t tfm_svcall_psa_call(uint32_t *args, int32_t ns_caller)
124124
in_num = (size_t)args[2];
125125
outptr = (psa_outvec *)args[3];
126126
/*
127-
* FixMe: 5th parameter is pushed at stack top before SVC; plus
128-
* exception stacked contents, 5th parameter is now at 8th position
129-
* in SVC handler. However, if thread mode applies FloatPoint, then
130-
* FloatPoint context is pushed into stack and then 5th parameter
131-
* will not be args[8].
132-
* Will refine it later.
127+
* 5th parameter is pushed at stack top before SVC; plus exception stacked contents,
128+
* 5th parameter is now at 8th position in SVC handler.
129+
* However, if thread mode applies FloatPoint, then FloatPoint context is pushed into
130+
* stack and then 5th parameter will be args[26].
133131
*/
134-
out_num = (size_t)args[8];
132+
if (lr & EXC_RETURN_FPU_FRAME_BASIC) {
133+
out_num = (size_t)args[8];
134+
}
135+
else {
136+
out_num = (size_t)args[26];
137+
}
135138
} else {
136139
/*
137140
* FixMe: From non-secure caller, vec and len are composed into a new
@@ -926,7 +929,7 @@ static void tfm_svcall_psa_eoi(uint32_t *args)
926929
/* FixMe: re-enable interrupt */
927930
}
928931

929-
int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx)
932+
int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx, uint32_t lr)
930933
{
931934
switch (svc_num) {
932935
case TFM_SVC_SCHEDULE:
@@ -939,7 +942,7 @@ int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx)
939942
case TFM_SVC_PSA_CONNECT:
940943
return tfm_svcall_psa_connect(ctx, 0);
941944
case TFM_SVC_PSA_CALL:
942-
return tfm_svcall_psa_call(ctx, 0);
945+
return tfm_svcall_psa_call(ctx, 0, lr);
943946
case TFM_SVC_PSA_CLOSE:
944947
tfm_svcall_psa_close(ctx, 0);
945948
break;

components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ uint32_t SVCHandler_main(uint32_t *svc_args, uint32_t lr)
205205
case TFM_SVC_PSA_NOTIFY:
206206
case TFM_SVC_PSA_CLEAR:
207207
case TFM_SVC_PSA_EOI:
208-
svc_args[0] = SVC_Handler_IPC(svc_number, svc_args);
208+
svc_args[0] = SVC_Handler_IPC(svc_number, svc_args, lr);
209209
break;
210210
#endif
211211
default:

components/TARGET_PSA/TARGET_TFM/mbed_lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"rot_pool_size": {
1818
"help": "maximum number of RoT services allowed",
1919
"macro_name": "TFM_SPM_MAX_ROT_SERV_NUM",
20-
"value": 30
20+
"value": 32
2121
},
2222
"message_pool_size": {
2323
"help": "maximum number of active messages allowed",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# PSA Initial Attestation Testcase checklist
2+
3+
| Test | Return value | API | Test Algorithm | Test Cases |
4+
|-----------|--------------------------------------|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
5+
| test_a001 | PSA_ATTEST_ERR_SUCCESS | psa_initial_attest_get_token()<br />psa_initial_attest_get_token_size() | 1. Provide correct inputs to API with described challenge sizes <br />2. Expect API to return this define as return value each time <br />3. Verify the token | 1. Challenge_size = 32 <br />2. Challenge_size = 48 <br />3. Challenge_size = 64 |
6+
| | PSA_ATTEST_ERR_INVALID_INPUT | psa_initial_attest_get_token()<br />psa_initial_attest_get_token_size() | 1. Provide described challenge sizes to the API along with other valid parameters <br />2. Expect API to return this define as return value each time | 1. Challenge_size is zero <br />2. Invalid challenge size between 0 and 32 <br />3. Invalid challenge size between 32 and 64 <br />4. Challenge_size is greater than MAX_CHALLENGE_SIZE |
7+
| | PSA_ATTEST_ERR_TOKEN_BUFFER_OVERFLOW | psa_initial_attest_get_token() | 1. Provide described taken size to the API along with other valid parameters <br />2. Expect API to return this define as return value each time | Pass the token_size which less than actual/required token size |
8+
| | PSA_ATTEST_ERR_INIT_FAILED | psa_initial_attest_get_token()<br />psa_initial_attest_get_token_size() | Can't simulate. Test can't generate stimulus where attestation initialisation fails | |
9+
| | PSA_ATTEST_ERR_CLAIM_UNAVAILABLE | psa_initial_attest_get_token() | Can't simulate. Test can't generate stimulus where claim can unavailable | |
10+
| | PSA_ATTEST_ERR_GENERAL | psa_initial_attest_get_token()<br />psa_initial_attest_get_token_size() | Can't simulate. Test can't generate stimulus where unexpected error happened during API operation | |
11+
12+
## Note
13+
14+
1. In verifying the token, only the data type of claims and presence of the mandatory claims are checked and the values of the claims are not checked.
15+
2. Checks related to token signature validation will be part of future release
16+
17+
# License
18+
Arm PSA test suite is distributed under Apache v2.0 License.
19+
20+
--------------
21+
22+
*Copyright (c) 2019, Arm Limited and Contributors. All rights reserved.*
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "val_interfaces.h"
2+
#include "pal_mbed_os_intf.h"
3+
4+
void test_entry_a001(val_api_t *val_api, psa_api_t *psa_api);
5+
6+
int main(void)
7+
{
8+
test_start(test_entry_a001, COMPLIANCE_TEST_ATTESTATION);
9+
}

0 commit comments

Comments
 (0)