xref: /optee_os/lib/libutee/include/tee_api_compat.h (revision 1d0ed95aa718cebeabed9ebd120eb4cfaabb5669)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2022, Linaro Limited
4  */
5 
6 #ifndef __TEE_API_COMPAT_H
7 #define __TEE_API_COMPAT_H
8 
9 /*
10  * This function will be called from TA_OpenSessionEntryPoint() in
11  * user_ta_header.c (if compiled with __OPTEE_CORE_API_COMPAT_1_1), the
12  * compatibility entry function is passed as a function pointer in @fp.
13  * This is needed since libutee is never compiled with
14  * __OPTEE_CORE_API_COMPAT_1_1, but we still need a way to call the
15  * compatibility function __GP11_TA_InvokeCommandEntryPoint(), but only
16  * when __OPTEE_CORE_API_COMPAT_1_1 is defined.
17  */
18 TEE_Result __ta_open_sess(uint32_t pt, TEE_Param params[TEE_NUM_PARAMS],
19 			  void **sess_ctx,
20 			  TEE_Result (*fp)(uint32_t,
21 					   __GP11_TEE_Param [TEE_NUM_PARAMS],
22 					   void **));
23 
24 /*
25  * Same as for __ta_open_sess_func(), except that @fp now is a pointer to
26  * __GP11_TA_InvokeCommandEntryPoint().
27  */
28 TEE_Result __ta_invoke_cmd(void *sess_ctx, uint32_t cmd_id, uint32_t pt,
29 			   TEE_Param params[TEE_NUM_PARAMS],
30 			   TEE_Result (*fp)(void *, uint32_t, uint32_t,
31 					    __GP11_TEE_Param [TEE_NUM_PARAMS]));
32 
33 #if __OPTEE_CORE_API_COMPAT_1_1
34 /* Types */
35 #define TEE_Attribute __GP11_TEE_Attribute
36 #define TEE_ObjectInfo __GP11_TEE_ObjectInfo
37 #define TEE_Param __GP11_TEE_Param
38 
39 /* Functions */
40 #define TA_InvokeCommandEntryPoint __GP11_TA_InvokeCommandEntryPoint
41 #define TA_OpenSessionEntryPoint __GP11_TA_OpenSessionEntryPoint
42 #define TEE_AsymmetricDecrypt __GP11_TEE_AsymmetricDecrypt
43 #define TEE_AsymmetricEncrypt __GP11_TEE_AsymmetricEncrypt
44 #define TEE_AsymmetricSignDigest __GP11_TEE_AsymmetricSignDigest
45 #define TEE_AsymmetricVerifyDigest __GP11_TEE_AsymmetricVerifyDigest
46 #define TEE_CheckMemoryAccessRights __GP11_TEE_CheckMemoryAccessRights
47 #define TEE_DeriveKey __GP11_TEE_DeriveKey
48 #define TEE_GenerateKey __GP11_TEE_GenerateKey
49 #define TEE_GetNextPersistentObject __GP11_TEE_GetNextPersistentObject
50 #define TEE_GetObjectInfo1 __GP11_TEE_GetObjectInfo1
51 #define TEE_GetObjectInfo __GP11_TEE_GetObjectInfo
52 #define TEE_GetPropertyAsBinaryBlock __GP11_TEE_GetPropertyAsBinaryBlock
53 #define TEE_GetPropertyAsString __GP11_TEE_GetPropertyAsString
54 #define TEE_GetPropertyName __GP11_TEE_GetPropertyName
55 #define TEE_InitRefAttribute __GP11_TEE_InitRefAttribute
56 #define TEE_InitValueAttribute __GP11_TEE_InitValueAttribute
57 #define TEE_InvokeTACommand __GP11_TEE_InvokeTACommand
58 #define TEE_Malloc __GP11_TEE_Malloc
59 #define TEE_MemCompare __GP11_TEE_MemCompare
60 #define TEE_MemFill __GP11_TEE_MemFill
61 #define TEE_MemMove __GP11_TEE_MemMove
62 #define TEE_OpenTASession __GP11_TEE_OpenTASession
63 #define TEE_PopulateTransientObject __GP11_TEE_PopulateTransientObject
64 #define TEE_Realloc __GP11_TEE_Realloc
65 #endif
66 
67 #endif /*__TEE_API_COMPAT_H*/
68