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 
20 #ifndef PSA_CRYPTO_LOCATION_DISPATCH_H
21 #define PSA_CRYPTO_LOCATION_DISPATCH_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <stdlib.h>
28 #include "kernel_defines.h"
29 #include "psa/crypto.h"
30 
31 #if IS_USED(MODULE_PSA_ASYMMETRIC)
36 psa_status_t psa_location_dispatch_sign_hash( const psa_key_attributes_t *attributes,
37  psa_algorithm_t alg,
38  const psa_key_slot_t *slot,
39  const uint8_t *hash,
40  size_t hash_length,
41  uint8_t *signature,
42  size_t signature_size,
43  size_t *signature_length);
44 
49 psa_status_t psa_location_dispatch_sign_message(const psa_key_attributes_t *attributes,
50  psa_algorithm_t alg,
51  const psa_key_slot_t *slot,
52  const uint8_t *input,
53  size_t input_length,
54  uint8_t *signature,
55  size_t signature_size,
56  size_t *signature_length);
57 
62 psa_status_t psa_location_dispatch_verify_hash( const psa_key_attributes_t *attributes,
63  psa_algorithm_t alg,
64  const psa_key_slot_t *slot,
65  const uint8_t *hash,
66  size_t hash_length,
67  const uint8_t *signature,
68  size_t signature_length);
69 
74 psa_status_t psa_location_dispatch_verify_message(const psa_key_attributes_t *attributes,
75  psa_algorithm_t alg,
76  const psa_key_slot_t *slot,
77  const uint8_t *input,
78  size_t input_length,
79  const uint8_t *signature,
80  size_t signature_length);
81 #endif /* MODULE_PSA_ASYMMETRIC */
82 
83 #if IS_USED(MODULE_PSA_MAC)
88 psa_status_t psa_location_dispatch_mac_compute(const psa_key_attributes_t *attributes,
89  psa_algorithm_t alg,
90  const psa_key_slot_t *slot,
91  const uint8_t *input,
92  size_t input_length,
93  uint8_t *mac,
94  size_t mac_size,
95  size_t *mac_length);
96 #endif
97 
98 #if IS_USED(MODULE_PSA_KEY_MANAGEMENT)
103 psa_status_t psa_location_dispatch_generate_key(const psa_key_attributes_t *attributes,
104  psa_key_slot_t *slot);
105 
110 psa_status_t psa_location_dispatch_import_key( const psa_key_attributes_t *attributes,
111  const uint8_t *data, size_t data_length,
112  psa_key_slot_t *slot, size_t *bits);
113 #endif /* MODULE_PSA_KEY_MANAGEMENT */
114 
115 #if IS_USED(MODULE_PSA_CIPHER)
120 psa_status_t psa_location_dispatch_cipher_encrypt_setup( psa_cipher_operation_t *operation,
121  const psa_key_attributes_t *attributes,
122  const psa_key_slot_t *slot,
123  psa_algorithm_t alg);
124 
129 psa_status_t psa_location_dispatch_cipher_decrypt_setup(psa_cipher_operation_t *operation,
130  const psa_key_attributes_t *attributes,
131  const psa_key_slot_t *slot,
132  psa_algorithm_t alg);
133 
138 psa_status_t psa_location_dispatch_cipher_set_iv( psa_cipher_operation_t *operation,
139  const uint8_t *iv,
140  size_t iv_length);
141 
146 psa_status_t psa_location_dispatch_cipher_encrypt( const psa_key_attributes_t *attributes,
147  psa_algorithm_t alg,
148  const psa_key_slot_t *slot,
149  const uint8_t *input,
150  size_t input_length,
151  uint8_t *output,
152  size_t output_size,
153  size_t *output_length);
154 
159 psa_status_t psa_location_dispatch_cipher_decrypt( const psa_key_attributes_t *attributes,
160  psa_algorithm_t alg,
161  const psa_key_slot_t *slot,
162  const uint8_t *input,
163  size_t input_length,
164  uint8_t *output,
165  size_t output_size,
166  size_t *output_length);
167 #endif /* MODULE_PSA_CIPHER */
168 
174  size_t output_size);
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #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.