TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_secure_client_2_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
9 #include "psa/client.h"
10 
11 #ifdef TFM_PSA_API
12 #include "psa_manifest/sid.h"
13 #else
14 #include "tfm_veneers.h"
15 #endif
16 
17 __attribute__((section("SFN")))
18 psa_status_t tfm_secure_client_2_call_test(int32_t id, const void *arg,
19  size_t arg_len)
20 {
21 #ifdef TFM_PSA_API
22  psa_handle_t handle;
23  psa_status_t status;
24  psa_invec in_vec[] = {
25  { .base = arg, .len = arg_len },
26  };
27 
29  if (!PSA_HANDLE_IS_VALID(handle)) {
31  }
32 
33  /* Pass the ID through the type parameter of psa_call() */
34  status = psa_call(handle, id, in_vec, 1, NULL, 0);
35  psa_close(handle);
36 
37  return status;
38 #else
39  /* Pack the ID in the invec */
40  psa_invec in_vec[] = {
41  { .base = &id, .len = sizeof(id) },
42  { .base = arg, .len = arg_len },
43  };
44 
45  return tfm_tfm_secure_client_2_call_veneer(in_vec, 2, NULL, 0);
46 #endif
47 }
psa_status_t tfm_secure_client_2_call_test(int32_t id, const void *arg, size_t arg_len)
Calls the test function with the supplied ID within the execution context of the Secure Client 2 part...
void psa_close(psa_handle_t handle)
Close a connection to an RoT Service.
Definition: psa_client.c:63
#define TFM_SECURE_CLIENT_2_VERSION
Definition: sid.h:135
#define PSA_ERROR_GENERIC_ERROR
Definition: crypto_values.h:43
psa_handle_t psa_connect(uint32_t sid, uint32_t version)
Connect to an RoT Service by its SID.
Definition: psa_client.c:30
#define PSA_HANDLE_IS_VALID(handle)
Definition: client.h:43
#define TFM_SECURE_CLIENT_2_SID
Definition: sid.h:134
int32_t psa_handle_t
Definition: client.h:61
const void * base
Definition: client.h:67
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:43
psa_status_t psa_call(psa_handle_t handle, int32_t type, const psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Call an RoT Service on an established connection.
Definition: psa_client.c:47