Skip to content

Commit 2994c3f

Browse files
authored
Merge pull request #9064 from ARMmbed/release-candidate
Release candidate for mbed-os-5.11.0-rc3
2 parents d962581 + 5636377 commit 2994c3f

File tree

126 files changed

+39318
-707
lines changed

Some content is hidden

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

126 files changed

+39318
-707
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,9 @@ matrix:
280280
- echo 'Checking that there is no GPL licence text in code'
281281
- ! git grep -q --ignore-case "gnu general public";
282282
- ! git grep -q --ignore-case "gnu library general public";
283+
- env:
284+
- NAME=psa-autogen
285+
script:
286+
# Run SPM code generator and check that changes are not needed
287+
- python tools/spm/generate_partition_code.py
288+
- git diff --exit-code

TESTS/mbed-crypto/sanity/main.cpp

Lines changed: 336 additions & 0 deletions
Large diffs are not rendered by default.

TESTS/mbed_hal/mpu/main.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@ static void hard_fault_handler_test()
7272

7373
static void mpu_fault_test(const volatile uint16_t *mem_function)
7474
{
75-
mbed_mpu_init();
76-
77-
// Verify that the mpu causes faults when executing ram
75+
// Verify that the mpu causes faults when executing ram after init
7876
fault_count = 0;
79-
mbed_mpu_enable_ram_xn(true);
77+
mbed_mpu_init();
8078
call_mem(mem_function);
8179
TEST_ASSERT_EQUAL(1, fault_count);
8280

@@ -86,7 +84,7 @@ static void mpu_fault_test(const volatile uint16_t *mem_function)
8684
call_mem(mem_function);
8785
TEST_ASSERT_EQUAL(0, fault_count);
8886

89-
// Verify that the mpu causes faults when executing ram
87+
// Verify that the mpu can be turned back on
9088
fault_count = 0;
9189
mbed_mpu_enable_ram_xn(true);
9290
call_mem(mem_function);

TESTS/mbed_hal/spm/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#error [NOT_SUPPORTED] this test is supported on GCC only
2424
#endif
2525

26+
#if defined(TARGET_FUTURE_SEQUANA_PSA)
27+
#error [NOT_SUPPORTED] Disable this Test until FUTURE_SEQUANA_PSA enables Memory protection
28+
#endif
29+
2630
#include "utest/utest.h"
2731
#include "unity/unity.h"
2832
#include "greentea-client/test_env.h"

TESTS/mbed_hal/trng/main.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,33 @@
6666

6767
using namespace utest::v1;
6868

69+
#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
70+
#include "entropy.h"
71+
#include "entropy_poll.h"
72+
#include "crypto.h"
73+
#if !defined(MAX)
74+
#define MAX(a,b) (((a)>(b))?(a):(b))
75+
#endif
76+
77+
/* Calculating the minimum allowed entropy size in bytes */
78+
#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE \
79+
MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
80+
81+
void inject_entropy_for_psa()
82+
{
83+
if (psa_crypto_init() == PSA_ERROR_INSUFFICIENT_ENTROPY) {
84+
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
85+
/* inject some a seed for test*/
86+
for (int i = 0; i < MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE; ++i) {
87+
seed[i] = i;
88+
}
89+
90+
/* don't really care if this succeed this is just to make crypto init pass*/
91+
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
92+
}
93+
}
94+
#endif // (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
95+
6996
static int fill_buffer_trng(uint8_t *buffer, trng_t *trng_obj, size_t trng_len)
7097
{
7198
size_t temp_size = 0, output_length = 0;
@@ -241,7 +268,13 @@ Specification specification(greentea_test_setup, cases, greentea_test_teardown_h
241268

242269
int main()
243270
{
271+
#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
272+
inject_entropy_for_psa();
273+
#endif
244274
bool ret = !Harness::run(specification);
245275

246276
return ret;
247277
}
278+
279+
280+

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ 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)
37+
#define THREAD_STACK_SIZE 512
3638
#else
3739
#define THREAD_STACK_SIZE 320 /* larger stack cause out of heap memory on some 16kB RAM boards in multi thread test*/
3840
#endif

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ 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)
45+
#define THREAD_STACK_SIZE 512
4446
#else
4547
#define THREAD_STACK_SIZE 256
4648
#endif

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
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)
40+
#define PARALLEL_THREAD_STACK_SIZE 512
3941
#else
4042
#define PARALLEL_THREAD_STACK_SIZE 384
4143
#endif

TESTS/mbedtls/selftest/main.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,32 @@ Case cases[] = {
8484
#endif /* MBEDTLS_SELF_TEST */
8585
};
8686

87+
#if (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
88+
#include "crypto.h"
89+
#if !defined(MAX)
90+
#define MAX(a,b) (((a)>(b))?(a):(b))
91+
#endif
92+
93+
/* Calculating the minimum allowed entropy size in bytes */
94+
#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE \
95+
MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
96+
97+
void inject_entropy_for_psa()
98+
{
99+
if (psa_crypto_init() == PSA_ERROR_INSUFFICIENT_ENTROPY) {
100+
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
101+
/* inject some a seed for test*/
102+
for (int i = 0; i < MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE; ++i) {
103+
seed[i] = i;
104+
}
105+
106+
/* don't really care if this succeed this is just to make crypto init pass*/
107+
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
108+
}
109+
}
110+
#endif // (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
111+
112+
87113
utest::v1::status_t test_setup(const size_t num_cases)
88114
{
89115
GREENTEA_SETUP(120, "default_auto");
@@ -101,6 +127,11 @@ int main()
101127
return 1;
102128
}
103129
#endif
130+
131+
#if (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
132+
inject_entropy_for_psa();
133+
#endif
134+
104135
ret = (Harness::run(specification) ? 0 : 1);
105136
#if defined(MBEDTLS_PLATFORM_C)
106137
mbedtls_platform_teardown(NULL);
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/* Copyright (c) 2017-2018 ARM Limited
2+
*
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/***********************************************************************************************************************
19+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
20+
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
21+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
22+
* Template Version 1.0
23+
* Generated by tools/spm/generate_partition_code.py Version 1.0
24+
**********************************************************************************************************************/
25+
26+
#include "spm_panic.h"
27+
#include "spm_internal.h"
28+
#include "handles_manager.h"
29+
#include "cmsis.h"
30+
#include "psa_crypto_srv_partition.h"
31+
#include "psa_its_partition.h"
32+
33+
extern const uint32_t crypto_srv_external_sids[4];
34+
35+
spm_partition_t g_partitions[2] = {
36+
{
37+
.partition_id = CRYPTO_SRV_ID,
38+
.thread_id = 0,
39+
.flags_rot_srv = CRYPTO_SRV_WAIT_ANY_SID_MSK,
40+
.flags_interrupts = 0,
41+
.rot_services = NULL,
42+
.rot_services_count = CRYPTO_SRV_ROT_SRV_COUNT,
43+
.extern_sids = crypto_srv_external_sids,
44+
.extern_sids_count = CRYPTO_SRV_EXT_ROT_SRV_COUNT,
45+
.irq_mapper = NULL,
46+
},
47+
{
48+
.partition_id = ITS_ID,
49+
.thread_id = 0,
50+
.flags_rot_srv = ITS_WAIT_ANY_SID_MSK,
51+
.flags_interrupts = 0,
52+
.rot_services = NULL,
53+
.rot_services_count = ITS_ROT_SRV_COUNT,
54+
.extern_sids = NULL,
55+
.extern_sids_count = ITS_EXT_ROT_SRV_COUNT,
56+
.irq_mapper = NULL,
57+
},
58+
};
59+
60+
/* Check all the defined memory regions for overlapping. */
61+
62+
/* A list of all the memory regions. */
63+
const mem_region_t *mem_regions = NULL;
64+
65+
const uint32_t mem_region_count = 0;
66+
67+
// forward declaration of partition initializers
68+
void crypto_srv_init(spm_partition_t *partition);
69+
void its_init(spm_partition_t *partition);
70+
71+
uint32_t init_partitions(spm_partition_t **partitions)
72+
{
73+
if (NULL == partitions) {
74+
SPM_PANIC("partitions is NULL!\n");
75+
}
76+
77+
crypto_srv_init(&(g_partitions[0]));
78+
its_init(&(g_partitions[1]));
79+
80+
*partitions = g_partitions;
81+
return 2;
82+
}
83+

0 commit comments

Comments
 (0)