Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Function signatures for functionality that can be provided by |
| 3 | * cryptographic accelerators. |
Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 4 | */ |
Steven Cooreman | 2c7b2f8 | 2020-09-02 13:43:46 +0200 | [diff] [blame] | 5 | /* Copyright The Mbed TLS Contributors |
Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: Apache-2.0 |
| 7 | * |
| 8 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | * not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | * |
| 14 | * Unless required by applicable law or agreed to in writing, software |
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | * See the License for the specific language governing permissions and |
| 18 | * limitations under the License. |
Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #ifndef PSA_CRYPTO_DRIVER_WRAPPERS_H |
| 22 | #define PSA_CRYPTO_DRIVER_WRAPPERS_H |
| 23 | |
| 24 | #include "psa/crypto.h" |
| 25 | #include "psa/crypto_driver_common.h" |
| 26 | |
Gilles Peskine | efaee9a | 2023-09-20 20:49:47 +0200 | [diff] [blame] | 27 | #if defined(MBEDTLS_PSA_P256M_DRIVER_ENABLED) |
Aditya Deshpande | e41f7e4 | 2023-01-12 16:29:02 +0000 | [diff] [blame] | 28 | #include "../3rdparty/p256-m/p256-m_driver_entrypoints.h" |
Gilles Peskine | efaee9a | 2023-09-20 20:49:47 +0200 | [diff] [blame] | 29 | #endif /* MBEDTLS_PSA_P256M_DRIVER_ENABLED */ |
Aditya Deshpande | e41f7e4 | 2023-01-12 16:29:02 +0000 | [diff] [blame] | 30 | |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 31 | /* |
| 32 | * Signature functions |
| 33 | */ |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 34 | static inline psa_status_t psa_driver_wrapper_sign_message( |
gabor-mezei-arm | 50eac35 | 2021-04-22 11:32:19 +0200 | [diff] [blame] | 35 | const psa_key_attributes_t *attributes, |
| 36 | const uint8_t *key_buffer, |
| 37 | size_t key_buffer_size, |
| 38 | psa_algorithm_t alg, |
| 39 | const uint8_t *input, |
| 40 | size_t input_length, |
| 41 | uint8_t *signature, |
| 42 | size_t signature_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 43 | size_t *signature_length); |
gabor-mezei-arm | 50eac35 | 2021-04-22 11:32:19 +0200 | [diff] [blame] | 44 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 45 | static inline psa_status_t psa_driver_wrapper_verify_message( |
gabor-mezei-arm | 50eac35 | 2021-04-22 11:32:19 +0200 | [diff] [blame] | 46 | const psa_key_attributes_t *attributes, |
| 47 | const uint8_t *key_buffer, |
| 48 | size_t key_buffer_size, |
| 49 | psa_algorithm_t alg, |
| 50 | const uint8_t *input, |
| 51 | size_t input_length, |
| 52 | const uint8_t *signature, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 53 | size_t signature_length); |
gabor-mezei-arm | 50eac35 | 2021-04-22 11:32:19 +0200 | [diff] [blame] | 54 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 55 | static inline psa_status_t psa_driver_wrapper_sign_hash( |
Ronald Cron | 9f17aa4 | 2020-12-08 17:07:25 +0100 | [diff] [blame] | 56 | const psa_key_attributes_t *attributes, |
| 57 | const uint8_t *key_buffer, size_t key_buffer_size, |
| 58 | psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 59 | uint8_t *signature, size_t signature_size, size_t *signature_length); |
Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 60 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 61 | static inline psa_status_t psa_driver_wrapper_verify_hash( |
Ronald Cron | 9f17aa4 | 2020-12-08 17:07:25 +0100 | [diff] [blame] | 62 | const psa_key_attributes_t *attributes, |
| 63 | const uint8_t *key_buffer, size_t key_buffer_size, |
| 64 | psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 65 | const uint8_t *signature, size_t signature_length); |
Steven Cooreman | 55ae217 | 2020-07-17 19:46:15 +0200 | [diff] [blame] | 66 | |
Steven Cooreman | 0452476 | 2020-10-13 17:43:44 +0200 | [diff] [blame] | 67 | /* |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 68 | * Interruptible Signature functions |
| 69 | */ |
| 70 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 71 | static inline uint32_t psa_driver_wrapper_sign_hash_get_num_ops( |
Paul Elliott | 93d9ca8 | 2023-02-15 18:14:21 +0000 | [diff] [blame] | 72 | psa_sign_hash_interruptible_operation_t *operation); |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 73 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 74 | static inline uint32_t psa_driver_wrapper_verify_hash_get_num_ops( |
Paul Elliott | 93d9ca8 | 2023-02-15 18:14:21 +0000 | [diff] [blame] | 75 | psa_verify_hash_interruptible_operation_t *operation); |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 76 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 77 | static inline psa_status_t psa_driver_wrapper_sign_hash_start( |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 78 | psa_sign_hash_interruptible_operation_t *operation, |
| 79 | const psa_key_attributes_t *attributes, const uint8_t *key_buffer, |
| 80 | size_t key_buffer_size, psa_algorithm_t alg, |
| 81 | const uint8_t *hash, size_t hash_length); |
| 82 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 83 | static inline psa_status_t psa_driver_wrapper_sign_hash_complete( |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 84 | psa_sign_hash_interruptible_operation_t *operation, |
| 85 | uint8_t *signature, size_t signature_size, |
| 86 | size_t *signature_length); |
| 87 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 88 | static inline psa_status_t psa_driver_wrapper_sign_hash_abort( |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 89 | psa_sign_hash_interruptible_operation_t *operation); |
| 90 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 91 | static inline psa_status_t psa_driver_wrapper_verify_hash_start( |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 92 | psa_verify_hash_interruptible_operation_t *operation, |
| 93 | const psa_key_attributes_t *attributes, const uint8_t *key_buffer, |
| 94 | size_t key_buffer_size, psa_algorithm_t alg, |
| 95 | const uint8_t *hash, size_t hash_length, |
| 96 | const uint8_t *signature, size_t signature_length); |
| 97 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 98 | static inline psa_status_t psa_driver_wrapper_verify_hash_complete( |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 99 | psa_verify_hash_interruptible_operation_t *operation); |
| 100 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 101 | static inline psa_status_t psa_driver_wrapper_verify_hash_abort( |
Paul Elliott | 2d24792 | 2022-11-29 14:54:44 +0000 | [diff] [blame] | 102 | psa_verify_hash_interruptible_operation_t *operation); |
| 103 | |
| 104 | /* |
Steven Cooreman | 0452476 | 2020-10-13 17:43:44 +0200 | [diff] [blame] | 105 | * Key handling functions |
| 106 | */ |
| 107 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 108 | static inline psa_status_t psa_driver_wrapper_import_key( |
Ronald Cron | 8328287 | 2020-11-22 14:02:39 +0100 | [diff] [blame] | 109 | const psa_key_attributes_t *attributes, |
| 110 | const uint8_t *data, size_t data_length, |
| 111 | uint8_t *key_buffer, size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 112 | size_t *key_buffer_length, size_t *bits); |
Steven Cooreman | 0452476 | 2020-10-13 17:43:44 +0200 | [diff] [blame] | 113 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 114 | static inline psa_status_t psa_driver_wrapper_export_key( |
Ronald Cron | 6722798 | 2020-11-26 15:16:05 +0100 | [diff] [blame] | 115 | const psa_key_attributes_t *attributes, |
| 116 | const uint8_t *key_buffer, size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 117 | uint8_t *data, size_t data_size, size_t *data_length); |
Ronald Cron | 6722798 | 2020-11-26 15:16:05 +0100 | [diff] [blame] | 118 | |
Xiaokang Qian | 077ffc0 | 2023-08-08 03:41:07 +0000 | [diff] [blame^] | 119 | psa_status_t psa_driver_wrapper_export_public_key( |
Ronald Cron | 84cc994 | 2020-11-25 14:30:05 +0100 | [diff] [blame] | 120 | const psa_key_attributes_t *attributes, |
| 121 | const uint8_t *key_buffer, size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 122 | uint8_t *data, size_t data_size, size_t *data_length); |
Ronald Cron | 84cc994 | 2020-11-25 14:30:05 +0100 | [diff] [blame] | 123 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 124 | static inline psa_status_t psa_driver_wrapper_get_key_buffer_size( |
Ronald Cron | 9df74be | 2020-12-05 19:15:23 +0100 | [diff] [blame] | 125 | const psa_key_attributes_t *attributes, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 126 | size_t *key_buffer_size); |
Ronald Cron | 9df74be | 2020-12-05 19:15:23 +0100 | [diff] [blame] | 127 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 128 | static inline psa_status_t psa_driver_wrapper_get_key_buffer_size_from_key_data( |
Archana | d8a83dc | 2021-06-14 10:04:16 +0530 | [diff] [blame] | 129 | const psa_key_attributes_t *attributes, |
| 130 | const uint8_t *data, |
| 131 | size_t data_length, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 132 | size_t *key_buffer_size); |
Archana | d8a83dc | 2021-06-14 10:04:16 +0530 | [diff] [blame] | 133 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 134 | static inline psa_status_t psa_driver_wrapper_generate_key( |
Ronald Cron | 84cc994 | 2020-11-25 14:30:05 +0100 | [diff] [blame] | 135 | const psa_key_attributes_t *attributes, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 136 | uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length); |
Steven Cooreman | b9b8442 | 2020-10-14 14:39:20 +0200 | [diff] [blame] | 137 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 138 | static inline psa_status_t psa_driver_wrapper_get_builtin_key( |
Steven Cooreman | 6801f08 | 2021-02-19 17:21:22 +0100 | [diff] [blame] | 139 | psa_drv_slot_number_t slot_number, |
| 140 | psa_key_attributes_t *attributes, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 141 | uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length); |
Steven Cooreman | 6801f08 | 2021-02-19 17:21:22 +0100 | [diff] [blame] | 142 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 143 | static inline psa_status_t psa_driver_wrapper_copy_key( |
Archana | 8a18036 | 2021-07-05 02:18:48 +0530 | [diff] [blame] | 144 | psa_key_attributes_t *attributes, |
Archana | 9d17bf4 | 2021-09-10 06:22:44 +0530 | [diff] [blame] | 145 | const uint8_t *source_key, size_t source_key_length, |
Archana | 449608b | 2021-09-08 15:36:05 +0530 | [diff] [blame] | 146 | uint8_t *target_key_buffer, size_t target_key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 147 | size_t *target_key_buffer_length); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 148 | /* |
| 149 | * Cipher functions |
| 150 | */ |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 151 | static inline psa_status_t psa_driver_wrapper_cipher_encrypt( |
gabor-mezei-arm | a9449a0 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 152 | const psa_key_attributes_t *attributes, |
| 153 | const uint8_t *key_buffer, |
| 154 | size_t key_buffer_size, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 155 | psa_algorithm_t alg, |
Ronald Cron | 9b67428 | 2021-07-09 09:19:35 +0200 | [diff] [blame] | 156 | const uint8_t *iv, |
| 157 | size_t iv_length, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 158 | const uint8_t *input, |
| 159 | size_t input_length, |
| 160 | uint8_t *output, |
| 161 | size_t output_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 162 | size_t *output_length); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 163 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 164 | static inline psa_status_t psa_driver_wrapper_cipher_decrypt( |
gabor-mezei-arm | a9449a0 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 165 | const psa_key_attributes_t *attributes, |
| 166 | const uint8_t *key_buffer, |
| 167 | size_t key_buffer_size, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 168 | psa_algorithm_t alg, |
| 169 | const uint8_t *input, |
| 170 | size_t input_length, |
| 171 | uint8_t *output, |
| 172 | size_t output_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 173 | size_t *output_length); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 174 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 175 | static inline psa_status_t psa_driver_wrapper_cipher_encrypt_setup( |
Ronald Cron | a4af55f | 2020-12-14 14:36:06 +0100 | [diff] [blame] | 176 | psa_cipher_operation_t *operation, |
| 177 | const psa_key_attributes_t *attributes, |
| 178 | const uint8_t *key_buffer, size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 179 | psa_algorithm_t alg); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 180 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 181 | static inline psa_status_t psa_driver_wrapper_cipher_decrypt_setup( |
Ronald Cron | a4af55f | 2020-12-14 14:36:06 +0100 | [diff] [blame] | 182 | psa_cipher_operation_t *operation, |
| 183 | const psa_key_attributes_t *attributes, |
| 184 | const uint8_t *key_buffer, size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 185 | psa_algorithm_t alg); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 186 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 187 | static inline psa_status_t psa_driver_wrapper_cipher_set_iv( |
Ronald Cron | 6056fe8 | 2020-12-15 13:58:07 +0100 | [diff] [blame] | 188 | psa_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 189 | const uint8_t *iv, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 190 | size_t iv_length); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 191 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 192 | static inline psa_status_t psa_driver_wrapper_cipher_update( |
Ronald Cron | 6056fe8 | 2020-12-15 13:58:07 +0100 | [diff] [blame] | 193 | psa_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 194 | const uint8_t *input, |
| 195 | size_t input_length, |
| 196 | uint8_t *output, |
| 197 | size_t output_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 198 | size_t *output_length); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 199 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 200 | static inline psa_status_t psa_driver_wrapper_cipher_finish( |
Ronald Cron | 6056fe8 | 2020-12-15 13:58:07 +0100 | [diff] [blame] | 201 | psa_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 202 | uint8_t *output, |
| 203 | size_t output_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 204 | size_t *output_length); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 205 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 206 | static inline psa_status_t psa_driver_wrapper_cipher_abort( |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 207 | psa_cipher_operation_t *operation); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 208 | |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 209 | /* |
| 210 | * Hashing functions |
| 211 | */ |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 212 | static inline psa_status_t psa_driver_wrapper_hash_compute( |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 213 | psa_algorithm_t alg, |
| 214 | const uint8_t *input, |
| 215 | size_t input_length, |
| 216 | uint8_t *hash, |
| 217 | size_t hash_size, |
| 218 | size_t *hash_length); |
| 219 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 220 | static inline psa_status_t psa_driver_wrapper_hash_setup( |
Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 221 | psa_hash_operation_t *operation, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 222 | psa_algorithm_t alg); |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 223 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 224 | static inline psa_status_t psa_driver_wrapper_hash_clone( |
Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 225 | const psa_hash_operation_t *source_operation, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 226 | psa_hash_operation_t *target_operation); |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 227 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 228 | static inline psa_status_t psa_driver_wrapper_hash_update( |
Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 229 | psa_hash_operation_t *operation, |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 230 | const uint8_t *input, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 231 | size_t input_length); |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 232 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 233 | static inline psa_status_t psa_driver_wrapper_hash_finish( |
Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 234 | psa_hash_operation_t *operation, |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 235 | uint8_t *hash, |
| 236 | size_t hash_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 237 | size_t *hash_length); |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 238 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 239 | static inline psa_status_t psa_driver_wrapper_hash_abort( |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 240 | psa_hash_operation_t *operation); |
Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 241 | |
Ronald Cron | de82281 | 2021-03-17 16:08:20 +0100 | [diff] [blame] | 242 | /* |
| 243 | * AEAD functions |
| 244 | */ |
| 245 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 246 | static inline psa_status_t psa_driver_wrapper_aead_encrypt( |
Ronald Cron | de82281 | 2021-03-17 16:08:20 +0100 | [diff] [blame] | 247 | const psa_key_attributes_t *attributes, |
| 248 | const uint8_t *key_buffer, size_t key_buffer_size, |
| 249 | psa_algorithm_t alg, |
| 250 | const uint8_t *nonce, size_t nonce_length, |
| 251 | const uint8_t *additional_data, size_t additional_data_length, |
| 252 | const uint8_t *plaintext, size_t plaintext_length, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 253 | uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length); |
Ronald Cron | de82281 | 2021-03-17 16:08:20 +0100 | [diff] [blame] | 254 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 255 | static inline psa_status_t psa_driver_wrapper_aead_decrypt( |
Ronald Cron | de82281 | 2021-03-17 16:08:20 +0100 | [diff] [blame] | 256 | const psa_key_attributes_t *attributes, |
| 257 | const uint8_t *key_buffer, size_t key_buffer_size, |
| 258 | psa_algorithm_t alg, |
| 259 | const uint8_t *nonce, size_t nonce_length, |
| 260 | const uint8_t *additional_data, size_t additional_data_length, |
| 261 | const uint8_t *ciphertext, size_t ciphertext_length, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 262 | uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length); |
Ronald Cron | de82281 | 2021-03-17 16:08:20 +0100 | [diff] [blame] | 263 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 264 | static inline psa_status_t psa_driver_wrapper_aead_encrypt_setup( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 265 | psa_aead_operation_t *operation, |
| 266 | const psa_key_attributes_t *attributes, |
| 267 | const uint8_t *key_buffer, size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 268 | psa_algorithm_t alg); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 269 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 270 | static inline psa_status_t psa_driver_wrapper_aead_decrypt_setup( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 271 | psa_aead_operation_t *operation, |
| 272 | const psa_key_attributes_t *attributes, |
| 273 | const uint8_t *key_buffer, size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 274 | psa_algorithm_t alg); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 275 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 276 | static inline psa_status_t psa_driver_wrapper_aead_set_nonce( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 277 | psa_aead_operation_t *operation, |
| 278 | const uint8_t *nonce, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 279 | size_t nonce_length); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 280 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 281 | static inline psa_status_t psa_driver_wrapper_aead_set_lengths( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 282 | psa_aead_operation_t *operation, |
| 283 | size_t ad_length, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 284 | size_t plaintext_length); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 285 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 286 | static inline psa_status_t psa_driver_wrapper_aead_update_ad( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 287 | psa_aead_operation_t *operation, |
| 288 | const uint8_t *input, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 289 | size_t input_length); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 290 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 291 | static inline psa_status_t psa_driver_wrapper_aead_update( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 292 | psa_aead_operation_t *operation, |
| 293 | const uint8_t *input, |
| 294 | size_t input_length, |
| 295 | uint8_t *output, |
| 296 | size_t output_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 297 | size_t *output_length); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 298 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 299 | static inline psa_status_t psa_driver_wrapper_aead_finish( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 300 | psa_aead_operation_t *operation, |
| 301 | uint8_t *ciphertext, |
| 302 | size_t ciphertext_size, |
| 303 | size_t *ciphertext_length, |
| 304 | uint8_t *tag, |
| 305 | size_t tag_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 306 | size_t *tag_length); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 307 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 308 | static inline psa_status_t psa_driver_wrapper_aead_verify( |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 309 | psa_aead_operation_t *operation, |
| 310 | uint8_t *plaintext, |
| 311 | size_t plaintext_size, |
| 312 | size_t *plaintext_length, |
| 313 | const uint8_t *tag, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 314 | size_t tag_length); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 315 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 316 | static inline psa_status_t psa_driver_wrapper_aead_abort( |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 317 | psa_aead_operation_t *operation); |
Paul Elliott | 6504aa6 | 2021-04-20 17:09:36 +0100 | [diff] [blame] | 318 | |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 319 | /* |
| 320 | * MAC functions |
| 321 | */ |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 322 | static inline psa_status_t psa_driver_wrapper_mac_compute( |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 323 | const psa_key_attributes_t *attributes, |
| 324 | const uint8_t *key_buffer, |
| 325 | size_t key_buffer_size, |
| 326 | psa_algorithm_t alg, |
| 327 | const uint8_t *input, |
| 328 | size_t input_length, |
| 329 | uint8_t *mac, |
| 330 | size_t mac_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 331 | size_t *mac_length); |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 332 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 333 | static inline psa_status_t psa_driver_wrapper_mac_sign_setup( |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 334 | psa_mac_operation_t *operation, |
| 335 | const psa_key_attributes_t *attributes, |
| 336 | const uint8_t *key_buffer, |
| 337 | size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 338 | psa_algorithm_t alg); |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 339 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 340 | static inline psa_status_t psa_driver_wrapper_mac_verify_setup( |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 341 | psa_mac_operation_t *operation, |
| 342 | const psa_key_attributes_t *attributes, |
| 343 | const uint8_t *key_buffer, |
| 344 | size_t key_buffer_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 345 | psa_algorithm_t alg); |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 346 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 347 | static inline psa_status_t psa_driver_wrapper_mac_update( |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 348 | psa_mac_operation_t *operation, |
| 349 | const uint8_t *input, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 350 | size_t input_length); |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 351 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 352 | static inline psa_status_t psa_driver_wrapper_mac_sign_finish( |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 353 | psa_mac_operation_t *operation, |
| 354 | uint8_t *mac, |
| 355 | size_t mac_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 356 | size_t *mac_length); |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 357 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 358 | static inline psa_status_t psa_driver_wrapper_mac_verify_finish( |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 359 | psa_mac_operation_t *operation, |
| 360 | const uint8_t *mac, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 361 | size_t mac_length); |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 362 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 363 | static inline psa_status_t psa_driver_wrapper_mac_abort( |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 364 | psa_mac_operation_t *operation); |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 365 | |
Przemyslaw Stekiel | b6a6650 | 2021-12-09 11:11:54 +0100 | [diff] [blame] | 366 | /* |
| 367 | * Asymmetric cryptography |
| 368 | */ |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 369 | static inline psa_status_t psa_driver_wrapper_asymmetric_encrypt( |
Przemyslaw Stekiel | b6a6650 | 2021-12-09 11:11:54 +0100 | [diff] [blame] | 370 | const psa_key_attributes_t *attributes, |
| 371 | const uint8_t *key_buffer, |
| 372 | size_t key_buffer_size, |
| 373 | psa_algorithm_t alg, |
| 374 | const uint8_t *input, |
| 375 | size_t input_length, |
| 376 | const uint8_t *salt, |
| 377 | size_t salt_length, |
| 378 | uint8_t *output, |
| 379 | size_t output_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 380 | size_t *output_length); |
Przemyslaw Stekiel | b6a6650 | 2021-12-09 11:11:54 +0100 | [diff] [blame] | 381 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 382 | static inline psa_status_t psa_driver_wrapper_asymmetric_decrypt( |
Przemyslaw Stekiel | 71284ea | 2021-12-13 09:00:52 +0100 | [diff] [blame] | 383 | const psa_key_attributes_t *attributes, |
| 384 | const uint8_t *key_buffer, |
| 385 | size_t key_buffer_size, |
| 386 | psa_algorithm_t alg, |
| 387 | const uint8_t *input, |
| 388 | size_t input_length, |
| 389 | const uint8_t *salt, |
| 390 | size_t salt_length, |
| 391 | uint8_t *output, |
| 392 | size_t output_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 393 | size_t *output_length); |
Przemyslaw Stekiel | 71284ea | 2021-12-13 09:00:52 +0100 | [diff] [blame] | 394 | |
Aditya Deshpande | 17845b8 | 2022-10-13 17:21:01 +0100 | [diff] [blame] | 395 | /* |
| 396 | * Raw Key Agreement |
| 397 | */ |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 398 | static inline psa_status_t psa_driver_wrapper_key_agreement( |
Aditya Deshpande | 17845b8 | 2022-10-13 17:21:01 +0100 | [diff] [blame] | 399 | const psa_key_attributes_t *attributes, |
| 400 | const uint8_t *key_buffer, |
| 401 | size_t key_buffer_size, |
| 402 | psa_algorithm_t alg, |
| 403 | const uint8_t *peer_key, |
| 404 | size_t peer_key_length, |
| 405 | uint8_t *shared_secret, |
| 406 | size_t shared_secret_size, |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 407 | size_t *shared_secret_length); |
Aditya Deshpande | 17845b8 | 2022-10-13 17:21:01 +0100 | [diff] [blame] | 408 | |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 409 | /* |
| 410 | * PAKE functions. |
| 411 | */ |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 412 | static inline psa_status_t psa_driver_wrapper_pake_setup( |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 413 | psa_pake_operation_t *operation, |
Przemek Stekiel | 51eac53 | 2022-12-07 11:04:51 +0100 | [diff] [blame] | 414 | const psa_crypto_driver_pake_inputs_t *inputs); |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 415 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 416 | static inline psa_status_t psa_driver_wrapper_pake_output( |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 417 | psa_pake_operation_t *operation, |
Przemek Stekiel | 251e86a | 2023-02-17 14:30:50 +0100 | [diff] [blame] | 418 | psa_crypto_driver_pake_step_t step, |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 419 | uint8_t *output, |
| 420 | size_t output_size, |
| 421 | size_t *output_length); |
| 422 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 423 | static inline psa_status_t psa_driver_wrapper_pake_input( |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 424 | psa_pake_operation_t *operation, |
Przemek Stekiel | 251e86a | 2023-02-17 14:30:50 +0100 | [diff] [blame] | 425 | psa_crypto_driver_pake_step_t step, |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 426 | const uint8_t *input, |
| 427 | size_t input_length); |
| 428 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 429 | static inline psa_status_t psa_driver_wrapper_pake_get_implicit_key( |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 430 | psa_pake_operation_t *operation, |
Przemek Stekiel | 6b64862 | 2023-02-19 22:55:33 +0100 | [diff] [blame] | 431 | uint8_t *output, size_t output_size, |
| 432 | size_t *output_length); |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 433 | |
Thomas Daubney | 7046468 | 2023-07-04 14:38:06 +0100 | [diff] [blame] | 434 | static inline psa_status_t psa_driver_wrapper_pake_abort( |
Neil Armstrong | 7da8c56 | 2022-06-01 18:17:22 +0200 | [diff] [blame] | 435 | psa_pake_operation_t *operation); |
| 436 | |
Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 437 | #endif /* PSA_CRYPTO_DRIVER_WRAPPERS_H */ |
| 438 | |
| 439 | /* End of automatically generated file. */ |