Mistake on this page?
Report an issue in GitHub or email us
spm_client.h
1 /* Copyright (c) 2017-2018 ARM Limited
2  *
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __MBED_SPM_CLIENT_H__
19 #define __MBED_SPM_CLIENT_H__
20 
21 /** @addtogroup SPM
22  * The Secure Partition Manager (SPM) is responsible for isolating software in partitions,@n
23  * managing the execution of software within partitions and providing IPC between partitions.
24  * @{
25  */
26 
27 /* -------------------------------------- Includes ----------------------------------- */
28 
29 #include "psa_defs.h"
30 
31 /* --------------------------------- extern "C" wrapper ------------------------------ */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** @addtogroup Client-API
38  * The C interface for connecting to a Root of Trust Service and calling it.@n
39  * All functions are blocking.
40  * @{
41  */
42 
43 /**
44  * Retrieve the version of the PSA Framework API that is implemented.
45  *
46  * @note The PSA Framework API version is made of the major and minor versions as follows:
47  * @code
48  * ((major_version << 8) | minor_version)
49  * @endcode
50  * @return The PSA Framework API version
51  */
52 uint32_t psa_framework_version(void);
53 
54 /**
55  * Retrieve the minor version of a Root of Trust Service by its SID.
56  *
57  * @param[in] sid The Root of Trust Service ID
58  * @return Minor version of Root of Trust Service or PSA_VERSION_NONE if Root of Trust Service is not present on the system.
59  */
60 uint32_t psa_version(uint32_t sid);
61 
62 /**
63  * Connect to a Root of Trust Service by its SID.
64  *
65  * @note A minor version number must be provided to allow the Root of Trust Service to handle minor variations of the protocol.
66  *
67  * @param[in] sid The Root of Trust Service ID.
68  * @param[in] minor_version The minor version to be used for this connection.
69  * @return A handle for the connection if greater than 0, else:@n
70  * @a PSA_CONNECTION_REFUSED if the Root of Trust Service cannot handle any more connections.@n
71  */
72 psa_handle_t psa_connect(uint32_t sid, uint32_t minor_version);
73 
74 /**
75  * Call a connected Root of Trust Service.@n
76  * The caller must provide an array of ::psa_invec structures as the input payload.
77  *
78  * @param[in] handle Handle for the connection.
79  * @param[in] in_vec Array of ::psa_invec structures.
80  * @param[in] in_len Number of ::psa_invec structures in in_vec. (At most ::PSA_MAX_IOVEC - out_len)
81  * @param[out] out_vec Array of ::psa_outvec structures for optional Root of Trust Service response.
82  * @param[in] out_len Number of ::psa_outvec structures in out_vec. (At most ::PSA_MAX_IOVEC - in_len)
83  * @return 0 for success or@n
84  * @a positive numbers for application-specific return code.
85  * @a negative numbers for application-specific error code.
86  * @a PSA_DROP_CONNECTION if the connection has been dropped by the RoT Service.
87  */
88 psa_status_t psa_call(
89  psa_handle_t handle,
90  const psa_invec *in_vec,
91  size_t in_len,
92  const psa_outvec *out_vec,
93  size_t out_len
94 );
95 
96 /**
97  * Close a connection to a Root of Trust Service.
98  * Sends the ::PSA_IPC_DISCONNECT message to the Root of Trust Service, so it can clean up resources.
99  *
100  * @param[in] handle Handle for the connection.
101  */
102 void psa_close(psa_handle_t handle);
103 
104 /** @}*/ // end of Client-API group
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 /** @}*/ // end of SPM group
111 
112 #endif /* __MBED_SPM_CLIENT_H__ */
uint32_t psa_framework_version(void)
Retrieve the version of the PSA Framework API that is implemented.
psa_status_t psa_call(psa_handle_t handle, const psa_invec *in_vec, size_t in_len, const psa_outvec *out_vec, size_t out_len)
Call a connected Root of Trust Service.
psa_handle_t psa_connect(uint32_t sid, uint32_t minor_version)
Connect to a Root of Trust Service by its SID.
Structure which describes a scatter-gather output buffer.
Definition: client.h:54
Structure that describes a scatter-gather input buffer.
Definition: client.h:48
void psa_close(psa_handle_t handle)
Close a connection to a Root of Trust Service.
uint32_t psa_version(uint32_t sid)
Retrieve the minor version of a Root of Trust Service by its SID.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.