11/*
2- * Copyright (c) 2019,2020 Linaro Limited
2+ * Copyright (c) 2019,2020, 2021 Linaro Limited
33 *
44 * SPDX-License-Identifier: Apache-2.0
55 */
2121 * mean to test all possible combinations of
2222 * input parameters and return values.
2323 */
24- static void tfm_ipc_test_1001 (void )
24+ static void tfm_ipc_test_01 (void )
2525{
2626 uint32_t version ;
2727
@@ -40,11 +40,11 @@ static void tfm_ipc_test_1001(void)
4040 *
4141 * @return N/A
4242 */
43- static void tfm_ipc_test_1002 (void )
43+ static void tfm_ipc_test_02 (void )
4444{
4545 uint32_t version ;
4646
47- version = psa_version (IPC_SERVICE_TEST_BASIC_SID );
47+ version = psa_version (TFM_CRYPTO_SID );
4848 if (version == PSA_VERSION_NONE ) {
4949 printk ("RoT Service is not implemented or caller is not " );
5050 printk ("authorized to access it!\n" );
@@ -60,12 +60,12 @@ static void tfm_ipc_test_1002(void)
6060 *
6161 * @return N/A
6262 */
63- static void tfm_ipc_test_1003 (void )
63+ static void tfm_ipc_test_03 (void )
6464{
6565 psa_handle_t handle ;
6666
67- handle = psa_connect (IPC_SERVICE_TEST_BASIC_SID ,
68- IPC_SERVICE_TEST_BASIC_VERSION );
67+ handle = psa_connect (TFM_CRYPTO_SID ,
68+ TFM_CRYPTO_VERSION );
6969 if (handle > 0 ) {
7070 printk ("Connect success!\n" );
7171 } else {
@@ -75,115 +75,11 @@ static void tfm_ipc_test_1003(void)
7575 psa_close (handle );
7676}
7777
78- /**
79- * Call a RoT Service.
80- *
81- * @return N/A
82- */
83- static void tfm_ipc_test_1004 (void )
84- {
85- char str1 [] = "str1" ;
86- char str2 [] = "str2" ;
87- char str3 [128 ], str4 [128 ];
88- struct psa_invec invecs [2 ] = { { str1 , sizeof (str1 ) /
89- sizeof (char ) },
90- { str2 , sizeof (str2 ) /
91- sizeof (char ) } };
92- struct psa_outvec outvecs [2 ] = { { str3 , sizeof (str3 ) /
93- sizeof (char ) },
94- { str4 , sizeof (str4 ) /
95- sizeof (char ) } };
96- psa_handle_t handle ;
97- psa_status_t status ;
98- uint32_t version ;
99-
100- version = psa_version (IPC_SERVICE_TEST_BASIC_SID );
101- printk ("TFM service support version is %d.\n" , version );
102- handle = psa_connect (IPC_SERVICE_TEST_BASIC_SID ,
103- IPC_SERVICE_TEST_BASIC_VERSION );
104- status = psa_call (handle , PSA_IPC_CALL , invecs , 2 , outvecs , 2 );
105- if (status >= 0 ) {
106- printk ("psa_call is successful!\n" );
107- } else {
108- printk ("psa_call is failed!\n" );
109- return ;
110- }
111-
112- printk ("outvec1 is: %s\n" , (char * )(outvecs [0 ].base ));
113- printk ("outvec2 is: %s\n" , (char * )(outvecs [1 ].base ));
114- psa_close (handle );
115- }
116-
117- /**
118- * \brief Call IPC_CLIENT_TEST_BASIC_SID RoT Service to run the IPC basic test.
119- */
120- static void tfm_ipc_test_1005 (void )
121- {
122- psa_handle_t handle ;
123- psa_status_t status ;
124- int test_result ;
125- struct psa_outvec outvecs [1 ] = { { & test_result ,
126- sizeof (test_result ) } };
127-
128- handle = psa_connect (IPC_CLIENT_TEST_BASIC_SID ,
129- IPC_CLIENT_TEST_BASIC_VERSION );
130- if (handle > 0 ) {
131- printk ("Connect success!\n" );
132- } else {
133- printk ("The RoT Service has refused the connection!\n" );
134- return ;
135- }
136-
137- status = psa_call (handle , PSA_IPC_CALL , NULL , 0 , outvecs , 1 );
138- if (status >= 0 ) {
139- printk ("Call success!\n" );
140- } else {
141- printk ("Call failed!\n" );
142- }
143-
144- psa_close (handle );
145- }
146-
147- /**
148- * \brief Call IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM_SID RoT Service
149- * to run the IPC PSA access APP mem test.
150- */
151- static void tfm_ipc_test_1006 (void )
152- {
153- psa_handle_t handle ;
154- psa_status_t status ;
155- int test_result ;
156- struct psa_outvec outvecs [1 ] = { { & test_result ,
157- sizeof (test_result ) } };
158-
159- handle = psa_connect (
160- IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM_SID ,
161- IPC_CLIENT_TEST_PSA_ACCESS_APP_MEM_VERSION );
162- if (handle > 0 ) {
163- printk ("Connect success!\n" );
164- } else {
165- printk ("The RoT Service has refused the connection!\n" );
166- return ;
167- }
168-
169- status = psa_call (handle , PSA_IPC_CALL , NULL , 0 , outvecs , 1 );
170- if (status >= 0 ) {
171- printk ("Call success!\n" );
172- } else {
173- printk ("Call failed!\n" );
174- }
175-
176- psa_close (handle );
177- }
178-
17978void main (void )
18079{
181- tfm_ipc_test_1001 ();
182- tfm_ipc_test_1002 ();
183- tfm_ipc_test_1003 ();
184- tfm_ipc_test_1004 ();
185- tfm_ipc_test_1005 ();
186- tfm_ipc_test_1006 ();
80+ tfm_ipc_test_01 ();
81+ tfm_ipc_test_02 ();
82+ tfm_ipc_test_03 ();
18783
18884 printk ("TF-M IPC on %s\n" , CONFIG_BOARD );
18985
0 commit comments