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 | |
| 18 | /******** |
| 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 | |
| 34 | /********* |
| 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 | |
| 50 | /********* |
| 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 | |
| 66 | |
| 67 | #endif /* TS_CRYPTO_HASH_H */ |