psa_crypto_location_dispatch.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef PSA_CRYPTO_LOCATION_DISPATCH_H
22 #define PSA_CRYPTO_LOCATION_DISPATCH_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include <stdlib.h>
29 #include "kernel_defines.h"
30 #include "psa/crypto.h"
31 
32 #if IS_USED(MODULE_PSA_ASYMMETRIC)
47 psa_status_t psa_location_dispatch_sign_hash( const psa_key_attributes_t *attributes,
48  psa_algorithm_t alg,
49  const psa_key_slot_t *slot,
50  const uint8_t *hash,
51  size_t hash_length,
52  uint8_t *signature,
53  size_t signature_size,
54  size_t *signature_length);
55 
70 psa_status_t psa_location_dispatch_sign_message(const psa_key_attributes_t *attributes,
71  psa_algorithm_t alg,
72  const psa_key_slot_t *slot,
73  const uint8_t *input,
74  size_t input_length,
75  uint8_t *signature,
76  size_t signature_size,
77  size_t *signature_length);
78 
92 psa_status_t psa_location_dispatch_verify_hash( const psa_key_attributes_t *attributes,
93  psa_algorithm_t alg,
94  const psa_key_slot_t *slot,
95  const uint8_t *hash,
96  size_t hash_length,
97  const uint8_t *signature,
98  size_t signature_length);
99 
113 psa_status_t psa_location_dispatch_verify_message(const psa_key_attributes_t *attributes,
114  psa_algorithm_t alg,
115  const psa_key_slot_t *slot,
116  const uint8_t *input,
117  size_t input_length,
118  const uint8_t *signature,
119  size_t signature_length);
120 #endif /* MODULE_PSA_ASYMMETRIC */
121 
122 #if IS_USED(MODULE_PSA_MAC)
137 psa_status_t psa_location_dispatch_mac_compute(const psa_key_attributes_t *attributes,
138  psa_algorithm_t alg,
139  const psa_key_slot_t *slot,
140  const uint8_t *input,
141  size_t input_length,
142  uint8_t *mac,
143  size_t mac_size,
144  size_t *mac_length);
145 #endif
146 
147 #if IS_USED(MODULE_PSA_KEY_MANAGEMENT)
156 psa_status_t psa_location_dispatch_generate_key(const psa_key_attributes_t *attributes,
157  psa_key_slot_t *slot);
158 
170 psa_status_t psa_location_dispatch_import_key( const psa_key_attributes_t *attributes,
171  const uint8_t *data, size_t data_length,
172  psa_key_slot_t *slot, size_t *bits);
173 #endif /* MODULE_PSA_KEY_MANAGEMENT */
174 
175 #if IS_USED(MODULE_PSA_CIPHER)
186 psa_status_t psa_location_dispatch_cipher_encrypt_setup( psa_cipher_operation_t *operation,
187  const psa_key_attributes_t *attributes,
188  const psa_key_slot_t *slot,
189  psa_algorithm_t alg);
190 
201 psa_status_t psa_location_dispatch_cipher_decrypt_setup(psa_cipher_operation_t *operation,
202  const psa_key_attributes_t *attributes,
203  const psa_key_slot_t *slot,
204  psa_algorithm_t alg);
205 
215 psa_status_t psa_location_dispatch_cipher_set_iv( psa_cipher_operation_t *operation,
216  const uint8_t *iv,
217  size_t iv_length);
218 
233 psa_status_t psa_location_dispatch_cipher_encrypt( const psa_key_attributes_t *attributes,
234  psa_algorithm_t alg,
235  const psa_key_slot_t *slot,
236  const uint8_t *input,
237  size_t input_length,
238  uint8_t *output,
239  size_t output_size,
240  size_t *output_length);
241 
256 psa_status_t psa_location_dispatch_cipher_decrypt( const psa_key_attributes_t *attributes,
257  psa_algorithm_t alg,
258  const psa_key_slot_t *slot,
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 #endif /* MODULE_PSA_CIPHER */
265 
275  size_t output_size);
276 
277 #ifdef __cplusplus
278 }
279 #endif
280 
281 #endif /* PSA_CRYPTO_LOCATION_DISPATCH_H */
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: algorithm.h:39
Function declarations for PSA Crypto.
psa_status_t psa_location_dispatch_generate_random(uint8_t *output, size_t output_size)
Dispatch call of a random number generator to a specific backend.
Common macros and compiler attributes/pragmas configuration.
int32_t psa_status_t
Status code type used for all PSA Certified APIs.
Definition: error.h:41
Structure storing a cipher operation context.
Definition: crypto_struct.h:64
Structure storing key attributes.
Definition: attributes.h:52
Structure of a virtual key slot in local memory.