blob: 24c4036f4dea40c62e4e5c902efc8be84b1ba5c2 [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
Summer Qin484513b2022-10-09 17:40:24 +08002 * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
Ashutosh Singhf4d88672017-11-29 13:35:43 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
Kevin Peng0e340ea2023-08-15 17:51:44 +08008#ifndef __TFM_VENEERS_H__
9#define __TFM_VENEERS_H__
Ashutosh Singhf4d88672017-11-29 13:35:43 +000010
Mate Toth-Palce61afa2018-08-03 13:51:01 +020011#include <stdint.h>
Jamie Foxcc31d402019-01-28 17:13:52 +000012#include "psa/client.h"
Miklos Balintbf25a402018-06-14 17:43:54 +020013
Kevin Peng0e340ea2023-08-15 17:51:44 +080014#ifdef __cplusplus
15extern "C" {
16#endif
Ashutosh Singhf4d88672017-11-29 13:35:43 +000017
Summer Qin40db9ea2019-11-20 15:28:04 +080018/********************* Secure function declarations ***************************/
Ashutosh Singhf4d88672017-11-29 13:35:43 +000019
Mate Toth-Palce61afa2018-08-03 13:51:01 +020020/**
Summer Qin40db9ea2019-11-20 15:28:04 +080021 * \brief Retrieve the version of the PSA Framework API that is implemented.
Edison Aib3e56962018-09-04 19:12:31 +080022 *
Summer Qin40db9ea2019-11-20 15:28:04 +080023 * \return The version of the PSA Framework.
Edison Aib3e56962018-09-04 19:12:31 +080024 */
25uint32_t tfm_psa_framework_version_veneer(void);
26
27/**
Summer Qin40db9ea2019-11-20 15:28:04 +080028 * \brief Return version of secure function provided by secure binary.
Miklos Balint87da2512018-04-19 13:45:50 +020029 *
Summer Qin40db9ea2019-11-20 15:28:04 +080030 * \param[in] sid ID of secure service.
Miklos Balint87da2512018-04-19 13:45:50 +020031 *
Summer Qin40db9ea2019-11-20 15:28:04 +080032 * \return Version number of secure function.
Miklos Balint87da2512018-04-19 13:45:50 +020033 */
34uint32_t tfm_psa_version_veneer(uint32_t sid);
35
36/**
Summer Qin40db9ea2019-11-20 15:28:04 +080037 * \brief Connect to secure function.
Miklos Balint87da2512018-04-19 13:45:50 +020038 *
Summer Qin40db9ea2019-11-20 15:28:04 +080039 * \param[in] sid ID of secure service.
40 * \param[in] version Version of SF requested by client.
Miklos Balint87da2512018-04-19 13:45:50 +020041 *
Summer Qin40db9ea2019-11-20 15:28:04 +080042 * \return Returns handle to connection.
Miklos Balint87da2512018-04-19 13:45:50 +020043 */
Summer Qin4b1d03b2019-07-02 14:56:08 +080044psa_handle_t tfm_psa_connect_veneer(uint32_t sid, uint32_t version);
Miklos Balint87da2512018-04-19 13:45:50 +020045
46/**
Summer Qin40db9ea2019-11-20 15:28:04 +080047 * \brief Call a secure function referenced by a connection handle.
Miklos Balint87da2512018-04-19 13:45:50 +020048 *
Summer Qin40db9ea2019-11-20 15:28:04 +080049 * \param[in] handle Handle to connection.
Xinyu Zhang99b069f2021-04-09 14:36:42 +080050 * \param[in] ctrl_param Parameters combined in uint32_t,
51 * includes request type, in_num and out_num.
Summer Qin40db9ea2019-11-20 15:28:04 +080052 * \param[in] in_vec Array of input \ref psa_invec structures.
Shawn Shan7ef79ec2021-01-21 10:28:18 +080053 * \param[in,out] out_vec Array of output \ref psa_outvec structures.
Miklos Balint87da2512018-04-19 13:45:50 +020054 *
Summer Qin40db9ea2019-11-20 15:28:04 +080055 * \return Returns \ref psa_status_t status code.
Miklos Balint87da2512018-04-19 13:45:50 +020056 */
Summer Qin83ac1ca2019-09-29 18:33:28 +080057psa_status_t tfm_psa_call_veneer(psa_handle_t handle,
Xinyu Zhang99b069f2021-04-09 14:36:42 +080058 uint32_t ctrl_param,
59 const psa_invec *in_vec,
60 psa_outvec *out_vec);
Miklos Balint87da2512018-04-19 13:45:50 +020061
62/**
Summer Qin40db9ea2019-11-20 15:28:04 +080063 * \brief Close connection to secure function referenced by a connection handle.
Miklos Balint87da2512018-04-19 13:45:50 +020064 *
Summer Qin40db9ea2019-11-20 15:28:04 +080065 * \param[in] handle Handle to connection
Miklos Balint87da2512018-04-19 13:45:50 +020066 */
Summer Qin483da642019-09-25 17:57:41 +080067void tfm_psa_close_veneer(psa_handle_t handle);
Miklos Balint87da2512018-04-19 13:45:50 +020068
Summer Qin40db9ea2019-11-20 15:28:04 +080069/***************** End Secure function declarations ***************************/
Ashutosh Singhf4d88672017-11-29 13:35:43 +000070
71#ifdef __cplusplus
72}
73#endif
74
Kevin Peng0e340ea2023-08-15 17:51:44 +080075#endif /* __TFM_VENEERS_H__ */