1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3 * Copyright (c) 2015, Linaro Limited
4 * All rights reserved.
5 */
6
7 #include <tee_ta_api.h>
8
9 #include "ta_sha_perf.h"
10 #include "ta_sha_perf_priv.h"
11
12 /*
13 * Trusted Application Entry Points
14 */
15
16 /* Called each time a new instance is created */
TA_CreateEntryPoint(void)17 TEE_Result TA_CreateEntryPoint(void)
18 {
19 return TEE_SUCCESS;
20 }
21
22 /* Called each time an instance is destroyed */
TA_DestroyEntryPoint(void)23 void TA_DestroyEntryPoint(void)
24 {
25 }
26
27 /* Called each time a session is opened */
TA_OpenSessionEntryPoint(uint32_t nParamTypes,TEE_Param pParams[4],void ** ppSessionContext)28 TEE_Result TA_OpenSessionEntryPoint(uint32_t nParamTypes,
29 TEE_Param pParams[4],
30 void **ppSessionContext)
31 {
32 (void)nParamTypes;
33 (void)pParams;
34 (void)ppSessionContext;
35 return TEE_SUCCESS;
36 }
37
38 /* Called each time a session is closed */
TA_CloseSessionEntryPoint(void * pSessionContext)39 void TA_CloseSessionEntryPoint(void *pSessionContext)
40 {
41 (void)pSessionContext;
42
43 cmd_clean_res();
44 }
45
46 /* Called when a command is invoked */
TA_InvokeCommandEntryPoint(void * pSessionContext,uint32_t nCommandID,uint32_t nParamTypes,TEE_Param pParams[4])47 TEE_Result TA_InvokeCommandEntryPoint(void *pSessionContext,
48 uint32_t nCommandID, uint32_t nParamTypes,
49 TEE_Param pParams[4])
50 {
51 (void)pSessionContext;
52
53 switch (nCommandID) {
54 case TA_SHA_PERF_CMD_PREPARE_OP:
55 return cmd_prepare_op(nParamTypes, pParams);
56
57 case TA_SHA_PERF_CMD_PROCESS:
58 return cmd_process(nParamTypes, pParams);
59
60 default:
61 return TEE_ERROR_BAD_PARAMETERS;
62 }
63 }
64