Etienne Carriere | 7514117 | 2020-05-16 11:58:23 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: BSD-2-Clause |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2015, Linaro Limited |
| 4 | * All rights reserved. |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <tee_ta_api.h> |
| 8 | |
yuzexi | 4c9b16a | 2022-11-24 15:42:34 +0800 | [diff] [blame] | 9 | #include "ta_hash_perf.h" |
| 10 | #include "ta_hash_perf_priv.h" |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 11 | |
| 12 | /* |
| 13 | * Trusted Application Entry Points |
| 14 | */ |
| 15 | |
| 16 | /* Called each time a new instance is created */ |
| 17 | TEE_Result TA_CreateEntryPoint(void) |
| 18 | { |
| 19 | return TEE_SUCCESS; |
| 20 | } |
| 21 | |
| 22 | /* Called each time an instance is destroyed */ |
| 23 | void TA_DestroyEntryPoint(void) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | /* Called each time a session is opened */ |
| 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 */ |
| 39 | void TA_CloseSessionEntryPoint(void *pSessionContext) |
| 40 | { |
| 41 | (void)pSessionContext; |
yuzexi | 4c9b16a | 2022-11-24 15:42:34 +0800 | [diff] [blame] | 42 | |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 43 | cmd_clean_res(); |
| 44 | } |
| 45 | |
| 46 | /* Called when a command is invoked */ |
| 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) { |
yuzexi | 4c9b16a | 2022-11-24 15:42:34 +0800 | [diff] [blame] | 54 | case TA_HASH_PERF_CMD_PREPARE_OP: |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 55 | return cmd_prepare_op(nParamTypes, pParams); |
| 56 | |
yuzexi | 4c9b16a | 2022-11-24 15:42:34 +0800 | [diff] [blame] | 57 | case TA_HASH_PERF_CMD_PROCESS: |
Igor Opaniuk | 136644a | 2016-09-13 13:40:56 +0300 | [diff] [blame] | 58 | return cmd_process(nParamTypes, pParams); |
| 59 | |
| 60 | default: |
| 61 | return TEE_ERROR_BAD_PARAMETERS; |
| 62 | } |
| 63 | } |