Skip to content

Commit b62c489

Browse files
Michael SchwarczOren Cohen
authored andcommitted
Review fixes
1 parent 20d7f81 commit b62c489

File tree

21 files changed

+86
-167
lines changed

21 files changed

+86
-167
lines changed

TESTS/psa/spm_client/COMPONENT_NSPE/main.cpp

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@
2424
#include "unity.h"
2525
#include "utest.h"
2626
#include "psa/client.h"
27-
28-
#ifndef USE_PSA_TEST_PARTITIONS
29-
#define USE_PSA_TEST_PARTITIONS
30-
#endif
31-
#ifndef USE_CLIENT_TESTS_PART1
32-
#define USE_CLIENT_TESTS_PART1
33-
#endif
3427
#include "psa_manifest/sid.h"
3528

3629
#if defined(TARGET_TFM)
@@ -105,7 +98,7 @@ static void client_ipc_tests_close(psa_handle_t handle)
10598
//Testing iovec 0 sent as NULL
10699
void iovec_0_NULL()
107100
{
108-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
101+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
109102

110103
uint8_t expect_size = 5;
111104
uint8_t off = 2;
@@ -128,7 +121,7 @@ void iovec_0_NULL()
128121
//Testing iovec 1 sent as NULL
129122
void iovec_1_NULL()
130123
{
131-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
124+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
132125

133126
uint8_t expect_size = 2;
134127
uint8_t off = 3;
@@ -150,7 +143,7 @@ void iovec_1_NULL()
150143
//Testing iovec 2 sent as NULL
151144
void iovec_2_NULL()
152145
{
153-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
146+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
154147

155148
uint8_t expect_size = 2;
156149
uint8_t off = 3;
@@ -175,7 +168,7 @@ void in_vec_base_not_NULL_size_0()
175168
uint8_t dummy_buff[] = {1, 2, 3, 4, 5};
176169
psa_invec iovec_temp[1] = { {dummy_buff, 0} };
177170

178-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
171+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
179172

180173
client_ipc_tests_call(handle, iovec_temp, 1, 0, NULL, 0);
181174

@@ -188,7 +181,7 @@ void in_len_0_in_vec_not_NULL()
188181
uint8_t dummy_buff[] = {1, 2, 3, 4, 5};
189182
psa_invec iovec_temp[1] = { {dummy_buff, sizeof(dummy_buff)} };
190183

191-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
184+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
192185

193186
client_ipc_tests_call(handle, iovec_temp, 0, 0, NULL, 0);
194187

@@ -205,7 +198,7 @@ void out_len_0_outvec_not_NULL()
205198

206199
uint8_t dummy_buff[] = {1, 2, 3, 4, 5};
207200

208-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
201+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
209202

210203
psa_invec in_vec_temp[2] = { {dummy_buff, sizeof(dummy_buff)},
211204
{dummy_buff, sizeof(dummy_buff)}
@@ -221,7 +214,7 @@ void out_len_0_outvec_not_NULL()
221214
//Testing rx_buff sent as NULL and rx_len as 0
222215
void rx_buff_null()
223216
{
224-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
217+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
225218

226219
uint8_t expect_size = 0, off = 2;
227220

@@ -241,7 +234,7 @@ void rx_buff_null()
241234
//Testing tx_buff sent as NULL and tx_len as 0
242235
void tx_buff_null()
243236
{
244-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
237+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
245238

246239
client_ipc_tests_call(handle, NULL, 0, CLIENT_RSP_BUF_SIZE, NULL, 0);
247240

@@ -251,7 +244,7 @@ void tx_buff_null()
251244
//Testing rx_buff and tx_null sent as NULL and rx_len and tx_len as 0
252245
void rx_tx_null()
253246
{
254-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
247+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
255248

256249
client_ipc_tests_call(handle, NULL, 0, 0, NULL, 0);
257250

@@ -261,7 +254,7 @@ void rx_tx_null()
261254
//Testing multiple subsequent calls to the same SID
262255
void multiple_call()
263256
{
264-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
257+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
265258

266259
uint8_t expect_size = 2, off = 2;
267260

@@ -304,7 +297,7 @@ static void set_struct(th_struct_t *thr_attr, psa_handle_t handle, psa_invec *io
304297

305298
static void call_diff_handle(th_struct_t *thr_attr)
306299
{
307-
psa_handle_t handle = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
300+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
308301

309302
client_ipc_tests_call(handle,
310303
thr_attr->iovec_temp,
@@ -400,9 +393,9 @@ void exceed_num_of_max_channels()
400393

401394
for (i = 0; i < MBED_CONF_SPM_IPC_MAX_NUM_OF_CHANNELS + 1; i++) {
402395
if (i != MBED_CONF_SPM_IPC_MAX_NUM_OF_CHANNELS) {
403-
handle[i] = client_ipc_tests_connect(PART1_ROT_SRV1, MINOR_VER);
396+
handle[i] = client_ipc_tests_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
404397
} else {
405-
handle[i] = psa_connect(PART1_ROT_SRV1, MINOR_VER);
398+
handle[i] = psa_connect(CLIENT_TESTS_PART1_ROT_SRV1, MINOR_VER);
406399
TEST_ASSERT_EQUAL_INT32(PSA_CONNECTION_REFUSED, handle[i]);
407400
}
408401
}
@@ -419,7 +412,7 @@ void client_close_null_handle()
419412

420413
void drop_connection()
421414
{
422-
psa_handle_t handle = client_ipc_tests_connect(DROP_CONN, DROP_CONN_MINOR_VER);
415+
psa_handle_t handle = client_ipc_tests_connect(CLIENT_TESTS_PART1_DROP_CONN, DROP_CONN_MINOR_VER);
423416
psa_status_t status = psa_call(handle, NULL, 0, NULL, 0);
424417
TEST_ASSERT_EQUAL_INT(PSA_DROP_CONNECTION, status);
425418

@@ -438,7 +431,7 @@ void verify_psa_framework_version()
438431

439432
void psa_version_existing()
440433
{
441-
uint32_t rot_version = psa_version(DROP_CONN);
434+
uint32_t rot_version = psa_version(CLIENT_TESTS_PART1_DROP_CONN);
442435
TEST_ASSERT_EQUAL_INT(DROP_CONN_MINOR_VER, rot_version);
443436
}
444437

@@ -450,7 +443,7 @@ void psa_version_non_existing()
450443

451444
void psa_version_secure_access_only()
452445
{
453-
uint32_t rot_version = psa_version(SECURE_CLIENTS_ONLY);
446+
uint32_t rot_version = psa_version(CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY);
454447
TEST_ASSERT_EQUAL_INT(PSA_VERSION_NONE, rot_version);
455448
}
456449

TESTS/psa/spm_client/TARGET_MBED_SPM/COMPONENT_SPE/psa_client_tests_part1_partition.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@
2929
#include "spm_panic.h"
3030
#include "spm_internal.h"
3131
#include "psa_client_tests_part1_partition.h"
32-
33-
#ifndef USE_PSA_TEST_PARTITIONS
34-
#define USE_PSA_TEST_PARTITIONS
35-
#endif
36-
#ifndef USE_CLIENT_TESTS_PART1
37-
#define USE_CLIENT_TESTS_PART1
38-
#endif
3932
#include "psa_manifest/sid.h"
4033

4134

@@ -60,7 +53,7 @@ osThreadAttr_t client_tests_part1_thread_attr = {
6053

6154
spm_rot_service_t client_tests_part1_rot_services[CLIENT_TESTS_PART1_ROT_SRV_COUNT] = {
6255
{
63-
.sid = PART1_ROT_SRV1,
56+
.sid = CLIENT_TESTS_PART1_ROT_SRV1,
6457
.mask = PART1_ROT_SRV1_MSK,
6558
.partition = NULL,
6659
.min_version = 5,
@@ -72,7 +65,7 @@ spm_rot_service_t client_tests_part1_rot_services[CLIENT_TESTS_PART1_ROT_SRV_COU
7265
}
7366
},
7467
{
75-
.sid = DROP_CONN,
68+
.sid = CLIENT_TESTS_PART1_DROP_CONN,
7669
.mask = DROP_CONN_MSK,
7770
.partition = NULL,
7871
.min_version = 5,
@@ -84,7 +77,7 @@ spm_rot_service_t client_tests_part1_rot_services[CLIENT_TESTS_PART1_ROT_SRV_COU
8477
}
8578
},
8679
{
87-
.sid = SECURE_CLIENTS_ONLY,
80+
.sid = CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY,
8881
.mask = SECURE_CLIENTS_ONLY_MSK,
8982
.partition = NULL,
9083
.min_version = 5,

TESTS/psa/spm_client/client_tests_part1_psa.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
"stack_size": "0x400",
88
"heap_size": "0x400",
99
"services": [{
10-
"name": "PART1_ROT_SRV1",
10+
"name": "CLIENT_TESTS_PART1_ROT_SRV1",
1111
"identifier": "0x00001A05",
1212
"signal": "PART1_ROT_SRV1_MSK",
1313
"non_secure_clients": true,
1414
"minor_version": 5,
1515
"minor_policy": "RELAXED"
1616
},
1717
{
18-
"name": "DROP_CONN",
18+
"name": "CLIENT_TESTS_PART1_DROP_CONN",
1919
"identifier": "0x00001A06",
2020
"signal": "DROP_CONN_MSK",
2121
"non_secure_clients": true,
2222
"minor_version": 5,
2323
"minor_policy": "RELAXED"
2424
},
2525
{
26-
"name": "SECURE_CLIENTS_ONLY",
26+
"name": "CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY",
2727
"identifier": "0x00001A07",
2828
"signal": "SECURE_CLIENTS_ONLY_MSK",
2929
"non_secure_clients": false,

TESTS/psa/spm_client/psa_client_tests_part1_ifs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#ifndef PSA_CLIENT_TESTS_PART1_PARTITION_ROT_SERVICES_H
2727
#define PSA_CLIENT_TESTS_PART1_PARTITION_ROT_SERVICES_H
2828

29-
#define PART1_ROT_SRV1 0x00001A05
30-
#define DROP_CONN 0x00001A06
31-
#define SECURE_CLIENTS_ONLY 0x00001A07
29+
#define CLIENT_TESTS_PART1_ROT_SRV1 0x00001A05
30+
#define CLIENT_TESTS_PART1_DROP_CONN 0x00001A06
31+
#define CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY 0x00001A07
3232

3333
#endif // PSA_CLIENT_TESTS_PART1_PARTITION_ROT_SERVICES_H

TESTS/psa/spm_server/COMPONENT_NSPE/main.cpp

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@
2525
#include "utest.h"
2626
#include "psa/client.h"
2727
#include "server_tests.h"
28-
29-
#ifndef USE_PSA_TEST_PARTITIONS
30-
#define USE_PSA_TEST_PARTITIONS
31-
#endif
32-
#ifndef USE_SERVER_TESTS_PART1
33-
#define USE_SERVER_TESTS_PART1
34-
#endif
35-
#ifndef USE_SERVER_TESTS_PART2
36-
#define USE_SERVER_TESTS_PART2
37-
#endif
3828
#include "psa_manifest/sid.h"
3929

4030
#if defined(TARGET_TFM)
@@ -53,7 +43,7 @@ char cross_part_buf[] = "Hello and welcome SPM";
5343

5444
PSA_TEST_CLIENT(identity_during_connect)
5545
{
56-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
46+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
5747
TEST_ASSERT(test_handle > 0);
5848

5949
psa_close(test_handle);
@@ -63,7 +53,7 @@ PSA_TEST_CLIENT(identity_during_connect)
6353
PSA_TEST_CLIENT(identity_during_call)
6454
{
6555
psa_status_t status = PSA_SUCCESS;
66-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
56+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
6757
TEST_ASSERT(test_handle > 0);
6858

6959
status = psa_call(test_handle, NULL, 0, NULL, 0);
@@ -81,7 +71,7 @@ PSA_TEST_CLIENT(msg_size_assertion)
8171
{test_str + 13, 1},
8272
{NULL, 0}
8373
};
84-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
74+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
8575
TEST_ASSERT(test_handle > 0);
8676

8777
status = psa_call(test_handle, data, PSA_MAX_IOVEC, NULL, 0);
@@ -92,15 +82,15 @@ PSA_TEST_CLIENT(msg_size_assertion)
9282

9383
PSA_TEST_CLIENT(reject_connection)
9484
{
95-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
85+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
9686
TEST_ASSERT_EQUAL(PSA_CONNECTION_REFUSED, test_handle);
9787
}
9888

9989
PSA_TEST_CLIENT(read_at_outofboud_offset)
10090
{
10191
psa_status_t status = PSA_SUCCESS;
10292
psa_invec data = { test_str, sizeof(test_str) };
103-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
93+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
10494
TEST_ASSERT(test_handle > 0);
10595

10696
status = psa_call(test_handle, &data, 1, NULL, 0);
@@ -117,7 +107,7 @@ PSA_TEST_CLIENT(msg_read_truncation)
117107
{test_str + 5, 6},
118108
{test_str + 13, 1}
119109
};
120-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
110+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
121111
TEST_ASSERT(test_handle > 0);
122112

123113
status = psa_call(test_handle, data, 3, NULL, 0);
@@ -130,7 +120,7 @@ PSA_TEST_CLIENT(skip_zero)
130120
{
131121
psa_status_t status = PSA_SUCCESS;
132122
psa_invec data = { test_str, sizeof(test_str) };
133-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
123+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
134124
TEST_ASSERT(test_handle > 0);
135125

136126
status = psa_call(test_handle, &data, 1, NULL, 0);
@@ -143,7 +133,7 @@ PSA_TEST_CLIENT(skip_some)
143133
{
144134
psa_status_t status = PSA_SUCCESS;
145135
psa_invec data = { test_str, sizeof(test_str) };
146-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
136+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
147137
TEST_ASSERT(test_handle > 0);
148138

149139
status = psa_call(test_handle, &data, 1, NULL, 0);
@@ -156,7 +146,7 @@ PSA_TEST_CLIENT(skip_more_than_left)
156146
{
157147
psa_status_t status = PSA_SUCCESS;
158148
psa_invec data = { test_str, 8 };
159-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
149+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
160150
TEST_ASSERT(test_handle > 0);
161151

162152
status = psa_call(test_handle, &data, 1, NULL, 0);
@@ -171,7 +161,7 @@ PSA_TEST_CLIENT(rhandle_factorial)
171161
uint32_t value = 1;
172162
psa_status_t status = PSA_SUCCESS;
173163
psa_outvec resp = { &secure_value, sizeof(secure_value) };
174-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
164+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
175165
TEST_ASSERT(test_handle > 0);
176166

177167
for (uint32_t i = 1; i <= 5; i++) {
@@ -186,7 +176,7 @@ PSA_TEST_CLIENT(rhandle_factorial)
186176

187177
PSA_TEST_CLIENT(cross_partition_call)
188178
{
189-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
179+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
190180
size_t in_len = strlen(cross_part_buf);
191181
TEST_ASSERT_MESSAGE(test_handle > 0, "psa_connect() failed");
192182

@@ -206,7 +196,7 @@ PSA_TEST_CLIENT(cross_partition_call)
206196
// Test a common DOORBELL scenario
207197
PSA_TEST_CLIENT(doorbell_test)
208198
{
209-
psa_handle_t test_handle = psa_connect(TEST, TEST_ROT_SRV_MINOR);
199+
psa_handle_t test_handle = psa_connect(SERVER_TESTS_PART1_TEST, TEST_ROT_SRV_MINOR);
210200
TEST_ASSERT_MESSAGE(test_handle > 0, "psa_connect() failed");
211201

212202
psa_status_t status = psa_call(test_handle, NULL, 0, NULL, 0);
@@ -218,9 +208,9 @@ PSA_TEST_CLIENT(doorbell_test)
218208

219209
utest::v1::status_t spm_setup(const size_t number_of_cases)
220210
{
221-
control_handle = psa_connect(CONTROL, 0);
211+
control_handle = psa_connect(SERVER_TESTS_PART1_CONTROL, 0);
222212
if (control_handle < 0) {
223-
error("Could not open a connection with CONTROL ROT_SRV");
213+
error("Could not open a connection with SERVER_TESTS_PART1_CONTROL ROT_SRV");
224214
}
225215

226216
#ifndef NO_GREENTEA

TESTS/psa/spm_server/COMPONENT_SPE/server_tests_partition1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void server_part1_main(void *ptr)
5656
switch (msg.type) {
5757
case PSA_IPC_CALL:
5858
if (msg.in_size[0] == 0) {
59-
SPM_PANIC("got a zero message size to CONTROL ROT_SRV\n");
59+
SPM_PANIC("got a zero message size to SERVER_TESTS_PART1_CONTROL ROT_SRV\n");
6060
}
6161

6262
if (psa_read(msg.handle, 0, &action, sizeof(action)) != sizeof(action)) {

0 commit comments

Comments
 (0)