8 #ifndef __TFM_CRYPTO_API_H__
9 #define __TFM_CRYPTO_API_H__
29 #define UNIFORM_SIGNATURE_API(api_name) \
30 psa_status_t api_name(psa_invec[], size_t, psa_outvec[], size_t)
168 #define LIST_TFM_CRYPTO_UNIFORM_SIGNATURE_API \
169 X(tfm_crypto_get_key_attributes) \
170 X(tfm_crypto_reset_key_attributes) \
171 X(tfm_crypto_open_key) \
172 X(tfm_crypto_close_key) \
173 X(tfm_crypto_import_key) \
174 X(tfm_crypto_destroy_key) \
175 X(tfm_crypto_export_key) \
176 X(tfm_crypto_export_public_key) \
177 X(tfm_crypto_copy_key) \
178 X(tfm_crypto_hash_compute) \
179 X(tfm_crypto_hash_compare) \
180 X(tfm_crypto_hash_setup) \
181 X(tfm_crypto_hash_update) \
182 X(tfm_crypto_hash_finish) \
183 X(tfm_crypto_hash_verify) \
184 X(tfm_crypto_hash_abort) \
185 X(tfm_crypto_hash_clone) \
186 X(tfm_crypto_mac_compute) \
187 X(tfm_crypto_mac_verify) \
188 X(tfm_crypto_mac_sign_setup) \
189 X(tfm_crypto_mac_verify_setup) \
190 X(tfm_crypto_mac_update) \
191 X(tfm_crypto_mac_sign_finish) \
192 X(tfm_crypto_mac_verify_finish) \
193 X(tfm_crypto_mac_abort) \
194 X(tfm_crypto_cipher_encrypt) \
195 X(tfm_crypto_cipher_decrypt) \
196 X(tfm_crypto_cipher_encrypt_setup) \
197 X(tfm_crypto_cipher_decrypt_setup) \
198 X(tfm_crypto_cipher_generate_iv) \
199 X(tfm_crypto_cipher_set_iv) \
200 X(tfm_crypto_cipher_update) \
201 X(tfm_crypto_cipher_finish) \
202 X(tfm_crypto_cipher_abort) \
203 X(tfm_crypto_aead_encrypt) \
204 X(tfm_crypto_aead_decrypt) \
205 X(tfm_crypto_aead_encrypt_setup) \
206 X(tfm_crypto_aead_decrypt_setup) \
207 X(tfm_crypto_aead_generate_nonce) \
208 X(tfm_crypto_aead_set_nonce) \
209 X(tfm_crypto_aead_set_lengths) \
210 X(tfm_crypto_aead_update_ad) \
211 X(tfm_crypto_aead_update) \
212 X(tfm_crypto_aead_finish) \
213 X(tfm_crypto_aead_verify) \
214 X(tfm_crypto_aead_abort) \
215 X(tfm_crypto_sign_hash) \
216 X(tfm_crypto_verify_hash) \
217 X(tfm_crypto_asymmetric_encrypt) \
218 X(tfm_crypto_asymmetric_decrypt) \
219 X(tfm_crypto_key_derivation_setup) \
220 X(tfm_crypto_key_derivation_get_capacity) \
221 X(tfm_crypto_key_derivation_set_capacity) \
222 X(tfm_crypto_key_derivation_input_bytes) \
223 X(tfm_crypto_key_derivation_input_key) \
224 X(tfm_crypto_key_derivation_key_agreement)\
225 X(tfm_crypto_key_derivation_output_bytes) \
226 X(tfm_crypto_key_derivation_output_key) \
227 X(tfm_crypto_key_derivation_abort) \
228 X(tfm_crypto_raw_key_agreement) \
229 X(tfm_crypto_generate_random) \
230 X(tfm_crypto_generate_key) \
231 X(tfm_crypto_set_key_domain_parameters) \
232 X(tfm_crypto_get_key_domain_parameters) \
234 #define X(api_name) UNIFORM_SIGNATURE_API(api_name);
psa_key_handle_t key_handle
psa_status_t tfm_crypto_check_handle_owner(psa_key_handle_t handle, uint32_t *index)
Checks that the requested handle belongs to the requesting partition.
psa_status_t tfm_crypto_operation_alloc(enum tfm_crypto_operation_type type, uint32_t *handle, void **ctx)
Allocate an operation context in the backend.
psa_status_t tfm_crypto_get_caller_id(int32_t *id)
Returns the ID of the caller.
psa_status_t tfm_crypto_key_attributes_to_client(const psa_key_attributes_t *key_attributes, struct psa_client_key_attributes_s *client_key_attr)
Converts key attributes to client key attributes.
psa_status_t tfm_crypto_key_attributes_from_client(const struct psa_client_key_attributes_s *client_key_attr, int32_t client_id, psa_key_attributes_t *key_attributes)
Gets key attributes from client key attributes.
#define LIST_TFM_CRYPTO_UNIFORM_SIGNATURE_API
psa_status_t tfm_crypto_operation_release(uint32_t *handle)
Release an operation context in the backend.
psa_status_t tfm_crypto_init(void)
Initialise the service.
PSA cryptography client key attribute definitions.
psa_status_t tfm_crypto_set_key_storage(uint32_t index, psa_key_handle_t key_handle)
Sets the index of the local storage in use with a key requested by the calling partition, and stores the corresponding key_handle.
psa_status_t tfm_crypto_check_key_storage(uint32_t *index)
Checks that there is enough local storage in RAM to keep another key, and returns the index of the st...
psa_status_t tfm_crypto_init_alloc(void)
Initialise the Alloc module.
tfm_crypto_operation_type
List of possible operation types supported by the TFM based implementation. This type is needed by th...
psa_status_t tfm_crypto_operation_lookup(enum tfm_crypto_operation_type type, uint32_t handle, void **ctx)
Look up an operation context in the backend for the corresponding frontend operation.
int32_t psa_status_t
Function return status.