blob: 167c7de181e155efdac8dee5ae2b8527f21b3bb4 [file] [log] [blame]
Etienne Carriere75141172020-05-16 11:58:23 +02001// SPDX-License-Identifier: BSD-2-Clause
Igor Opaniuk136644a2016-09-13 13:40:56 +03002/*
3 * Copyright (c) 2015, Linaro Limited
4 * All rights reserved.
Igor Opaniuk136644a2016-09-13 13:40:56 +03005 */
6
7#include <tee_ta_api.h>
8
yuzexi4c9b16a2022-11-24 15:42:34 +08009#include "ta_hash_perf.h"
10#include "ta_hash_perf_priv.h"
Igor Opaniuk136644a2016-09-13 13:40:56 +030011
12/*
13 * Trusted Application Entry Points
14 */
15
16/* Called each time a new instance is created */
17TEE_Result TA_CreateEntryPoint(void)
18{
19 return TEE_SUCCESS;
20}
21
22/* Called each time an instance is destroyed */
23void TA_DestroyEntryPoint(void)
24{
25}
26
27/* Called each time a session is opened */
28TEE_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 */
39void TA_CloseSessionEntryPoint(void *pSessionContext)
40{
41 (void)pSessionContext;
yuzexi4c9b16a2022-11-24 15:42:34 +080042
Igor Opaniuk136644a2016-09-13 13:40:56 +030043 cmd_clean_res();
44}
45
46/* Called when a command is invoked */
47TEE_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) {
yuzexi4c9b16a2022-11-24 15:42:34 +080054 case TA_HASH_PERF_CMD_PREPARE_OP:
Igor Opaniuk136644a2016-09-13 13:40:56 +030055 return cmd_prepare_op(nParamTypes, pParams);
56
yuzexi4c9b16a2022-11-24 15:42:34 +080057 case TA_HASH_PERF_CMD_PROCESS:
Igor Opaniuk136644a2016-09-13 13:40:56 +030058 return cmd_process(nParamTypes, pParams);
59
60 default:
61 return TEE_ERROR_BAD_PARAMETERS;
62 }
63}