Skip to content

Commit 78d6018

Browse files
author
Cruz Monrreal
authored
Merge pull request #8745 from kfnta/feature-new-target-future-sequana-psa
Add new target future sequana PSA
2 parents 8301325 + c4c21d2 commit 78d6018

File tree

39 files changed

+37740
-32
lines changed

39 files changed

+37740
-32
lines changed

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);

TESTS/psa/crypto_init/TARGET_FUTURE_SEQUANA_PSA/crypto_init.hex

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

TESTS/psa/entropy_inject/TARGET_FUTURE_SEQUANA_PSA/entropy_inject.hex

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

TESTS/psa/prot_internal_storage/TARGET_FUTURE_SEQUANA_PSA/prot_internal_storage.hex

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

TESTS/psa/spm_client/TARGET_FUTURE_SEQUANA_PSA/spm_client.hex

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

0 commit comments

Comments
 (0)