Loading...
Searching...
No Matches
psa_crypto_algorithm_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_ALGORITHM_DISPATCH_H
22#define PSA_CRYPTO_ALGORITHM_DISPATCH_H
23
24#ifdef __cplusplus
25extern "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_KEY_MANAGEMENT)
34#endif
35
36#if IS_USED(MODULE_PSA_HASH)
45psa_status_t psa_algorithm_dispatch_hash_setup(psa_hash_operation_t *operation,
46 psa_algorithm_t alg);
47
57psa_status_t psa_algorithm_dispatch_hash_update(psa_hash_operation_t *operation,
58 const uint8_t *input,
59 size_t input_length);
60
71psa_status_t psa_algorithm_dispatch_hash_finish(psa_hash_operation_t *operation,
72 uint8_t *hash,
73 size_t hash_size,
74 size_t *hash_length);
75#endif /* MODULE_PSA_HASH */
76
77#if IS_USED(MODULE_PSA_ASYMMETRIC)
92psa_status_t psa_algorithm_dispatch_sign_hash( const psa_key_attributes_t *attributes,
94 const psa_key_slot_t *slot,
95 const uint8_t *hash,
96 size_t hash_length,
97 uint8_t *signature,
98 size_t signature_size,
99 size_t *signature_length);
100
115psa_status_t psa_algorithm_dispatch_sign_message(const psa_key_attributes_t *attributes,
116 psa_algorithm_t alg,
117 const psa_key_slot_t *slot,
118 const uint8_t *input,
119 size_t input_length,
120 uint8_t *signature,
121 size_t signature_size,
122 size_t *signature_length);
123
137psa_status_t psa_algorithm_dispatch_verify_hash( const psa_key_attributes_t *attributes,
138 psa_algorithm_t alg,
139 const psa_key_slot_t *slot,
140 const uint8_t *hash,
141 size_t hash_length,
142 const uint8_t *signature,
143 size_t signature_length);
144
158psa_status_t psa_algorithm_dispatch_verify_message( const psa_key_attributes_t *attributes,
159 psa_algorithm_t alg,
160 const psa_key_slot_t *slot,
161 const uint8_t *input,
162 size_t input_length,
163 const uint8_t *signature,
164 size_t signature_length);
165#endif /* MODULE_PSA_ASYMMETRIC */
166
167#if IS_USED(MODULE_PSA_KEY_MANAGEMENT)
176psa_status_t psa_algorithm_dispatch_generate_key( const psa_key_attributes_t *attributes,
177 psa_key_slot_t *slot);
178
190psa_status_t psa_algorithm_dispatch_import_key(const psa_key_attributes_t *attributes,
191 const uint8_t *data, size_t data_length,
192 psa_key_slot_t *slot, size_t *bits);
193#endif
194
195#if IS_USED(MODULE_PSA_CIPHER)
210psa_status_t psa_algorithm_dispatch_cipher_encrypt( const psa_key_attributes_t *attributes,
211 psa_algorithm_t alg,
212 const psa_key_slot_t *slot,
213 const uint8_t *input,
214 size_t input_length,
215 uint8_t *output,
216 size_t output_size,
217 size_t *output_length);
218
233psa_status_t psa_algorithm_dispatch_cipher_decrypt( 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#endif /* MODULE_PSA_CIPHER */
242
243#if IS_USED(MODULE_PSA_MAC)
258psa_status_t psa_algorithm_dispatch_mac_compute(const psa_key_attributes_t *attributes,
259 psa_algorithm_t alg,
260 const psa_key_slot_t *slot,
261 const uint8_t *input,
262 size_t input_length,
263 uint8_t *mac,
264 size_t mac_size,
265 size_t *mac_length);
266#endif
267
268#ifdef __cplusplus
269}
270#endif
271
272#endif /* PSA_CRYPTO_ALGORITHM_DISPATCH_H */
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition algorithm.h:39
Function declarations for PSA Crypto.
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
PSA key slot management function declarations.
Structure containing a hash context and algorithm.
Structure storing key attributes.
Definition attributes.h:52
Structure of a virtual key slot in local memory.