b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | #ifndef _ASR_BCM_SHA_OPTEE_H_ |
| 2 | #define _ASR_BCM_SHA_OPTEE_H_ |
| 3 | |
| 4 | #include "asr-bcm-optee.h" |
| 5 | #ifdef CONFIG_TEE |
| 6 | #include <linux/tee_drv.h> |
| 7 | #endif |
| 8 | |
| 9 | #define ASR_SHA_ACCESS_UUID \ |
| 10 | { \ |
| 11 | 0xc6445f2a, 0x3365, 0x11ef, \ |
| 12 | { 0x9e, 0x32, 0xe7, 0x0c, 0x07, 0x9f, 0x77, 0xec } \ |
| 13 | } \ |
| 14 | |
| 15 | #define TEE_ALG_MD5 0x50000001 |
| 16 | #define TEE_ALG_SHA1 0x50000002 |
| 17 | #define TEE_ALG_SHA224 0x50000003 |
| 18 | #define TEE_ALG_SHA256 0x50000004 |
| 19 | #define TEE_ALG_SHA384 0x50000005 |
| 20 | #define TEE_ALG_SHA512 0x50000006 |
| 21 | |
| 22 | #define HASH_CONTEXT_SIZE (256) |
| 23 | |
| 24 | /* |
| 25 | * hash init params |
| 26 | * |
| 27 | * [in] pParams[0].value.a hash algorithm type |
| 28 | * [in] pParams[1].value.a hash context addr from external, such as kernel |
| 29 | */ |
| 30 | #define CMD_SHA_INIT 0x1 |
| 31 | |
| 32 | /* |
| 33 | * hash update params |
| 34 | * when input addr is share mem, such as params from kernel: |
| 35 | * [in] pParams[0].memref.buffer input data |
| 36 | * [in] pParams[0].memref.size length of input data |
| 37 | * [in] pParams[1].value.a hash context addr from external, such as kernel |
| 38 | * |
| 39 | * when input addr is physical addr, such as params from uboot: |
| 40 | * [in] pParams[0].value.a input data addr |
| 41 | * [in] pParams[0].value.b length of input data |
| 42 | * [in] pParams[1].value.a whether physical addr |
| 43 | */ |
| 44 | #define CMD_SHA_UPDATE 0x2 |
| 45 | |
| 46 | /* |
| 47 | * hash finish params |
| 48 | * |
| 49 | * [out] pParams[0].memref.buffer output hash |
| 50 | * [out] pParams[0].memref.size length of output hash |
| 51 | * [in] pParams[1].value.a hash context addr from external, such as kernel |
| 52 | */ |
| 53 | #define CMD_SHA_FINAL 0x3 |
| 54 | |
| 55 | struct asr_optee_sha_reqctx { |
| 56 | struct asr_sha_reqctx reqctx; |
| 57 | struct tee_shm *shm; |
| 58 | struct asrbcm_tee_context asrbcm_tee_ctx; |
| 59 | }; |
| 60 | |
| 61 | #endif |