TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
client.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __PSA_CLIENT_H__
9 #define __PSA_CLIENT_H__
10 
11 #include <stddef.h>
12 #include <stdint.h>
13 
14 #include "psa/error.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /*********************** PSA Client Macros and Types *************************/
21 
26 #define PSA_FRAMEWORK_VERSION (0x0100u)
27 
32 #define PSA_VERSION_NONE (0u)
33 
38 #define PSA_NULL_HANDLE ((psa_handle_t)0)
39 
43 #define PSA_HANDLE_IS_VALID(handle) ((psa_handle_t)(handle) > 0)
44 
49 #define PSA_HANDLE_TO_ERROR(handle) ((psa_status_t)(handle))
50 
54 #define PSA_MAX_IOVEC (4u)
55 
59 #define PSA_IPC_CALL (0)
60 
61 typedef int32_t psa_handle_t;
62 
66 typedef struct psa_invec {
67  const void *base;
68  size_t len;
69 } psa_invec;
70 
74 typedef struct psa_outvec {
75  void *base;
76  size_t len;
77 } psa_outvec;
78 
79 /*************************** PSA Client API **********************************/
80 
91 uint32_t psa_framework_version(void);
92 
103 uint32_t psa_version(uint32_t sid);
104 
123 psa_handle_t psa_connect(uint32_t sid, uint32_t version);
124 
149 psa_status_t psa_call(psa_handle_t handle, int32_t type,
150  const psa_invec *in_vec,
151  size_t in_len,
152  psa_outvec *out_vec,
153  size_t out_len);
154 
169 void psa_close(psa_handle_t handle);
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 #endif /* __PSA_CLIENT_H__ */
void * base
Definition: client.h:75
struct psa_invec psa_invec
size_t len
Definition: client.h:68
void psa_close(psa_handle_t handle)
Close a connection to an RoT Service.
Definition: psa_client.c:63
Standard error codes for the SPM and RoT Services.
uint32_t psa_framework_version(void)
Retrieve the version of the PSA Framework API that is implemented.
Definition: psa_client.c:14
psa_handle_t psa_connect(uint32_t sid, uint32_t version)
Connect to an RoT Service by its SID.
Definition: psa_client.c:30
struct psa_outvec psa_outvec
size_t len
Definition: client.h:76
int32_t psa_handle_t
Definition: client.h:61
uint32_t psa_version(uint32_t sid)
Retrieve the version of an RoT Service or indicate that it is not present on this system...
Definition: psa_client.c:22
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