| 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 | 56250fd | 2020-09-04 13:07:15 +0200 | [diff] [blame] | 4 | *  Warning: This file will be auto-generated in the future. | 
| Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 5 | */ | 
| Steven Cooreman | 2c7b2f8 | 2020-09-02 13:43:46 +0200 | [diff] [blame] | 6 | /*  Copyright The Mbed TLS Contributors | 
| Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 7 | *  SPDX-License-Identifier: Apache-2.0 | 
|  | 8 | * | 
|  | 9 | *  Licensed under the Apache License, Version 2.0 (the "License"); you may | 
|  | 10 | *  not use this file except in compliance with the License. | 
|  | 11 | *  You may obtain a copy of the License at | 
|  | 12 | * | 
|  | 13 | *  http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 14 | * | 
|  | 15 | *  Unless required by applicable law or agreed to in writing, software | 
|  | 16 | *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 
|  | 17 | *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 18 | *  See the License for the specific language governing permissions and | 
|  | 19 | *  limitations under the License. | 
| Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 20 | */ | 
|  | 21 |  | 
|  | 22 | #ifndef PSA_CRYPTO_DRIVER_WRAPPERS_H | 
|  | 23 | #define PSA_CRYPTO_DRIVER_WRAPPERS_H | 
|  | 24 |  | 
|  | 25 | #include "psa/crypto.h" | 
|  | 26 | #include "psa/crypto_driver_common.h" | 
|  | 27 |  | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 28 | /* | 
|  | 29 | * Signature functions | 
|  | 30 | */ | 
| gabor-mezei-arm | c53f4f6 | 2021-04-22 11:32:19 +0200 | [diff] [blame] | 31 | psa_status_t psa_driver_wrapper_sign_message( | 
|  | 32 | const psa_key_attributes_t *attributes, | 
|  | 33 | const uint8_t *key_buffer, | 
|  | 34 | size_t key_buffer_size, | 
|  | 35 | psa_algorithm_t alg, | 
|  | 36 | const uint8_t *input, | 
|  | 37 | size_t input_length, | 
|  | 38 | uint8_t *signature, | 
|  | 39 | size_t signature_size, | 
|  | 40 | size_t *signature_length ); | 
|  | 41 |  | 
|  | 42 | psa_status_t psa_driver_wrapper_verify_message( | 
|  | 43 | const psa_key_attributes_t *attributes, | 
|  | 44 | const uint8_t *key_buffer, | 
|  | 45 | size_t key_buffer_size, | 
|  | 46 | psa_algorithm_t alg, | 
|  | 47 | const uint8_t *input, | 
|  | 48 | size_t input_length, | 
|  | 49 | const uint8_t *signature, | 
|  | 50 | size_t signature_length ); | 
|  | 51 |  | 
| Ronald Cron | 9f17aa4 | 2020-12-08 17:07:25 +0100 | [diff] [blame] | 52 | psa_status_t psa_driver_wrapper_sign_hash( | 
|  | 53 | const psa_key_attributes_t *attributes, | 
|  | 54 | const uint8_t *key_buffer, size_t key_buffer_size, | 
|  | 55 | psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, | 
|  | 56 | uint8_t *signature, size_t signature_size, size_t *signature_length ); | 
| Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 57 |  | 
| Ronald Cron | 9f17aa4 | 2020-12-08 17:07:25 +0100 | [diff] [blame] | 58 | psa_status_t psa_driver_wrapper_verify_hash( | 
|  | 59 | const psa_key_attributes_t *attributes, | 
|  | 60 | const uint8_t *key_buffer, size_t key_buffer_size, | 
|  | 61 | psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, | 
|  | 62 | const uint8_t *signature, size_t signature_length ); | 
| Steven Cooreman | 55ae217 | 2020-07-17 19:46:15 +0200 | [diff] [blame] | 63 |  | 
| Steven Cooreman | 0452476 | 2020-10-13 17:43:44 +0200 | [diff] [blame] | 64 | /* | 
|  | 65 | * Key handling functions | 
|  | 66 | */ | 
|  | 67 |  | 
| Ronald Cron | 8328287 | 2020-11-22 14:02:39 +0100 | [diff] [blame] | 68 | psa_status_t psa_driver_wrapper_import_key( | 
|  | 69 | const psa_key_attributes_t *attributes, | 
|  | 70 | const uint8_t *data, size_t data_length, | 
|  | 71 | uint8_t *key_buffer, size_t key_buffer_size, | 
|  | 72 | size_t *key_buffer_length, size_t *bits ); | 
| Steven Cooreman | 0452476 | 2020-10-13 17:43:44 +0200 | [diff] [blame] | 73 |  | 
| Ronald Cron | 6722798 | 2020-11-26 15:16:05 +0100 | [diff] [blame] | 74 | psa_status_t psa_driver_wrapper_export_key( | 
|  | 75 | const psa_key_attributes_t *attributes, | 
|  | 76 | const uint8_t *key_buffer, size_t key_buffer_size, | 
|  | 77 | uint8_t *data, size_t data_size, size_t *data_length ); | 
|  | 78 |  | 
| Ronald Cron | 84cc994 | 2020-11-25 14:30:05 +0100 | [diff] [blame] | 79 | psa_status_t psa_driver_wrapper_export_public_key( | 
|  | 80 | const psa_key_attributes_t *attributes, | 
|  | 81 | const uint8_t *key_buffer, size_t key_buffer_size, | 
|  | 82 | uint8_t *data, size_t data_size, size_t *data_length ); | 
|  | 83 |  | 
| Ronald Cron | 9df74be | 2020-12-05 19:15:23 +0100 | [diff] [blame] | 84 | psa_status_t psa_driver_wrapper_get_key_buffer_size( | 
|  | 85 | const psa_key_attributes_t *attributes, | 
|  | 86 | size_t *key_buffer_size ); | 
|  | 87 |  | 
| Ronald Cron | 84cc994 | 2020-11-25 14:30:05 +0100 | [diff] [blame] | 88 | psa_status_t psa_driver_wrapper_generate_key( | 
|  | 89 | const psa_key_attributes_t *attributes, | 
| Ronald Cron | 977c247 | 2020-10-13 08:32:21 +0200 | [diff] [blame] | 90 | 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] | 91 |  | 
| Steven Cooreman | 6801f08 | 2021-02-19 17:21:22 +0100 | [diff] [blame] | 92 | psa_status_t psa_driver_wrapper_get_builtin_key( | 
|  | 93 | psa_drv_slot_number_t slot_number, | 
|  | 94 | psa_key_attributes_t *attributes, | 
|  | 95 | uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length ); | 
|  | 96 |  | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 97 | /* | 
|  | 98 | * Cipher functions | 
|  | 99 | */ | 
|  | 100 | psa_status_t psa_driver_wrapper_cipher_encrypt( | 
|  | 101 | psa_key_slot_t *slot, | 
|  | 102 | psa_algorithm_t alg, | 
|  | 103 | const uint8_t *input, | 
|  | 104 | size_t input_length, | 
|  | 105 | uint8_t *output, | 
|  | 106 | size_t output_size, | 
|  | 107 | size_t *output_length ); | 
|  | 108 |  | 
|  | 109 | psa_status_t psa_driver_wrapper_cipher_decrypt( | 
|  | 110 | psa_key_slot_t *slot, | 
|  | 111 | psa_algorithm_t alg, | 
|  | 112 | const uint8_t *input, | 
|  | 113 | size_t input_length, | 
|  | 114 | uint8_t *output, | 
|  | 115 | size_t output_size, | 
|  | 116 | size_t *output_length ); | 
|  | 117 |  | 
|  | 118 | psa_status_t psa_driver_wrapper_cipher_encrypt_setup( | 
| Ronald Cron | a4af55f | 2020-12-14 14:36:06 +0100 | [diff] [blame] | 119 | psa_cipher_operation_t *operation, | 
|  | 120 | const psa_key_attributes_t *attributes, | 
|  | 121 | const uint8_t *key_buffer, size_t key_buffer_size, | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 122 | psa_algorithm_t alg ); | 
|  | 123 |  | 
|  | 124 | psa_status_t psa_driver_wrapper_cipher_decrypt_setup( | 
| Ronald Cron | a4af55f | 2020-12-14 14:36:06 +0100 | [diff] [blame] | 125 | psa_cipher_operation_t *operation, | 
|  | 126 | const psa_key_attributes_t *attributes, | 
|  | 127 | const uint8_t *key_buffer, size_t key_buffer_size, | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 128 | psa_algorithm_t alg ); | 
|  | 129 |  | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 130 | psa_status_t psa_driver_wrapper_cipher_set_iv( | 
| Ronald Cron | 6056fe8 | 2020-12-15 13:58:07 +0100 | [diff] [blame] | 131 | psa_cipher_operation_t *operation, | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 132 | const uint8_t *iv, | 
|  | 133 | size_t iv_length ); | 
|  | 134 |  | 
|  | 135 | psa_status_t psa_driver_wrapper_cipher_update( | 
| Ronald Cron | 6056fe8 | 2020-12-15 13:58:07 +0100 | [diff] [blame] | 136 | psa_cipher_operation_t *operation, | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 137 | const uint8_t *input, | 
|  | 138 | size_t input_length, | 
|  | 139 | uint8_t *output, | 
|  | 140 | size_t output_size, | 
|  | 141 | size_t *output_length ); | 
|  | 142 |  | 
|  | 143 | psa_status_t psa_driver_wrapper_cipher_finish( | 
| Ronald Cron | 6056fe8 | 2020-12-15 13:58:07 +0100 | [diff] [blame] | 144 | psa_cipher_operation_t *operation, | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 145 | uint8_t *output, | 
|  | 146 | size_t output_size, | 
|  | 147 | size_t *output_length ); | 
|  | 148 |  | 
|  | 149 | psa_status_t psa_driver_wrapper_cipher_abort( | 
| Ronald Cron | 6056fe8 | 2020-12-15 13:58:07 +0100 | [diff] [blame] | 150 | psa_cipher_operation_t *operation ); | 
| Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 151 |  | 
| Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 152 | /* | 
|  | 153 | * Hashing functions | 
|  | 154 | */ | 
|  | 155 | psa_status_t psa_driver_wrapper_hash_compute( | 
|  | 156 | psa_algorithm_t alg, | 
|  | 157 | const uint8_t *input, | 
|  | 158 | size_t input_length, | 
|  | 159 | uint8_t *hash, | 
|  | 160 | size_t hash_size, | 
|  | 161 | size_t *hash_length); | 
|  | 162 |  | 
|  | 163 | psa_status_t psa_driver_wrapper_hash_setup( | 
| Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 164 | psa_hash_operation_t *operation, | 
| Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 165 | psa_algorithm_t alg ); | 
|  | 166 |  | 
|  | 167 | psa_status_t psa_driver_wrapper_hash_clone( | 
| Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 168 | const psa_hash_operation_t *source_operation, | 
|  | 169 | psa_hash_operation_t *target_operation ); | 
| Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 170 |  | 
|  | 171 | psa_status_t psa_driver_wrapper_hash_update( | 
| Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 172 | psa_hash_operation_t *operation, | 
| Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 173 | const uint8_t *input, | 
|  | 174 | size_t input_length ); | 
|  | 175 |  | 
|  | 176 | psa_status_t psa_driver_wrapper_hash_finish( | 
| Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 177 | psa_hash_operation_t *operation, | 
| Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 178 | uint8_t *hash, | 
|  | 179 | size_t hash_size, | 
|  | 180 | size_t *hash_length ); | 
|  | 181 |  | 
|  | 182 | psa_status_t psa_driver_wrapper_hash_abort( | 
| Steven Cooreman | dbf8ced | 2021-03-04 13:01:18 +0100 | [diff] [blame] | 183 | psa_hash_operation_t *operation ); | 
| Steven Cooreman | 1e58235 | 2021-02-18 17:24:37 +0100 | [diff] [blame] | 184 |  | 
| Ronald Cron | de82281 | 2021-03-17 16:08:20 +0100 | [diff] [blame] | 185 | /* | 
|  | 186 | * AEAD functions | 
|  | 187 | */ | 
|  | 188 |  | 
|  | 189 | psa_status_t psa_driver_wrapper_aead_encrypt( | 
|  | 190 | const psa_key_attributes_t *attributes, | 
|  | 191 | const uint8_t *key_buffer, size_t key_buffer_size, | 
|  | 192 | psa_algorithm_t alg, | 
|  | 193 | const uint8_t *nonce, size_t nonce_length, | 
|  | 194 | const uint8_t *additional_data, size_t additional_data_length, | 
|  | 195 | const uint8_t *plaintext, size_t plaintext_length, | 
|  | 196 | uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length ); | 
|  | 197 |  | 
|  | 198 | psa_status_t psa_driver_wrapper_aead_decrypt( | 
|  | 199 | const psa_key_attributes_t *attributes, | 
|  | 200 | const uint8_t *key_buffer, size_t key_buffer_size, | 
|  | 201 | psa_algorithm_t alg, | 
|  | 202 | const uint8_t *nonce, size_t nonce_length, | 
|  | 203 | const uint8_t *additional_data, size_t additional_data_length, | 
|  | 204 | const uint8_t *ciphertext, size_t ciphertext_length, | 
|  | 205 | uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length ); | 
|  | 206 |  | 
| Steven Cooreman | 896d51e | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 207 | /* | 
|  | 208 | * MAC functions | 
|  | 209 | */ | 
|  | 210 | psa_status_t psa_driver_wrapper_mac_compute( | 
|  | 211 | const psa_key_attributes_t *attributes, | 
|  | 212 | const uint8_t *key_buffer, | 
|  | 213 | size_t key_buffer_size, | 
|  | 214 | psa_algorithm_t alg, | 
|  | 215 | const uint8_t *input, | 
|  | 216 | size_t input_length, | 
|  | 217 | uint8_t *mac, | 
|  | 218 | size_t mac_size, | 
|  | 219 | size_t *mac_length ); | 
|  | 220 |  | 
|  | 221 | psa_status_t psa_driver_wrapper_mac_sign_setup( | 
|  | 222 | psa_mac_operation_t *operation, | 
|  | 223 | const psa_key_attributes_t *attributes, | 
|  | 224 | const uint8_t *key_buffer, | 
|  | 225 | size_t key_buffer_size, | 
|  | 226 | psa_algorithm_t alg ); | 
|  | 227 |  | 
|  | 228 | psa_status_t psa_driver_wrapper_mac_verify_setup( | 
|  | 229 | psa_mac_operation_t *operation, | 
|  | 230 | const psa_key_attributes_t *attributes, | 
|  | 231 | const uint8_t *key_buffer, | 
|  | 232 | size_t key_buffer_size, | 
|  | 233 | psa_algorithm_t alg ); | 
|  | 234 |  | 
|  | 235 | psa_status_t psa_driver_wrapper_mac_update( | 
|  | 236 | psa_mac_operation_t *operation, | 
|  | 237 | const uint8_t *input, | 
|  | 238 | size_t input_length ); | 
|  | 239 |  | 
|  | 240 | psa_status_t psa_driver_wrapper_mac_sign_finish( | 
|  | 241 | psa_mac_operation_t *operation, | 
|  | 242 | uint8_t *mac, | 
|  | 243 | size_t mac_size, | 
|  | 244 | size_t *mac_length ); | 
|  | 245 |  | 
|  | 246 | psa_status_t psa_driver_wrapper_mac_verify_finish( | 
|  | 247 | psa_mac_operation_t *operation, | 
|  | 248 | const uint8_t *mac, | 
|  | 249 | size_t mac_length ); | 
|  | 250 |  | 
|  | 251 | psa_status_t psa_driver_wrapper_mac_abort( | 
|  | 252 | psa_mac_operation_t *operation ); | 
|  | 253 |  | 
| Steven Cooreman | cd84cb4 | 2020-07-16 20:28:36 +0200 | [diff] [blame] | 254 | #endif /* PSA_CRYPTO_DRIVER_WRAPPERS_H */ | 
|  | 255 |  | 
|  | 256 | /* End of automatically generated file. */ |