1 /*
2  * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __TFM_VENEERS_H__
9 #define __TFM_VENEERS_H__
10 
11 #include <stdint.h>
12 #include "psa/client.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /********************* Secure function declarations ***************************/
19 
20 /**
21  * \brief Retrieve the version of the PSA Framework API that is implemented.
22  *
23  * \return The version of the PSA Framework.
24  */
25 uint32_t tfm_psa_framework_version_veneer(void);
26 
27 /**
28  * \brief Return version of secure function provided by secure binary.
29  *
30  * \param[in] sid               ID of secure service.
31  *
32  * \return Version number of secure function.
33  */
34 uint32_t tfm_psa_version_veneer(uint32_t sid);
35 
36 /**
37  * \brief Connect to secure function.
38  *
39  * \param[in] sid               ID of secure service.
40  * \param[in] version           Version of SF requested by client.
41  *
42  * \return Returns handle to connection.
43  */
44 psa_handle_t tfm_psa_connect_veneer(uint32_t sid, uint32_t version);
45 
46 /**
47  * \brief Call a secure function referenced by a connection handle.
48  *
49  * \param[in] handle            Handle to connection.
50  * \param[in] ctrl_param        Parameters combined in uint32_t,
51  *                              includes request type, in_num and out_num.
52  * \param[in] in_vec            Array of input \ref psa_invec structures.
53  * \param[in,out] out_vec       Array of output \ref psa_outvec structures.
54  *
55  * \return Returns \ref psa_status_t status code.
56  */
57 psa_status_t tfm_psa_call_veneer(psa_handle_t handle,
58                                  uint32_t ctrl_param,
59                                  const psa_invec *in_vec,
60                                  psa_outvec *out_vec);
61 
62 /**
63  * \brief Close connection to secure function referenced by a connection handle.
64  *
65  * \param[in] handle            Handle to connection
66  */
67 void tfm_psa_close_veneer(psa_handle_t handle);
68 
69 /***************** End Secure function declarations ***************************/
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* __TFM_VENEERS_H__ */
76