Julian Hall | f572896 | 2021-06-24 09:40:23 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| 3 | * SPDX-License-Identifier: BSD-3-Clause |
| 4 | */ |
| 5 | |
| 6 | #ifndef TS_CRYPTO_HASH_H |
| 7 | #define TS_CRYPTO_HASH_H |
| 8 | |
| 9 | #include <stdint.h> |
| 10 | |
| 11 | /** |
| 12 | * Hash operations on arbitrary sized data involve three operations, |
| 13 | * a setup, called once, an update called 1..* times and a finish |
| 14 | * to finalise theh hash operation. |
| 15 | */ |
| 16 | |
| 17 | |
Julian Hall | 0ed3d45 | 2021-07-15 14:31:07 +0100 | [diff] [blame] | 18 | /**************************************** |
Julian Hall | f572896 | 2021-06-24 09:40:23 +0100 | [diff] [blame] | 19 | * hash_setup operation definition |
| 20 | */ |
| 21 | |
| 22 | /* Mandatory fixed sized input parameters */ |
| 23 | struct __attribute__ ((__packed__)) ts_crypto_hash_setup_in |
| 24 | { |
| 25 | uint32_t alg; |
| 26 | }; |
| 27 | |
| 28 | /* Mandatory fixed sized output parameters */ |
| 29 | struct __attribute__ ((__packed__)) ts_crypto_hash_setup_out |
| 30 | { |
| 31 | uint32_t op_handle; |
| 32 | }; |
| 33 | |
Julian Hall | 0ed3d45 | 2021-07-15 14:31:07 +0100 | [diff] [blame] | 34 | /**************************************** |
Julian Hall | f572896 | 2021-06-24 09:40:23 +0100 | [diff] [blame] | 35 | * hash_update operation definition |
| 36 | */ |
| 37 | |
| 38 | /* Mandatory fixed sized input parameters */ |
| 39 | struct __attribute__ ((__packed__)) ts_crypto_hash_update_in |
| 40 | { |
| 41 | uint32_t op_handle; |
| 42 | }; |
| 43 | |
| 44 | /* Variable length input parameter tags */ |
| 45 | enum |
| 46 | { |
| 47 | TS_CRYPTO_HASH_UPDATE_IN_TAG_DATA = 1 |
| 48 | }; |
| 49 | |
Julian Hall | 0ed3d45 | 2021-07-15 14:31:07 +0100 | [diff] [blame] | 50 | /**************************************** |
Julian Hall | f572896 | 2021-06-24 09:40:23 +0100 | [diff] [blame] | 51 | * hash_finish operation definition |
| 52 | */ |
| 53 | |
| 54 | /* Mandatory fixed sized input parameters */ |
| 55 | struct __attribute__ ((__packed__)) ts_crypto_hash_finish_in |
| 56 | { |
| 57 | uint32_t op_handle; |
| 58 | }; |
| 59 | |
| 60 | /* Variable length output parameter tags */ |
| 61 | enum |
| 62 | { |
| 63 | TS_CRYPTO_HASH_FINISH_OUT_TAG_HASH = 1 |
| 64 | }; |
| 65 | |
Julian Hall | 0ed3d45 | 2021-07-15 14:31:07 +0100 | [diff] [blame] | 66 | /**************************************** |
| 67 | * hash_abort operation definition |
| 68 | */ |
| 69 | |
| 70 | /* Mandatory fixed sized input parameters */ |
| 71 | struct __attribute__ ((__packed__)) ts_crypto_hash_abort_in |
| 72 | { |
| 73 | uint32_t op_handle; |
| 74 | }; |
| 75 | |
| 76 | /**************************************** |
| 77 | * hash_verify operation definition |
| 78 | */ |
| 79 | |
| 80 | /* Mandatory fixed sized input parameters */ |
| 81 | struct __attribute__ ((__packed__)) ts_crypto_hash_verify_in |
| 82 | { |
| 83 | uint32_t op_handle; |
| 84 | }; |
| 85 | |
| 86 | /* Variable length input parameter tags */ |
| 87 | enum |
| 88 | { |
| 89 | TS_CRYPTO_HASH_VERIFY_IN_TAG_HASH = 1 |
| 90 | }; |
| 91 | |
| 92 | /**************************************** |
| 93 | * hash_clone operation definition |
| 94 | */ |
| 95 | |
| 96 | /* Mandatory fixed sized input parameters */ |
| 97 | struct __attribute__ ((__packed__)) ts_crypto_hash_clone_in |
| 98 | { |
| 99 | uint32_t source_op_handle; |
| 100 | }; |
| 101 | |
| 102 | /* Mandatory fixed sized output parameters */ |
| 103 | struct __attribute__ ((__packed__)) ts_crypto_hash_clone_out |
| 104 | { |
| 105 | uint32_t target_op_handle; |
| 106 | }; |
Julian Hall | f572896 | 2021-06-24 09:40:23 +0100 | [diff] [blame] | 107 | |
| 108 | #endif /* TS_CRYPTO_HASH_H */ |