Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
tee.h File Reference

Public APIs for the tee driver. More...

#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>
#include <zephyr/syscalls/tee.h>

Go to the source code of this file.

Data Structures

struct  tee_version_info
 TEE version. More...
 
struct  tee_open_session_arg
 
  • Open session argument
More...
 
struct  tee_param
 Tee parameter. More...
 
struct  tee_invoke_func_arg
 Invokes a function in a Trusted Application. More...
 
struct  tee_shm
 Tee shared memory structure. More...
 
struct  tee_driver_api
 

Macros

#define TEE_UUID_LEN   16
 
#define TEE_GEN_CAP_GP   BIT(0) /* GlobalPlatform compliant TEE */
 
#define TEE_GEN_CAP_PRIVILEGED   BIT(1) /* Privileged device (for supplicant) */
 
#define TEE_GEN_CAP_REG_MEM   BIT(2) /* Supports registering shared memory */
 
#define TEE_GEN_CAP_MEMREF_NULL   BIT(3) /* Support NULL MemRef */
 
#define TEE_SHM_REGISTER   BIT(0)
 
#define TEE_SHM_ALLOC   BIT(1)
 
#define TEE_PARAM_ATTR_TYPE_NONE   0 /* parameter not used */
 
#define TEE_PARAM_ATTR_TYPE_VALUE_INPUT   1
 
#define TEE_PARAM_ATTR_TYPE_VALUE_OUTPUT   2
 
#define TEE_PARAM_ATTR_TYPE_VALUE_INOUT   3 /* input and output */
 
#define TEE_PARAM_ATTR_TYPE_MEMREF_INPUT   5
 
#define TEE_PARAM_ATTR_TYPE_MEMREF_OUTPUT   6
 
#define TEE_PARAM_ATTR_TYPE_MEMREF_INOUT   7 /* input and output */
 
#define TEE_PARAM_ATTR_TYPE_MASK   0xff
 
#define TEE_PARAM_ATTR_META   0x100
 
#define TEE_PARAM_ATTR_MASK   (TEE_PARAM_ATTR_TYPE_MASK | TEE_PARAM_ATTR_META)
 
#define TEEC_ORIGIN_API   0x00000001
 Function error origins, of type TEEC_ErrorOrigin.
 
#define TEEC_ORIGIN_COMMS   0x00000002
 
#define TEEC_ORIGIN_TEE   0x00000003
 
#define TEEC_ORIGIN_TRUSTED_APP   0x00000004
 
#define TEEC_SUCCESS   0x00000000
 Return values.
 
#define TEEC_ERROR_STORAGE_NOT_AVAILABLE   0xF0100003
 
#define TEEC_ERROR_GENERIC   0xFFFF0000
 
#define TEEC_ERROR_ACCESS_DENIED   0xFFFF0001
 
#define TEEC_ERROR_CANCEL   0xFFFF0002
 
#define TEEC_ERROR_ACCESS_CONFLICT   0xFFFF0003
 
#define TEEC_ERROR_EXCESS_DATA   0xFFFF0004
 
#define TEEC_ERROR_BAD_FORMAT   0xFFFF0005
 
#define TEEC_ERROR_BAD_PARAMETERS   0xFFFF0006
 
#define TEEC_ERROR_BAD_STATE   0xFFFF0007
 
#define TEEC_ERROR_ITEM_NOT_FOUND   0xFFFF0008
 
#define TEEC_ERROR_NOT_IMPLEMENTED   0xFFFF0009
 
#define TEEC_ERROR_NOT_SUPPORTED   0xFFFF000A
 
#define TEEC_ERROR_NO_DATA   0xFFFF000B
 
#define TEEC_ERROR_OUT_OF_MEMORY   0xFFFF000C
 
#define TEEC_ERROR_BUSY   0xFFFF000D
 
#define TEEC_ERROR_COMMUNICATION   0xFFFF000E
 
#define TEEC_ERROR_SECURITY   0xFFFF000F
 
#define TEEC_ERROR_SHORT_BUFFER   0xFFFF0010
 
#define TEEC_ERROR_EXTERNAL_CANCEL   0xFFFF0011
 
#define TEEC_ERROR_TARGET_DEAD   0xFFFF3024
 
#define TEEC_ERROR_STORAGE_NO_SPACE   0xFFFF3041
 
#define TEEC_LOGIN_PUBLIC   0x00000000
 Session login methods, for use in tee_open_session() as parameter connectionMethod.
 
#define TEEC_LOGIN_USER   0x00000001
 
#define TEEC_LOGIN_GROUP   0x00000002
 
#define TEEC_LOGIN_APPLICATION   0x00000004
 
#define TEEC_LOGIN_USER_APPLICATION   0x00000005
 
#define TEEC_LOGIN_GROUP_APPLICATION   0x00000006
 

Typedefs

typedef int(* tee_get_version_t) (const struct device *dev, struct tee_version_info *info)
 Callback API to get current tee version.
 
typedef int(* tee_open_session_t) (const struct device *dev, struct tee_open_session_arg *arg, unsigned int num_param, struct tee_param *param, uint32_t *session_id)
 Callback API to open session to Trusted Application.
 
typedef int(* tee_close_session_t) (const struct device *dev, uint32_t session_id)
 Callback API to close session to TA.
 
typedef int(* tee_cancel_t) (const struct device *dev, uint32_t session_id, uint32_t cancel_id)
 Callback API to cancel open session of invoke function to TA.
 
typedef int(* tee_invoke_func_t) (const struct device *dev, struct tee_invoke_func_arg *arg, unsigned int num_param, struct tee_param *param)
 Callback API to invoke function to TA.
 
typedef int(* tee_shm_register_t) (const struct device *dev, struct tee_shm *shm)
 Callback API to register shared memory.
 
typedef int(* tee_shm_unregister_t) (const struct device *dev, struct tee_shm *shm)
 Callback API to unregister shared memory.
 
typedef int(* tee_suppl_recv_t) (const struct device *dev, uint32_t *func, unsigned int *num_params, struct tee_param *param)
 Callback API to receive a request for TEE supplicant.
 
typedef int(* tee_suppl_send_t) (const struct device *dev, unsigned int ret, unsigned int num_params, struct tee_param *param)
 Callback API to send a request for TEE supplicant.
 

Functions

int tee_get_version (const struct device *dev, struct tee_version_info *info)
 Get the current TEE version info.
 
int tee_open_session (const struct device *dev, struct tee_open_session_arg *arg, unsigned int num_param, struct tee_param *param, uint32_t *session_id)
 Open session for Trusted Environment.
 
int tee_close_session (const struct device *dev, uint32_t session_id)
 Close session for Trusted Environment.
 
int tee_cancel (const struct device *dev, uint32_t session_id, uint32_t cancel_id)
 Cancel session or invoke function for Trusted Environment.
 
int tee_invoke_func (const struct device *dev, struct tee_invoke_func_arg *arg, unsigned int num_param, struct tee_param *param)
 Invoke function for Trusted Environment Application.
 
int tee_add_shm (const struct device *dev, void *addr, size_t align, size_t size, uint32_t flags, struct tee_shm **shmp)
 Helper function to allocate and register shared memory.
 
int tee_rm_shm (const struct device *dev, struct tee_shm *shm)
 Helper function to remove and unregister shared memory.
 
int tee_shm_register (const struct device *dev, void *addr, size_t size, uint32_t flags, struct tee_shm **shm)
 Register shared memory for Trusted Environment.
 
int tee_shm_unregister (const struct device *dev, struct tee_shm *shm)
 Unregister shared memory for Trusted Environment.
 
int tee_shm_alloc (const struct device *dev, size_t size, uint32_t flags, struct tee_shm **shm)
 Allocate shared memory region for Trusted Environment.
 
int tee_shm_free (const struct device *dev, struct tee_shm *shm)
 Free shared memory region for Trusted Environment.
 
int tee_suppl_recv (const struct device *dev, uint32_t *func, unsigned int *num_params, struct tee_param *param)
 Receive a request for TEE Supplicant.
 
int tee_suppl_send (const struct device *dev, unsigned int ret, unsigned int num_params, struct tee_param *param)
 Send a request for TEE Supplicant function.
 

Detailed Description

Public APIs for the tee driver.