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_AEDecryptFinal __GP11_TEE_AEDecryptFinal
43 #define TEE_AEEncryptFinal __GP11_TEE_AEEncryptFinal
44 #define TEE_AEInit __GP11_TEE_AEInit
45 #define TEE_AEUpdateAAD __GP11_TEE_AEUpdateAAD
46 #define TEE_AEUpdate __GP11_TEE_AEUpdate
47 #define TEE_AllocateTransientObject __GP11_TEE_AllocateTransientObject
48 #define TEE_AsymmetricDecrypt __GP11_TEE_AsymmetricDecrypt
49 #define TEE_AsymmetricEncrypt __GP11_TEE_AsymmetricEncrypt
50 #define TEE_AsymmetricSignDigest __GP11_TEE_AsymmetricSignDigest
51 #define TEE_AsymmetricVerifyDigest __GP11_TEE_AsymmetricVerifyDigest
52 #define TEE_BigIntConvertFromOctetString __GP11_TEE_BigIntConvertFromOctetString
53 #define TEE_BigIntConvertToOctetString __GP11_TEE_BigIntConvertToOctetString
54 #define TEE_BigIntFMMContextSizeInU32 __GP11_TEE_BigIntFMMContextSizeInU32
55 #define TEE_BigIntFMMSizeInU32 __GP11_TEE_BigIntFMMSizeInU32
56 #define TEE_BigIntInitFMMContext __GP11_TEE_BigIntInitFMMContext
57 #define TEE_BigIntInitFMM __GP11_TEE_BigIntInitFMM
58 #define TEE_BigIntShiftRight __GP11_TEE_BigIntShiftRight
59 #define TEE_CheckMemoryAccessRights __GP11_TEE_CheckMemoryAccessRights
60 #define TEE_CipherDoFinal __GP11_TEE_CipherDoFinal
61 #define TEE_CipherInit __GP11_TEE_CipherInit
62 #define TEE_CipherUpdate __GP11_TEE_CipherUpdate
63 #define TEE_CreatePersistentObject __GP11_TEE_CreatePersistentObject
64 #define TEE_DeriveKey __GP11_TEE_DeriveKey
65 #define TEE_DigestDoFinal __GP11_TEE_DigestDoFinal
66 #define TEE_DigestUpdate __GP11_TEE_DigestUpdate
67 #define TEE_FreeOperation __GP11_TEE_FreeOperation
68 #define TEE_GenerateKey __GP11_TEE_GenerateKey
69 #define TEE_GenerateRandom __GP11_TEE_GenerateRandom
70 #define TEE_GetNextPersistentObject __GP11_TEE_GetNextPersistentObject
71 #define TEE_GetObjectBufferAttribute __GP11_TEE_GetObjectBufferAttribute
72 #define TEE_GetObjectInfo1 __GP11_TEE_GetObjectInfo1
73 #define TEE_GetObjectInfo __GP11_TEE_GetObjectInfo
74 #define TEE_GetOperationInfoMultiple __GP11_TEE_GetOperationInfoMultiple
75 #define TEE_GetPropertyAsBinaryBlock __GP11_TEE_GetPropertyAsBinaryBlock
76 #define TEE_GetPropertyAsString __GP11_TEE_GetPropertyAsString
77 #define TEE_GetPropertyName __GP11_TEE_GetPropertyName
78 #define TEE_InitRefAttribute __GP11_TEE_InitRefAttribute
79 #define TEE_InitValueAttribute __GP11_TEE_InitValueAttribute
80 #define TEE_InvokeTACommand __GP11_TEE_InvokeTACommand
81 #define TEE_MACCompareFinal __GP11_TEE_MACCompareFinal
82 #define TEE_MACComputeFinal __GP11_TEE_MACComputeFinal
83 #define TEE_MACInit __GP11_TEE_MACInit
84 #define TEE_MACUpdate __GP11_TEE_MACUpdate
85 #define TEE_Malloc __GP11_TEE_Malloc
86 #define TEE_MemCompare __GP11_TEE_MemCompare
87 #define TEE_MemFill __GP11_TEE_MemFill
88 #define TEE_MemMove __GP11_TEE_MemMove
89 #define TEE_OpenPersistentObject __GP11_TEE_OpenPersistentObject
90 #define TEE_OpenTASession __GP11_TEE_OpenTASession
91 #define TEE_PopulateTransientObject __GP11_TEE_PopulateTransientObject
92 #define TEE_ReadObjectData __GP11_TEE_ReadObjectData
93 #define TEE_Realloc __GP11_TEE_Realloc
94 #define TEE_RenamePersistentObject __GP11_TEE_RenamePersistentObject
95 #define TEE_SeekObjectData __GP11_TEE_SeekObjectData
96 #define TEE_SetOperationKey2 __GP11_TEE_SetOperationKey2
97 #define TEE_SetOperationKey __GP11_TEE_SetOperationKey
98 #define TEE_TruncateObjectData __GP11_TEE_TruncateObjectData
99 #define TEE_WriteObjectData __GP11_TEE_WriteObjectData
100 #endif
101 
102 #endif /*__TEE_API_COMPAT_H*/
103