Julian Hall | e7bccbe | 2021-07-16 09:50:34 +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_CIPHER_H |
| 7 | #define TS_CRYPTO_CIPHER_H |
| 8 | |
| 9 | #include <stdint.h> |
| 10 | |
| 11 | /** |
Julian Hall | fe487b7 | 2021-07-19 10:29:59 +0100 | [diff] [blame] | 12 | * Protocol definitions for symmetric cipher operations |
| 13 | * using the packed-c serialization. |
Julian Hall | e7bccbe | 2021-07-16 09:50:34 +0100 | [diff] [blame] | 14 | */ |
| 15 | |
Julian Hall | e7bccbe | 2021-07-16 09:50:34 +0100 | [diff] [blame] | 16 | /**************************************** |
| 17 | * cipher_setup operation definition (encrypt or decrypt) |
| 18 | */ |
| 19 | |
| 20 | /* Mandatory fixed sized input parameters */ |
| 21 | struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_in |
| 22 | { |
| 23 | uint32_t key_id; |
| 24 | uint32_t alg; |
| 25 | }; |
| 26 | |
| 27 | /* Mandatory fixed sized output parameters */ |
| 28 | struct __attribute__ ((__packed__)) ts_crypto_cipher_setup_out |
| 29 | { |
| 30 | uint32_t op_handle; |
| 31 | }; |
| 32 | |
| 33 | /**************************************** |
| 34 | * cipher_generate_iv operation definition |
| 35 | */ |
| 36 | |
| 37 | /* Mandatory fixed sized input parameters */ |
| 38 | struct __attribute__ ((__packed__)) ts_crypto_cipher_generate_iv_in |
| 39 | { |
| 40 | uint32_t op_handle; |
| 41 | }; |
| 42 | |
| 43 | /* Variable length output parameter tags */ |
| 44 | enum |
| 45 | { |
| 46 | TS_CRYPTO_CIPHER_GENERATE_IV_OUT_TAG_IV = 1 |
| 47 | }; |
| 48 | |
| 49 | /**************************************** |
| 50 | * cipher_set_iv operation definition |
| 51 | */ |
| 52 | |
| 53 | /* Mandatory fixed sized input parameters */ |
| 54 | struct __attribute__ ((__packed__)) ts_crypto_cipher_set_iv_in |
| 55 | { |
| 56 | uint32_t op_handle; |
| 57 | }; |
| 58 | |
| 59 | /* Variable length input parameter tags */ |
| 60 | enum |
| 61 | { |
| 62 | TS_CRYPTO_CIPHER_SET_IV_IN_TAG_IV = 1 |
| 63 | }; |
| 64 | |
| 65 | /**************************************** |
| 66 | * cipher_update operation definition |
| 67 | */ |
| 68 | |
| 69 | /* Mandatory fixed sized input parameters */ |
| 70 | struct __attribute__ ((__packed__)) ts_crypto_cipher_update_in |
| 71 | { |
| 72 | uint32_t op_handle; |
| 73 | }; |
| 74 | |
| 75 | /* Variable length input parameter tags */ |
| 76 | enum |
| 77 | { |
| 78 | TS_CRYPTO_CIPHER_UPDATE_IN_TAG_DATA = 1 |
| 79 | }; |
| 80 | |
| 81 | /* Variable length output parameter tags */ |
| 82 | enum |
| 83 | { |
| 84 | TS_CRYPTO_CIPHER_UPDATE_OUT_TAG_DATA = 1 |
| 85 | }; |
| 86 | |
| 87 | /**************************************** |
| 88 | * cipher_finish operation definition |
| 89 | */ |
| 90 | |
| 91 | /* Mandatory fixed sized input parameters */ |
| 92 | struct __attribute__ ((__packed__)) ts_crypto_cipher_finish_in |
| 93 | { |
| 94 | uint32_t op_handle; |
| 95 | }; |
| 96 | |
| 97 | /* Variable length output parameter tags */ |
| 98 | enum |
| 99 | { |
| 100 | TS_CRYPTO_CIPHER_FINISH_OUT_TAG_DATA = 1 |
| 101 | }; |
| 102 | |
| 103 | /**************************************** |
| 104 | * cipher_abort operation definition |
| 105 | */ |
| 106 | |
| 107 | /* Mandatory fixed sized input parameters */ |
| 108 | struct __attribute__ ((__packed__)) ts_crypto_cipher_abort_in |
| 109 | { |
| 110 | uint32_t op_handle; |
| 111 | }; |
| 112 | |
| 113 | #endif /* TS_CRYPTO_CIPHER_H */ |