• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Function signatures for functionality that can be provided by
3  *  cryptographic accelerators.
4  *  Warning: This file will be auto-generated in the future.
5  */
6 /*  Copyright The Mbed TLS Contributors
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.
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 
28 /*
29  * Initialization and termination functions
30  */
31 psa_status_t psa_driver_wrapper_init( void );
32 void psa_driver_wrapper_free( void );
33 
34 /*
35  * Signature functions
36  */
37 psa_status_t psa_driver_wrapper_sign_message(
38     const psa_key_attributes_t *attributes,
39     const uint8_t *key_buffer,
40     size_t key_buffer_size,
41     psa_algorithm_t alg,
42     const uint8_t *input,
43     size_t input_length,
44     uint8_t *signature,
45     size_t signature_size,
46     size_t *signature_length );
47 
48 psa_status_t psa_driver_wrapper_verify_message(
49     const psa_key_attributes_t *attributes,
50     const uint8_t *key_buffer,
51     size_t key_buffer_size,
52     psa_algorithm_t alg,
53     const uint8_t *input,
54     size_t input_length,
55     const uint8_t *signature,
56     size_t signature_length );
57 
58 psa_status_t psa_driver_wrapper_sign_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     uint8_t *signature, size_t signature_size, size_t *signature_length );
63 
64 psa_status_t psa_driver_wrapper_verify_hash(
65     const psa_key_attributes_t *attributes,
66     const uint8_t *key_buffer, size_t key_buffer_size,
67     psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
68     const uint8_t *signature, size_t signature_length );
69 
70 /*
71  * Key handling functions
72  */
73 
74 psa_status_t psa_driver_wrapper_import_key(
75     const psa_key_attributes_t *attributes,
76     const uint8_t *data, size_t data_length,
77     uint8_t *key_buffer, size_t key_buffer_size,
78     size_t *key_buffer_length, size_t *bits );
79 
80 psa_status_t psa_driver_wrapper_export_key(
81     const psa_key_attributes_t *attributes,
82     const uint8_t *key_buffer, size_t key_buffer_size,
83     uint8_t *data, size_t data_size, size_t *data_length );
84 
85 psa_status_t psa_driver_wrapper_export_public_key(
86     const psa_key_attributes_t *attributes,
87     const uint8_t *key_buffer, size_t key_buffer_size,
88     uint8_t *data, size_t data_size, size_t *data_length );
89 
90 psa_status_t psa_driver_wrapper_get_key_buffer_size(
91     const psa_key_attributes_t *attributes,
92     size_t *key_buffer_size );
93 
94 psa_status_t psa_driver_wrapper_get_key_buffer_size_from_key_data(
95     const psa_key_attributes_t *attributes,
96     const uint8_t *data,
97     size_t data_length,
98     size_t *key_buffer_size );
99 
100 psa_status_t psa_driver_wrapper_generate_key(
101     const psa_key_attributes_t *attributes,
102     uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length );
103 
104 psa_status_t psa_driver_wrapper_get_builtin_key(
105     psa_drv_slot_number_t slot_number,
106     psa_key_attributes_t *attributes,
107     uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length );
108 
109 psa_status_t psa_driver_wrapper_copy_key(
110     psa_key_attributes_t *attributes,
111     const uint8_t *source_key, size_t source_key_length,
112     uint8_t *target_key_buffer, size_t target_key_buffer_size,
113     size_t *target_key_buffer_length );
114 /*
115  * Cipher functions
116  */
117 psa_status_t psa_driver_wrapper_cipher_encrypt(
118     const psa_key_attributes_t *attributes,
119     const uint8_t *key_buffer,
120     size_t key_buffer_size,
121     psa_algorithm_t alg,
122     const uint8_t *iv,
123     size_t iv_length,
124     const uint8_t *input,
125     size_t input_length,
126     uint8_t *output,
127     size_t output_size,
128     size_t *output_length );
129 
130 psa_status_t psa_driver_wrapper_cipher_decrypt(
131     const psa_key_attributes_t *attributes,
132     const uint8_t *key_buffer,
133     size_t key_buffer_size,
134     psa_algorithm_t alg,
135     const uint8_t *input,
136     size_t input_length,
137     uint8_t *output,
138     size_t output_size,
139     size_t *output_length );
140 
141 psa_status_t psa_driver_wrapper_cipher_encrypt_setup(
142     psa_cipher_operation_t *operation,
143     const psa_key_attributes_t *attributes,
144     const uint8_t *key_buffer, size_t key_buffer_size,
145     psa_algorithm_t alg );
146 
147 psa_status_t psa_driver_wrapper_cipher_decrypt_setup(
148     psa_cipher_operation_t *operation,
149     const psa_key_attributes_t *attributes,
150     const uint8_t *key_buffer, size_t key_buffer_size,
151     psa_algorithm_t alg );
152 
153 psa_status_t psa_driver_wrapper_cipher_set_iv(
154     psa_cipher_operation_t *operation,
155     const uint8_t *iv,
156     size_t iv_length );
157 
158 psa_status_t psa_driver_wrapper_cipher_update(
159     psa_cipher_operation_t *operation,
160     const uint8_t *input,
161     size_t input_length,
162     uint8_t *output,
163     size_t output_size,
164     size_t *output_length );
165 
166 psa_status_t psa_driver_wrapper_cipher_finish(
167     psa_cipher_operation_t *operation,
168     uint8_t *output,
169     size_t output_size,
170     size_t *output_length );
171 
172 psa_status_t psa_driver_wrapper_cipher_abort(
173     psa_cipher_operation_t *operation );
174 
175 /*
176  * Hashing functions
177  */
178 psa_status_t psa_driver_wrapper_hash_compute(
179     psa_algorithm_t alg,
180     const uint8_t *input,
181     size_t input_length,
182     uint8_t *hash,
183     size_t hash_size,
184     size_t *hash_length);
185 
186 psa_status_t psa_driver_wrapper_hash_setup(
187     psa_hash_operation_t *operation,
188     psa_algorithm_t alg );
189 
190 psa_status_t psa_driver_wrapper_hash_clone(
191     const psa_hash_operation_t *source_operation,
192     psa_hash_operation_t *target_operation );
193 
194 psa_status_t psa_driver_wrapper_hash_update(
195     psa_hash_operation_t *operation,
196     const uint8_t *input,
197     size_t input_length );
198 
199 psa_status_t psa_driver_wrapper_hash_finish(
200     psa_hash_operation_t *operation,
201     uint8_t *hash,
202     size_t hash_size,
203     size_t *hash_length );
204 
205 psa_status_t psa_driver_wrapper_hash_abort(
206     psa_hash_operation_t *operation );
207 
208 /*
209  * AEAD functions
210  */
211 
212 psa_status_t psa_driver_wrapper_aead_encrypt(
213     const psa_key_attributes_t *attributes,
214     const uint8_t *key_buffer, size_t key_buffer_size,
215     psa_algorithm_t alg,
216     const uint8_t *nonce, size_t nonce_length,
217     const uint8_t *additional_data, size_t additional_data_length,
218     const uint8_t *plaintext, size_t plaintext_length,
219     uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length );
220 
221 psa_status_t psa_driver_wrapper_aead_decrypt(
222     const psa_key_attributes_t *attributes,
223     const uint8_t *key_buffer, size_t key_buffer_size,
224     psa_algorithm_t alg,
225     const uint8_t *nonce, size_t nonce_length,
226     const uint8_t *additional_data, size_t additional_data_length,
227     const uint8_t *ciphertext, size_t ciphertext_length,
228     uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length );
229 
230 psa_status_t psa_driver_wrapper_aead_encrypt_setup(
231     psa_aead_operation_t *operation,
232     const psa_key_attributes_t *attributes,
233     const uint8_t *key_buffer, size_t key_buffer_size,
234     psa_algorithm_t alg );
235 
236 psa_status_t psa_driver_wrapper_aead_decrypt_setup(
237     psa_aead_operation_t *operation,
238     const psa_key_attributes_t *attributes,
239     const uint8_t *key_buffer, size_t key_buffer_size,
240     psa_algorithm_t alg );
241 
242 psa_status_t psa_driver_wrapper_aead_set_nonce(
243     psa_aead_operation_t *operation,
244     const uint8_t *nonce,
245     size_t nonce_length );
246 
247 psa_status_t psa_driver_wrapper_aead_set_lengths(
248     psa_aead_operation_t *operation,
249     size_t ad_length,
250     size_t plaintext_length );
251 
252 psa_status_t psa_driver_wrapper_aead_update_ad(
253     psa_aead_operation_t *operation,
254     const uint8_t *input,
255     size_t input_length );
256 
257 psa_status_t psa_driver_wrapper_aead_update(
258     psa_aead_operation_t *operation,
259     const uint8_t *input,
260     size_t input_length,
261     uint8_t *output,
262     size_t output_size,
263     size_t *output_length );
264 
265 psa_status_t psa_driver_wrapper_aead_finish(
266     psa_aead_operation_t *operation,
267     uint8_t *ciphertext,
268     size_t ciphertext_size,
269     size_t *ciphertext_length,
270     uint8_t *tag,
271     size_t tag_size,
272     size_t *tag_length );
273 
274 psa_status_t psa_driver_wrapper_aead_verify(
275     psa_aead_operation_t *operation,
276     uint8_t *plaintext,
277     size_t plaintext_size,
278     size_t *plaintext_length,
279     const uint8_t *tag,
280     size_t tag_length );
281 
282 psa_status_t psa_driver_wrapper_aead_abort(
283     psa_aead_operation_t *operation );
284 
285 /*
286  * MAC functions
287  */
288 psa_status_t psa_driver_wrapper_mac_compute(
289     const psa_key_attributes_t *attributes,
290     const uint8_t *key_buffer,
291     size_t key_buffer_size,
292     psa_algorithm_t alg,
293     const uint8_t *input,
294     size_t input_length,
295     uint8_t *mac,
296     size_t mac_size,
297     size_t *mac_length );
298 
299 psa_status_t psa_driver_wrapper_mac_sign_setup(
300     psa_mac_operation_t *operation,
301     const psa_key_attributes_t *attributes,
302     const uint8_t *key_buffer,
303     size_t key_buffer_size,
304     psa_algorithm_t alg );
305 
306 psa_status_t psa_driver_wrapper_mac_verify_setup(
307     psa_mac_operation_t *operation,
308     const psa_key_attributes_t *attributes,
309     const uint8_t *key_buffer,
310     size_t key_buffer_size,
311     psa_algorithm_t alg );
312 
313 psa_status_t psa_driver_wrapper_mac_update(
314     psa_mac_operation_t *operation,
315     const uint8_t *input,
316     size_t input_length );
317 
318 psa_status_t psa_driver_wrapper_mac_sign_finish(
319     psa_mac_operation_t *operation,
320     uint8_t *mac,
321     size_t mac_size,
322     size_t *mac_length );
323 
324 psa_status_t psa_driver_wrapper_mac_verify_finish(
325     psa_mac_operation_t *operation,
326     const uint8_t *mac,
327     size_t mac_length );
328 
329 psa_status_t psa_driver_wrapper_mac_abort(
330     psa_mac_operation_t *operation );
331 
332 #endif /* PSA_CRYPTO_DRIVER_WRAPPERS_H */
333 
334 /* End of automatically generated file. */
335