mbed TLS v2.24.0
crypto_accel_driver.h
Go to the documentation of this file.
1 
16 /*
17  * Copyright The Mbed TLS Contributors
18  * SPDX-License-Identifier: Apache-2.0
19  *
20  * Licensed under the Apache License, Version 2.0 (the "License"); you may
21  * not use this file except in compliance with the License.
22  * You may obtain a copy of the License at
23  *
24  * http://www.apache.org/licenses/LICENSE-2.0
25  *
26  * Unless required by applicable law or agreed to in writing, software
27  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
28  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29  * See the License for the specific language governing permissions and
30  * limitations under the License.
31  */
32 #ifndef PSA_CRYPTO_ACCEL_DRIVER_H
33 #define PSA_CRYPTO_ACCEL_DRIVER_H
34 
35 #include "crypto_driver_common.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
63 typedef struct psa_drv_hash_context_s psa_drv_hash_context_t;
64 
81 
100  const uint8_t *p_input,
101  size_t input_length);
102 
127  uint8_t *p_output,
128  size_t output_size,
129  size_t *p_output_length);
130 
144 typedef void (*psa_drv_hash_abort_t)(psa_drv_hash_context_t *p_context);
145 
172 typedef struct psa_drv_accel_mac_context_s psa_drv_accel_mac_context_t;
173 
195  const uint8_t *p_key,
196  size_t key_length);
197 
217  const uint8_t *p_input,
218  size_t input_length);
219 
242  uint8_t *p_mac,
243  size_t mac_length);
244 
268  const uint8_t *p_mac,
269  size_t mac_length);
270 
288 
310 typedef psa_status_t (*psa_drv_accel_mac_t)(const uint8_t *p_input,
311  size_t input_length,
312  const uint8_t *p_key,
313  size_t key_length,
314  psa_algorithm_t alg,
315  uint8_t *p_mac,
316  size_t mac_length);
317 
341 typedef psa_status_t (*psa_drv_accel_mac_verify_t)(const uint8_t *p_input,
342  size_t input_length,
343  const uint8_t *p_key,
344  size_t key_length,
345  psa_algorithm_t alg,
346  const uint8_t *p_mac,
347  size_t mac_length);
372 typedef struct psa_drv_accel_cipher_context_s psa_drv_accel_cipher_context_t;
373 
402  psa_encrypt_or_decrypt_t direction,
403  const uint8_t *p_key_data,
404  size_t key_data_size);
405 
425  const uint8_t *p_iv,
426  size_t iv_length);
427 
454  const uint8_t *p_input,
455  size_t input_size,
456  uint8_t *p_output,
457  size_t output_size,
458  size_t *p_output_length);
459 
483  uint8_t *p_output,
484  size_t output_size,
485  size_t *p_output_length);
486 
505 
559 typedef psa_status_t (*psa_drv_accel_aead_encrypt_t)(const uint8_t *p_key,
560  size_t key_length,
561  psa_algorithm_t alg,
562  const uint8_t *nonce,
563  size_t nonce_length,
564  const uint8_t *additional_data,
565  size_t additional_data_length,
566  const uint8_t *plaintext,
567  size_t plaintext_length,
568  uint8_t *ciphertext,
569  size_t ciphertext_size,
570  size_t *ciphertext_length);
571 
611 typedef psa_status_t (*psa_drv_accel_aead_decrypt_t)(const uint8_t *p_key,
612  size_t key_length,
613  psa_algorithm_t alg,
614  const uint8_t *nonce,
615  size_t nonce_length,
616  const uint8_t *additional_data,
617  size_t additional_data_length,
618  const uint8_t *ciphertext,
619  size_t ciphertext_length,
620  uint8_t *plaintext,
621  size_t plaintext_size,
622  size_t *plaintext_length);
623 
664 typedef psa_status_t (*psa_drv_accel_asymmetric_sign_t)(const uint8_t *p_key,
665  size_t key_size,
666  psa_algorithm_t alg,
667  psa_key_type_t key_type,
668  const uint8_t *p_hash,
669  size_t hash_length,
670  uint8_t *p_signature,
671  size_t signature_size,
672  size_t *p_signature_length);
673 
703 typedef psa_status_t (*psa_drv_accel_asymmetric_verify_t)(const uint8_t *p_key,
704  size_t key_size,
705  psa_algorithm_t alg,
706  psa_key_type_t key_type,
707  const uint8_t *p_hash,
708  size_t hash_length,
709  const uint8_t *p_signature,
710  size_t signature_length);
711 
753 typedef psa_status_t (*psa_drv_accel_asymmetric_encrypt_t)(const uint8_t *p_key,
754  size_t key_size,
755  psa_algorithm_t alg,
756  psa_key_type_t key_type,
757  const uint8_t *p_input,
758  size_t input_length,
759  const uint8_t *p_salt,
760  size_t salt_length,
761  uint8_t *p_output,
762  size_t output_size,
763  size_t *p_output_length);
764 
805 typedef psa_status_t (*psa_drv_accel_asymmetric_decrypt_t)(const uint8_t *p_key,
806  size_t key_size,
807  psa_algorithm_t alg,
808  psa_key_type_t key_type,
809  const uint8_t *p_input,
810  size_t input_length,
811  const uint8_t *p_salt,
812  size_t salt_length,
813  uint8_t *p_output,
814  size_t output_size,
815  size_t *p_output_length);
816 
819 #ifdef __cplusplus
820 }
821 #endif
822 
823 #endif /* PSA_CRYPTO_ACCEL_DRIVER_H */
psa_status_t(* psa_drv_accel_mac_finish_t)(psa_drv_accel_mac_context_t *p_context, uint8_t *p_mac, size_t mac_length)
The function prototype for the finish operation of a hardware-accelerated MAC operation.
psa_status_t(* psa_drv_accel_mac_t)(const uint8_t *p_input, size_t input_length, const uint8_t *p_key, size_t key_length, psa_algorithm_t alg, uint8_t *p_mac, size_t mac_length)
The function prototype for the one-shot operation of a hardware-accelerated MAC operation.
psa_status_t(* psa_drv_accel_asymmetric_verify_t)(const uint8_t *p_key, size_t key_size, psa_algorithm_t alg, psa_key_type_t key_type, const uint8_t *p_hash, size_t hash_length, const uint8_t *p_signature, size_t signature_length)
The function prototype for the hardware-accelerated signature verify operation.
psa_encrypt_or_decrypt_t
psa_status_t(* psa_drv_accel_aead_encrypt_t)(const uint8_t *p_key, size_t key_length, psa_algorithm_t alg, const uint8_t *nonce, size_t nonce_length, const uint8_t *additional_data, size_t additional_data_length, const uint8_t *plaintext, size_t plaintext_length, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length)
The function prototype for the hardware-accelerated authenticated encryption operation.
psa_status_t(* psa_drv_accel_cipher_update_t)(psa_drv_accel_cipher_context_t *p_context, const uint8_t *p_input, size_t input_size, uint8_t *p_output, size_t output_size, size_t *p_output_length)
The function prototype for the update operation of hardware-accelerated block cipher operations...
struct psa_drv_hash_context_s psa_drv_hash_context_t
The hardware-specific hash context structure.
psa_status_t(* psa_drv_accel_asymmetric_decrypt_t)(const uint8_t *p_key, size_t key_size, psa_algorithm_t alg, psa_key_type_t key_type, const uint8_t *p_input, size_t input_length, const uint8_t *p_salt, size_t salt_length, uint8_t *p_output, size_t output_size, size_t *p_output_length)
The function prototype for the hardware=acce;erated asymmetric decrypt operation. ...
struct psa_drv_accel_mac_context_s psa_drv_accel_mac_context_t
The hardware-accelerator-specific MAC context structure.
psa_status_t(* psa_drv_accel_mac_finish_verify_t)(psa_drv_accel_mac_context_t *p_context, const uint8_t *p_mac, size_t mac_length)
The function prototype for the finish and verify operation of a hardware-accelerated MAC operation...
psa_status_t(* psa_drv_hash_setup_t)(psa_drv_hash_context_t *p_context)
The function prototype for the start operation of a hash (message digest) operation.
psa_status_t(* psa_drv_accel_mac_verify_t)(const uint8_t *p_input, size_t input_length, const uint8_t *p_key, size_t key_length, psa_algorithm_t alg, const uint8_t *p_mac, size_t mac_length)
The function prototype for the one-shot hardware-accelerated MAC Verify operation.
psa_status_t(* psa_drv_accel_cipher_setup_t)(psa_drv_accel_cipher_context_t *p_context, psa_encrypt_or_decrypt_t direction, const uint8_t *p_key_data, size_t key_data_size)
The function prototype for the setup operation of hardware-accelerated block cipher operations...
psa_status_t(* psa_drv_accel_aead_decrypt_t)(const uint8_t *p_key, size_t key_length, psa_algorithm_t alg, const uint8_t *nonce, size_t nonce_length, const uint8_t *additional_data, size_t additional_data_length, const uint8_t *ciphertext, size_t ciphertext_length, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length)
The function prototype for the hardware-accelerated authenticated decryption operation.
psa_status_t(* psa_drv_accel_cipher_finish_t)(psa_drv_accel_cipher_context_t *p_context, uint8_t *p_output, size_t output_size, size_t *p_output_length)
The function prototype for the finish operation of hardware-accelerated block cipher operations...
psa_status_t(* psa_drv_accel_mac_update_t)(psa_drv_accel_mac_context_t *p_context, const uint8_t *p_input, size_t input_length)
The function prototype for the update operation of a hardware-accelerated MAC operation.
void(* psa_drv_hash_abort_t)(psa_drv_hash_context_t *p_context)
The function prototype for the abort operation of a hash (message digest) operation.
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:96
psa_status_t(* psa_drv_accel_cipher_abort_t)(psa_drv_accel_cipher_context_t *p_context)
The function prototype for the abort operation of hardware-accelerated block cipher operations...
psa_status_t(* psa_drv_accel_asymmetric_encrypt_t)(const uint8_t *p_key, size_t key_size, psa_algorithm_t alg, psa_key_type_t key_type, const uint8_t *p_input, size_t input_length, const uint8_t *p_salt, size_t salt_length, uint8_t *p_output, size_t output_size, size_t *p_output_length)
The function prototype for the hardware-accelerated asymmetric encrypt operation. ...
psa_status_t(* psa_drv_accel_asymmetric_sign_t)(const uint8_t *p_key, size_t key_size, psa_algorithm_t alg, psa_key_type_t key_type, const uint8_t *p_hash, size_t hash_length, uint8_t *p_signature, size_t signature_size, size_t *p_signature_length)
The function prototype for the hardware-accelerated asymmetric sign operation.
uint16_t psa_key_type_t
Encoding of a key type.
Definition: crypto_types.h:64
psa_status_t(* psa_drv_hash_finish_t)(psa_drv_hash_context_t *p_context, uint8_t *p_output, size_t output_size, size_t *p_output_length)
The function prototype for the finish operation of a hash (message digest) operation.
psa_status_t(* psa_drv_accel_cipher_set_iv_t)(psa_drv_accel_cipher_context_t *p_context, const uint8_t *p_iv, size_t iv_length)
The function prototype for the set initialization vector operation of hardware-accelerated block ciph...
psa_status_t(* psa_drv_hash_update_t)(psa_drv_hash_context_t *p_context, const uint8_t *p_input, size_t input_length)
The function prototype for the update operation of a hash (message digest) operation.
Definitions for all PSA crypto drivers.
struct psa_drv_accel_cipher_context_s psa_drv_accel_cipher_context_t
The hardware-accelerator-specific cipher context structure.
psa_status_t(* psa_drv_accel_mac_abort_t)(psa_drv_accel_mac_context_t *p_context)
The function prototype for the abort operation for a previously started hardware-accelerated MAC oper...
psa_status_t(* psa_drv_accel_mac_setup_t)(psa_drv_accel_mac_context_t *p_context, const uint8_t *p_key, size_t key_length)
The function prototype for the setup operation of a hardware-accelerated MAC operation.
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:53