mbed TLS v2.23.0

crypto_se_driver.h
Go to the documentation of this file.
1
18 /*
19 * Copyright (C) 2018, ARM Limited, All Rights Reserved
20 * SPDX-License-Identifier: Apache-2.0
21 *
22 * Licensed under the Apache License, Version 2.0 (the "License"); you may
23 * not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 * http://www.apache.org/licenses/LICENSE-2.0
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
30 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 */
34 #ifndef PSA_CRYPTO_SE_DRIVER_H
35 #define PSA_CRYPTO_SE_DRIVER_H
36
37 #include "crypto_driver_common.h"
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
55 typedef struct {
100 const void *const persistent_data;
101
107 const size_t persistent_data_size;
108
114 uintptr_t transient_data;
115 } psa_drv_se_context_t;
116
135 typedef psa_status_t (*psa_drv_se_init_t)(psa_drv_se_context_t *drv_context,
136 void *persistent_data,
137 psa_key_location_t location);
138
139 #if defined(__DOXYGEN_ONLY__) || !defined(MBEDTLS_PSA_CRYPTO_SE_C)
140 /* Mbed Crypto with secure element support enabled defines this type in
141 * crypto_types.h because it is also visible to applications through an
142 * implementation-specific extension.
143 * For the PSA Cryptography specification, this type is only visible
144 * via crypto_se_driver.h. */
148 typedef uint64_t psa_key_slot_number_t;
149 #endif /* __DOXYGEN_ONLY__ || !MBEDTLS_PSA_CRYPTO_SE_C */
150
184 typedef psa_status_t (*psa_drv_se_mac_setup_t)(psa_drv_se_context_t *drv_context,
185 void *op_context,
186 psa_key_slot_number_t key_slot,
187 psa_algorithm_t algorithm);
188
199 typedef psa_status_t (*psa_drv_se_mac_update_t)(void *op_context,
200 const uint8_t *p_input,
201 size_t input_length);
202
219 typedef psa_status_t (*psa_drv_se_mac_finish_t)(void *op_context,
220 uint8_t *p_mac,
221 size_t mac_size,
222 size_t *p_mac_length);
223
240 typedef psa_status_t (*psa_drv_se_mac_finish_verify_t)(void *op_context,
241 const uint8_t *p_mac,
242 size_t mac_length);
243
250 typedef psa_status_t (*psa_drv_se_mac_abort_t)(void *op_context);
251
270 typedef psa_status_t (*psa_drv_se_mac_generate_t)(psa_drv_se_context_t *drv_context,
271 const uint8_t *p_input,
272 size_t input_length,
273 psa_key_slot_number_t key_slot,
274 psa_algorithm_t alg,
275 uint8_t *p_mac,
276 size_t mac_size,
277 size_t *p_mac_length);
278
299 typedef psa_status_t (*psa_drv_se_mac_verify_t)(psa_drv_se_context_t *drv_context,
300 const uint8_t *p_input,
301 size_t input_length,
302 psa_key_slot_number_t key_slot,
303 psa_algorithm_t alg,
304 const uint8_t *p_mac,
305 size_t mac_length);
306
322 typedef struct {
326 size_t context_size;
329 psa_drv_se_mac_setup_t p_setup;
332 psa_drv_se_mac_update_t p_update;
335 psa_drv_se_mac_finish_t p_finish;
338 psa_drv_se_mac_finish_verify_t p_finish_verify;
341 psa_drv_se_mac_abort_t p_abort;
344 psa_drv_se_mac_generate_t p_mac;
347 psa_drv_se_mac_verify_t p_mac_verify;
348 } psa_drv_se_mac_t;
390 typedef psa_status_t (*psa_drv_se_cipher_setup_t)(psa_drv_se_context_t *drv_context,
391 void *op_context,
392 psa_key_slot_number_t key_slot,
393 psa_algorithm_t algorithm,
394 psa_encrypt_or_decrypt_t direction);
395
411 typedef psa_status_t (*psa_drv_se_cipher_set_iv_t)(void *op_context,
412 const uint8_t *p_iv,
413 size_t iv_length);
414
433 typedef psa_status_t (*psa_drv_se_cipher_update_t)(void *op_context,
434 const uint8_t *p_input,
435 size_t input_size,
436 uint8_t *p_output,
437 size_t output_size,
438 size_t *p_output_length);
439
454 typedef psa_status_t (*psa_drv_se_cipher_finish_t)(void *op_context,
455 uint8_t *p_output,
456 size_t output_size,
457 size_t *p_output_length);
458
465 typedef psa_status_t (*psa_drv_se_cipher_abort_t)(void *op_context);
466
490 typedef psa_status_t (*psa_drv_se_cipher_ecb_t)(psa_drv_se_context_t *drv_context,
491 psa_key_slot_number_t key_slot,
492 psa_algorithm_t algorithm,
493 psa_encrypt_or_decrypt_t direction,
494 const uint8_t *p_input,
495 size_t input_size,
496 uint8_t *p_output,
497 size_t output_size);
498
509 typedef struct {
513 size_t context_size;
515 psa_drv_se_cipher_setup_t p_setup;
517 psa_drv_se_cipher_set_iv_t p_set_iv;
519 psa_drv_se_cipher_update_t p_update;
521 psa_drv_se_cipher_finish_t p_finish;
523 psa_drv_se_cipher_abort_t p_abort;
528 psa_drv_se_cipher_ecb_t p_ecb;
529 } psa_drv_se_cipher_t;
530
558 typedef psa_status_t (*psa_drv_se_asymmetric_sign_t)(psa_drv_se_context_t *drv_context,
559 psa_key_slot_number_t key_slot,
560 psa_algorithm_t alg,
561 const uint8_t *p_hash,
562 size_t hash_length,
563 uint8_t *p_signature,
564 size_t signature_size,
565 size_t *p_signature_length);
566
584 typedef psa_status_t (*psa_drv_se_asymmetric_verify_t)(psa_drv_se_context_t *drv_context,
585 psa_key_slot_number_t key_slot,
586 psa_algorithm_t alg,
587 const uint8_t *p_hash,
588 size_t hash_length,
589 const uint8_t *p_signature,
590 size_t signature_length);
591
622 typedef psa_status_t (*psa_drv_se_asymmetric_encrypt_t)(psa_drv_se_context_t *drv_context,
623 psa_key_slot_number_t key_slot,
624 psa_algorithm_t alg,
625 const uint8_t *p_input,
626 size_t input_length,
627 const uint8_t *p_salt,
628 size_t salt_length,
629 uint8_t *p_output,
630 size_t output_size,
631 size_t *p_output_length);
632
662 typedef psa_status_t (*psa_drv_se_asymmetric_decrypt_t)(psa_drv_se_context_t *drv_context,
663 psa_key_slot_number_t key_slot,
664 psa_algorithm_t alg,
665 const uint8_t *p_input,
666 size_t input_length,
667 const uint8_t *p_salt,
668 size_t salt_length,
669 uint8_t *p_output,
670 size_t output_size,
671 size_t *p_output_length);
672
682 typedef struct {
684 psa_drv_se_asymmetric_sign_t p_sign;
686 psa_drv_se_asymmetric_verify_t p_verify;
688 psa_drv_se_asymmetric_encrypt_t p_encrypt;
690 psa_drv_se_asymmetric_decrypt_t p_decrypt;
691 } psa_drv_se_asymmetric_t;
692
735 typedef psa_status_t (*psa_drv_se_aead_encrypt_t)(psa_drv_se_context_t *drv_context,
736 psa_key_slot_number_t key_slot,
737 psa_algorithm_t algorithm,
738 const uint8_t *p_nonce,
739 size_t nonce_length,
740 const uint8_t *p_additional_data,
741 size_t additional_data_length,
742 const uint8_t *p_plaintext,
743 size_t plaintext_length,
744 uint8_t *p_ciphertext,
745 size_t ciphertext_size,
746 size_t *p_ciphertext_length);
747
777 typedef psa_status_t (*psa_drv_se_aead_decrypt_t)(psa_drv_se_context_t *drv_context,
778 psa_key_slot_number_t key_slot,
779 psa_algorithm_t algorithm,
780 const uint8_t *p_nonce,
781 size_t nonce_length,
782 const uint8_t *p_additional_data,
783 size_t additional_data_length,
784 const uint8_t *p_ciphertext,
785 size_t ciphertext_length,
786 uint8_t *p_plaintext,
787 size_t plaintext_size,
788 size_t *p_plaintext_length);
789
799 typedef struct {
801 psa_drv_se_aead_encrypt_t p_encrypt;
803 psa_drv_se_aead_decrypt_t p_decrypt;
804 } psa_drv_se_aead_t;
817 typedef enum
818 {
819 PSA_KEY_CREATION_IMPORT,
820 PSA_KEY_CREATION_GENERATE,
821 PSA_KEY_CREATION_DERIVE,
822 PSA_KEY_CREATION_COPY,
824 #ifndef __DOXYGEN_ONLY__
825
842 PSA_KEY_CREATION_REGISTER,
843 #endif
844 } psa_key_creation_method_t;
845
910 typedef psa_status_t (*psa_drv_se_allocate_key_t)(
911 psa_drv_se_context_t *drv_context,
912 void *persistent_data,
913 const psa_key_attributes_t *attributes,
914 psa_key_creation_method_t method,
915 psa_key_slot_number_t *key_slot);
916
956 typedef psa_status_t (*psa_drv_se_validate_slot_number_t)(
957 psa_drv_se_context_t *drv_context,
958 void *persistent_data,
959 const psa_key_attributes_t *attributes,
960 psa_key_creation_method_t method,
961 psa_key_slot_number_t key_slot);
962
992 typedef psa_status_t (*psa_drv_se_import_key_t)(
993 psa_drv_se_context_t *drv_context,
994 psa_key_slot_number_t key_slot,
995 const psa_key_attributes_t *attributes,
996 const uint8_t *data,
997 size_t data_length,
998 size_t *bits);
999
1018 typedef psa_status_t (*psa_drv_se_destroy_key_t)(
1019 psa_drv_se_context_t *drv_context,
1020 void *persistent_data,
1021 psa_key_slot_number_t key_slot);
1022
1054 typedef psa_status_t (*psa_drv_se_export_key_t)(psa_drv_se_context_t *drv_context,
1055 psa_key_slot_number_t key,
1056 uint8_t *p_data,
1057 size_t data_size,
1058 size_t *p_data_length);
1059
1105 typedef psa_status_t (*psa_drv_se_generate_key_t)(
1106 psa_drv_se_context_t *drv_context,
1107 psa_key_slot_number_t key_slot,
1108 const psa_key_attributes_t *attributes,
1109 uint8_t *pubkey, size_t pubkey_size, size_t *pubkey_length);
1110
1120 typedef struct {
1122 psa_drv_se_allocate_key_t p_allocate;
1124 psa_drv_se_validate_slot_number_t p_validate_slot_number;
1126 psa_drv_se_import_key_t p_import;
1128 psa_drv_se_generate_key_t p_generate;
1130 psa_drv_se_destroy_key_t p_destroy;
1132 psa_drv_se_export_key_t p_export;
1134 psa_drv_se_export_key_t p_export_public;
1135 } psa_drv_se_key_management_t;
1136
1200 typedef psa_status_t (*psa_drv_se_key_derivation_setup_t)(psa_drv_se_context_t *drv_context,
1201 void *op_context,
1202 psa_algorithm_t kdf_alg,
1203 psa_key_slot_number_t source_key);
1204
1220 typedef psa_status_t (*psa_drv_se_key_derivation_collateral_t)(void *op_context,
1221 uint32_t collateral_id,
1222 const uint8_t *p_collateral,
1223 size_t collateral_size);
1224
1235 typedef psa_status_t (*psa_drv_se_key_derivation_derive_t)(void *op_context,
1236 psa_key_slot_number_t dest_key);
1237
1249 typedef psa_status_t (*psa_drv_se_key_derivation_export_t)(void *op_context,
1250 uint8_t *p_output,
1251 size_t output_size,
1252 size_t *p_output_length);
1253
1263 typedef struct {
1265 size_t context_size;
1267 psa_drv_se_key_derivation_setup_t p_setup;
1269 psa_drv_se_key_derivation_collateral_t p_collateral;
1271 psa_drv_se_key_derivation_derive_t p_derive;
1274 psa_drv_se_key_derivation_export_t p_export;
1275 } psa_drv_se_key_derivation_t;
1276
1289 typedef struct {
1295 uint32_t hal_version;
1296
1305 size_t persistent_data_size;
1306
1317 psa_drv_se_init_t p_init;
1318
1319 const psa_drv_se_key_management_t *key_management;
1320 const psa_drv_se_mac_t *mac;
1321 const psa_drv_se_cipher_t *cipher;
1322 const psa_drv_se_aead_t *aead;
1323 const psa_drv_se_asymmetric_t *asymmetric;
1324 const psa_drv_se_key_derivation_t *derivation;
1325 } psa_drv_se_t;
1326
1329 /* 0.0.0 patchlevel 5 */
1330 #define PSA_DRV_SE_HAL_VERSION 0x00000005
1331
1382 psa_status_t psa_register_se_driver(
1383 psa_key_location_t location,
1384 const psa_drv_se_t *methods);
1385
1388 #ifdef __cplusplus
1389 }
1390 #endif
1391
1392 #endif /* PSA_CRYPTO_SE_DRIVER_H */
psa_drv_se_key_management_t::p_export_public
psa_drv_se_export_key_t p_export_public
Definition: crypto_se_driver.h:1134
PSA_KEY_CREATION_DERIVE
@ PSA_KEY_CREATION_DERIVE
Definition: crypto_se_driver.h:821
psa_status_t
int32_t psa_status_t
Function return status.
Definition: crypto_types.h:55
psa_drv_se_asymmetric_t::p_sign
psa_drv_se_asymmetric_sign_t p_sign
Definition: crypto_se_driver.h:684
psa_drv_se_key_derivation_t::context_size
size_t context_size
Definition: crypto_se_driver.h:1265
psa_encrypt_or_decrypt_t
psa_encrypt_or_decrypt_t
Definition: crypto_driver_common.h:49
psa_drv_se_mac_t::p_mac
psa_drv_se_mac_generate_t p_mac
Definition: crypto_se_driver.h:344
psa_drv_se_validate_slot_number_t
psa_status_t(* psa_drv_se_validate_slot_number_t)(psa_drv_se_context_t *drv_context, void *persistent_data, const psa_key_attributes_t *attributes, psa_key_creation_method_t method, psa_key_slot_number_t key_slot)
A function that determines whether a slot number is valid for a key.
Definition: crypto_se_driver.h:956
psa_drv_se_t
Definition: crypto_se_driver.h:1289
crypto_driver_common.h
Definitions for all PSA crypto drivers.
psa_key_attributes_s
Definition: crypto_struct.h:343
psa_drv_se_key_management_t::p_destroy
psa_drv_se_destroy_key_t p_destroy
Definition: crypto_se_driver.h:1130
psa_drv_se_key_derivation_setup_t
psa_status_t(* psa_drv_se_key_derivation_setup_t)(psa_drv_se_context_t *drv_context, void *op_context, psa_algorithm_t kdf_alg, psa_key_slot_number_t source_key)
A function that Sets up a secure element key derivation operation by specifying the algorithm and the...
Definition: crypto_se_driver.h:1200
psa_drv_se_context_t
Driver context structure.
Definition: crypto_se_driver.h:55
psa_drv_se_asymmetric_t::p_encrypt
psa_drv_se_asymmetric_encrypt_t p_encrypt
Definition: crypto_se_driver.h:688
psa_drv_se_aead_t::p_decrypt
psa_drv_se_aead_decrypt_t p_decrypt
Definition: crypto_se_driver.h:803
psa_drv_se_key_management_t::p_validate_slot_number
psa_drv_se_validate_slot_number_t p_validate_slot_number
Definition: crypto_se_driver.h:1124
psa_drv_se_t::asymmetric
const psa_drv_se_asymmetric_t * asymmetric
Definition: crypto_se_driver.h:1323
psa_drv_se_key_derivation_derive_t
psa_status_t(* psa_drv_se_key_derivation_derive_t)(void *op_context, psa_key_slot_number_t dest_key)
A function that performs the final secure element key derivation step and place the generated key mat...
Definition: crypto_se_driver.h:1235
psa_key_creation_method_t
psa_key_creation_method_t
Definition: crypto_se_driver.h:818
psa_drv_se_key_management_t::p_import
psa_drv_se_import_key_t p_import
Definition: crypto_se_driver.h:1126
psa_drv_se_import_key_t
psa_status_t(* psa_drv_se_import_key_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, const psa_key_attributes_t *attributes, const uint8_t *data, size_t data_length, size_t *bits)
A function that imports a key into a secure element in binary format.
Definition: crypto_se_driver.h:992
psa_drv_se_aead_decrypt_t
psa_status_t(* psa_drv_se_aead_decrypt_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, const uint8_t *p_nonce, size_t nonce_length, const uint8_t *p_additional_data, size_t additional_data_length, const uint8_t *p_ciphertext, size_t ciphertext_length, uint8_t *p_plaintext, size_t plaintext_size, size_t *p_plaintext_length)
Definition: crypto_se_driver.h:777
psa_drv_se_cipher_t::context_size
size_t context_size
Definition: crypto_se_driver.h:513
psa_drv_se_asymmetric_sign_t
psa_status_t(* psa_drv_se_asymmetric_sign_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t alg, const uint8_t *p_hash, size_t hash_length, uint8_t *p_signature, size_t signature_size, size_t *p_signature_length)
A function that signs a hash or short message with a private key in a secure element.
Definition: crypto_se_driver.h:558
psa_drv_se_t::cipher
const psa_drv_se_cipher_t * cipher
Definition: crypto_se_driver.h:1321
psa_drv_se_destroy_key_t
psa_status_t(* psa_drv_se_destroy_key_t)(psa_drv_se_context_t *drv_context, void *persistent_data, psa_key_slot_number_t key_slot)
A function that destroys a secure element key and restore the slot to its default state.
Definition: crypto_se_driver.h:1018
psa_drv_se_mac_update_t
psa_status_t(* psa_drv_se_mac_update_t)(void *op_context, const uint8_t *p_input, size_t input_length)
A function that continues a previously started secure element MAC operation.
Definition: crypto_se_driver.h:199
psa_drv_se_aead_t
A struct containing all of the function pointers needed to implement secure element Authenticated Enc...
Definition: crypto_se_driver.h:799
psa_drv_se_cipher_ecb_t
psa_status_t(* psa_drv_se_cipher_ecb_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, psa_encrypt_or_decrypt_t direction, const uint8_t *p_input, size_t input_size, uint8_t *p_output, size_t output_size)
A function that performs the ECB block mode for secure element cipher operations.
Definition: crypto_se_driver.h:490
psa_drv_se_generate_key_t
psa_status_t(* psa_drv_se_generate_key_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, const psa_key_attributes_t *attributes, uint8_t *pubkey, size_t pubkey_size, size_t *pubkey_length)
A function that generates a symmetric or asymmetric key on a secure element.
Definition: crypto_se_driver.h:1105
psa_drv_se_asymmetric_decrypt_t
psa_status_t(* psa_drv_se_asymmetric_decrypt_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t alg, 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)
A function that decrypts a short message with an asymmetric private key in a secure element.
Definition: crypto_se_driver.h:662
psa_drv_se_t::persistent_data_size
size_t persistent_data_size
Definition: crypto_se_driver.h:1305
psa_drv_se_key_derivation_collateral_t
psa_status_t(* psa_drv_se_key_derivation_collateral_t)(void *op_context, uint32_t collateral_id, const uint8_t *p_collateral, size_t collateral_size)
A function that provides collateral (parameters) needed for a secure element key derivation or key ag...
Definition: crypto_se_driver.h:1220
psa_drv_se_cipher_finish_t
psa_status_t(* psa_drv_se_cipher_finish_t)(void *op_context, uint8_t *p_output, size_t output_size, size_t *p_output_length)
A function that completes a previously started secure element cipher operation.
Definition: crypto_se_driver.h:454
psa_drv_se_mac_setup_t
psa_status_t(* psa_drv_se_mac_setup_t)(psa_drv_se_context_t *drv_context, void *op_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm)
A function that starts a secure element MAC operation for a PSA Crypto Driver implementation.
Definition: crypto_se_driver.h:184
psa_drv_se_mac_t::p_update
psa_drv_se_mac_update_t p_update
Definition: crypto_se_driver.h:332
psa_key_location_t
uint32_t psa_key_location_t
Definition: crypto_types.h:220
psa_drv_se_cipher_t::p_update
psa_drv_se_cipher_update_t p_update
Definition: crypto_se_driver.h:519
psa_drv_se_mac_t::p_mac_verify
psa_drv_se_mac_verify_t p_mac_verify
Definition: crypto_se_driver.h:347
psa_drv_se_key_management_t
A struct containing all of the function pointers needed to for secure element key management.
Definition: crypto_se_driver.h:1120
psa_drv_se_mac_t::p_finish_verify
psa_drv_se_mac_finish_verify_t p_finish_verify
Definition: crypto_se_driver.h:338
psa_drv_se_key_derivation_t::p_export
psa_drv_se_key_derivation_export_t p_export
Definition: crypto_se_driver.h:1274
psa_drv_se_t::p_init
psa_drv_se_init_t p_init
Definition: crypto_se_driver.h:1317
PSA_KEY_CREATION_IMPORT
@ PSA_KEY_CREATION_IMPORT
Definition: crypto_se_driver.h:819
psa_drv_se_cipher_setup_t
psa_status_t(* psa_drv_se_cipher_setup_t)(psa_drv_se_context_t *drv_context, void *op_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, psa_encrypt_or_decrypt_t direction)
A function that provides the cipher setup function for a secure element driver.
Definition: crypto_se_driver.h:390
psa_drv_se_allocate_key_t
psa_status_t(* psa_drv_se_allocate_key_t)(psa_drv_se_context_t *drv_context, void *persistent_data, const psa_key_attributes_t *attributes, psa_key_creation_method_t method, psa_key_slot_number_t *key_slot)
A function that allocates a slot for a key.
Definition: crypto_se_driver.h:910
psa_drv_se_mac_generate_t
psa_status_t(* psa_drv_se_mac_generate_t)(psa_drv_se_context_t *drv_context, const uint8_t *p_input, size_t input_length, psa_key_slot_number_t key_slot, psa_algorithm_t alg, uint8_t *p_mac, size_t mac_size, size_t *p_mac_length)
A function that performs a secure element MAC operation in one command and returns the calculated MAC...
Definition: crypto_se_driver.h:270
psa_drv_se_cipher_t::p_abort
psa_drv_se_cipher_abort_t p_abort
Definition: crypto_se_driver.h:523
psa_drv_se_key_derivation_t::p_setup
psa_drv_se_key_derivation_setup_t p_setup
Definition: crypto_se_driver.h:1267
psa_drv_se_asymmetric_t
A struct containing all of the function pointers needed to implement asymmetric cryptographic operati...
Definition: crypto_se_driver.h:682
psa_drv_se_cipher_t::p_ecb
psa_drv_se_cipher_ecb_t p_ecb
Definition: crypto_se_driver.h:528
psa_drv_se_mac_finish_t
psa_status_t(* psa_drv_se_mac_finish_t)(void *op_context, uint8_t *p_mac, size_t mac_size, size_t *p_mac_length)
a function that completes a previously started secure element MAC operation by returning the resultin...
Definition: crypto_se_driver.h:219
psa_key_slot_number_t
uint64_t psa_key_slot_number_t
Definition: crypto_se_driver.h:148
psa_drv_se_t::aead
const psa_drv_se_aead_t * aead
Definition: crypto_se_driver.h:1322
psa_drv_se_asymmetric_verify_t
psa_status_t(* psa_drv_se_asymmetric_verify_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t alg, const uint8_t *p_hash, size_t hash_length, const uint8_t *p_signature, size_t signature_length)
A function that verifies the signature a hash or short message using an asymmetric public key in a se...
Definition: crypto_se_driver.h:584
psa_drv_se_key_management_t::p_export
psa_drv_se_export_key_t p_export
Definition: crypto_se_driver.h:1132
psa_algorithm_t
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
Definition: crypto_types.h:98
psa_drv_se_mac_t
A struct containing all of the function pointers needed to perform secure element MAC operations.
Definition: crypto_se_driver.h:322
psa_drv_se_context_t::transient_data
uintptr_t transient_data
Definition: crypto_se_driver.h:114
psa_drv_se_cipher_t::p_setup
psa_drv_se_cipher_setup_t p_setup
Definition: crypto_se_driver.h:515
psa_drv_se_key_derivation_t::p_derive
psa_drv_se_key_derivation_derive_t p_derive
Definition: crypto_se_driver.h:1271
psa_drv_se_mac_finish_verify_t
psa_status_t(* psa_drv_se_mac_finish_verify_t)(void *op_context, const uint8_t *p_mac, size_t mac_length)
A function that completes a previously started secure element MAC operation by comparing the resultin...
Definition: crypto_se_driver.h:240
psa_drv_se_t::hal_version
uint32_t hal_version
Definition: crypto_se_driver.h:1295
psa_drv_se_asymmetric_t::p_decrypt
psa_drv_se_asymmetric_decrypt_t p_decrypt
Definition: crypto_se_driver.h:690
psa_drv_se_context_t::persistent_data
const void *const persistent_data
Definition: crypto_se_driver.h:100
psa_drv_se_cipher_abort_t
psa_status_t(* psa_drv_se_cipher_abort_t)(void *op_context)
A function that aborts a previously started secure element cipher operation.
Definition: crypto_se_driver.h:465
psa_drv_se_export_key_t
psa_status_t(* psa_drv_se_export_key_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key, uint8_t *p_data, size_t data_size, size_t *p_data_length)
A function that exports a secure element key in binary format.
Definition: crypto_se_driver.h:1054
psa_drv_se_key_management_t::p_allocate
psa_drv_se_allocate_key_t p_allocate
Definition: crypto_se_driver.h:1122
psa_drv_se_aead_t::p_encrypt
psa_drv_se_aead_encrypt_t p_encrypt
Definition: crypto_se_driver.h:801
psa_drv_se_init_t
psa_status_t(* psa_drv_se_init_t)(psa_drv_se_context_t *drv_context, void *persistent_data, psa_key_location_t location)
A driver initialization function.
Definition: crypto_se_driver.h:135
psa_register_se_driver
psa_status_t psa_register_se_driver(psa_key_location_t location, const psa_drv_se_t *methods)
psa_drv_se_asymmetric_encrypt_t
psa_status_t(* psa_drv_se_asymmetric_encrypt_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t alg, 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)
A function that encrypts a short message with an asymmetric public key in a secure element.
Definition: crypto_se_driver.h:622
psa_drv_se_cipher_set_iv_t
psa_status_t(* psa_drv_se_cipher_set_iv_t)(void *op_context, const uint8_t *p_iv, size_t iv_length)
A function that sets the initialization vector (if necessary) for an secure element cipher operation.
Definition: crypto_se_driver.h:411
PSA_KEY_CREATION_COPY
@ PSA_KEY_CREATION_COPY
Definition: crypto_se_driver.h:822
psa_drv_se_key_derivation_t::p_collateral
psa_drv_se_key_derivation_collateral_t p_collateral
Definition: crypto_se_driver.h:1269
psa_drv_se_mac_t::context_size
size_t context_size
Definition: crypto_se_driver.h:326
psa_drv_se_cipher_t::p_set_iv
psa_drv_se_cipher_set_iv_t p_set_iv
Definition: crypto_se_driver.h:517
psa_drv_se_cipher_t
A struct containing all of the function pointers needed to implement cipher operations using secure e...
Definition: crypto_se_driver.h:509
psa_drv_se_mac_t::p_finish
psa_drv_se_mac_finish_t p_finish
Definition: crypto_se_driver.h:335
psa_drv_se_asymmetric_t::p_verify
psa_drv_se_asymmetric_verify_t p_verify
Definition: crypto_se_driver.h:686
psa_drv_se_cipher_update_t
psa_status_t(* psa_drv_se_cipher_update_t)(void *op_context, const uint8_t *p_input, size_t input_size, uint8_t *p_output, size_t output_size, size_t *p_output_length)
A function that continues a previously started secure element cipher operation.
Definition: crypto_se_driver.h:433
psa_drv_se_mac_abort_t
psa_status_t(* psa_drv_se_mac_abort_t)(void *op_context)
A function that aborts a previous started secure element MAC operation.
Definition: crypto_se_driver.h:250
psa_drv_se_mac_verify_t
psa_status_t(* psa_drv_se_mac_verify_t)(psa_drv_se_context_t *drv_context, const uint8_t *p_input, size_t input_length, psa_key_slot_number_t key_slot, psa_algorithm_t alg, const uint8_t *p_mac, size_t mac_length)
A function that performs a secure element MAC operation in one command and compares the resulting MAC...
Definition: crypto_se_driver.h:299
psa_drv_se_t::derivation
const psa_drv_se_key_derivation_t * derivation
Definition: crypto_se_driver.h:1324
psa_drv_se_key_management_t::p_generate
psa_drv_se_generate_key_t p_generate
Definition: crypto_se_driver.h:1128
psa_drv_se_key_derivation_t
A struct containing all of the function pointers needed to for secure element key derivation and agre...
Definition: crypto_se_driver.h:1263
PSA_KEY_CREATION_REGISTER
@ PSA_KEY_CREATION_REGISTER
Definition: crypto_se_driver.h:842
psa_drv_se_mac_t::p_abort
psa_drv_se_mac_abort_t p_abort
Definition: crypto_se_driver.h:341
psa_drv_se_key_derivation_export_t
psa_status_t(* psa_drv_se_key_derivation_export_t)(void *op_context, uint8_t *p_output, size_t output_size, size_t *p_output_length)
A function that performs the final step of a secure element key agreement and place the generated key...
Definition: crypto_se_driver.h:1249
psa_drv_se_mac_t::p_setup
psa_drv_se_mac_setup_t p_setup
Definition: crypto_se_driver.h:329
psa_drv_se_t::mac
const psa_drv_se_mac_t * mac
Definition: crypto_se_driver.h:1320
PSA_KEY_CREATION_GENERATE
@ PSA_KEY_CREATION_GENERATE
Definition: crypto_se_driver.h:820
psa_drv_se_t::key_management
const psa_drv_se_key_management_t * key_management
Definition: crypto_se_driver.h:1319
psa_drv_se_aead_encrypt_t
psa_status_t(* psa_drv_se_aead_encrypt_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, const uint8_t *p_nonce, size_t nonce_length, const uint8_t *p_additional_data, size_t additional_data_length, const uint8_t *p_plaintext, size_t plaintext_length, uint8_t *p_ciphertext, size_t ciphertext_size, size_t *p_ciphertext_length)
A function that performs a secure element authenticated encryption operation.
Definition: crypto_se_driver.h:735
psa_drv_se_cipher_t::p_finish
psa_drv_se_cipher_finish_t p_finish
Definition: crypto_se_driver.h:521
psa_drv_se_context_t::persistent_data_size
const size_t persistent_data_size
Definition: crypto_se_driver.h:107