TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_psa_ns_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include "psa/client.h"
9 #include "tfm_ns_interface.h"
10 #include "tfm_api.h"
11 
12 /**** API functions ****/
13 
14 uint32_t psa_framework_version(void)
15 {
18  0,
19  0,
20  0,
21  0);
22 }
23 
24 uint32_t psa_version(uint32_t sid)
25 {
28  sid,
29  0,
30  0,
31  0);
32 }
33 
34 psa_handle_t psa_connect(uint32_t sid, uint32_t version)
35 {
38  sid,
39  version,
40  0,
41  0);
42 }
43 
44 psa_status_t psa_call(psa_handle_t handle, int32_t type,
45  const psa_invec *in_vec,
46  size_t in_len,
47  psa_outvec *out_vec,
48  size_t out_len)
49 {
50  /* FixMe: sanity check can be added to offload some NS thread checks from
51  * TFM secure API
52  */
53 
54  /* Due to v8M restrictions, TF-M NS API needs to add another layer of
55  * serialization in order for NS to pass arguments to S
56  */
57  const struct tfm_control_parameter_t ctrl_param = {
58  .type = type,
59  .in_len = in_len,
60  .out_len = out_len,
61  };
62 
65  (uint32_t)handle,
66  (uint32_t)&ctrl_param,
67  (uint32_t)in_vec,
68  (uint32_t)out_vec);
69 }
70 
71 void psa_close(psa_handle_t handle)
72 {
75  (uint32_t)handle,
76  0,
77  0,
78  0);
79 }
uint32_t tfm_psa_version_veneer(uint32_t sid)
Return version of secure function provided by secure binary.
int32_t(* veneer_fn)(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint32_t arg3)
void tfm_psa_close_veneer(psa_handle_t handle)
Close connection to secure function referenced by a connection handle.
int32_t tfm_ns_interface_dispatch(veneer_fn fn, uint32_t arg0, uint32_t arg1, uint32_t arg2, uint32_t arg3)
NS interface, veneer function dispatcher.
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.
psa_handle_t psa_connect(uint32_t sid, uint32_t version)
Connect to an RoT Service by its SID.
uint32_t psa_version(uint32_t sid)
Retrieve the version of an RoT Service or indicate that it is not present on this system...
psa_status_t tfm_psa_call_veneer(psa_handle_t handle, const struct tfm_control_parameter_t *ctrl_param, const psa_invec *in_vec, psa_outvec *out_vec)
Call a secure function referenced by a connection handle.
void psa_close(psa_handle_t handle)
Close a connection to an RoT Service.
uint32_t psa_framework_version(void)
Retrieve the version of the PSA Framework API that is implemented.
psa_handle_t tfm_psa_connect_veneer(uint32_t sid, uint32_t version)
Connect to secure function.
uint32_t tfm_psa_framework_version_veneer(void)
Retrieve the version of the PSA Framework API that is implemented.
int32_t psa_handle_t
Definition: client.h:61
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:43