Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Declaration of context structures for use with the PSA driver wrapper |
| 3 | * interface. This file contains the context structures for 'composite' |
| 4 | * operations, i.e. those operations which need to make use of other operations |
| 5 | * from the primitives (crypto_driver_contexts_primitives.h) |
| 6 | * |
| 7 | * Warning: This file will be auto-generated in the future. |
| 8 | * |
| 9 | * \note This file may not be included directly. Applications must |
| 10 | * include psa/crypto.h. |
| 11 | * |
Ronald Cron | 789cef8 | 2023-03-27 16:31:19 +0200 | [diff] [blame] | 12 | * \note This header and its content are not part of the Mbed TLS API and |
Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 13 | * applications must not depend on it. Its main purpose is to define the |
| 14 | * multi-part state objects of the PSA drivers included in the cryptographic |
Ronald Cron | 789cef8 | 2023-03-27 16:31:19 +0200 | [diff] [blame] | 15 | * library. The definitions of these objects are then used by crypto_struct.h |
Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 16 | * to define the implementation-defined types of PSA multi-part state objects. |
| 17 | */ |
| 18 | /* Copyright The Mbed TLS Contributors |
Dave Rodgman | 16799db | 2023-11-02 19:47:20 +0000 | [diff] [blame] | 19 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H |
| 23 | #define PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H |
| 24 | |
| 25 | #include "psa/crypto_driver_common.h" |
| 26 | |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 27 | /* Include the context structure definitions for the Mbed TLS software drivers */ |
| 28 | #include "psa/crypto_builtin_composites.h" |
| 29 | |
Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 30 | /* Include the context structure definitions for those drivers that were |
| 31 | * declared during the autogeneration process. */ |
| 32 | |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 33 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) |
| 34 | #include <libtestdriver1/include/psa/crypto.h> |
| 35 | #endif |
| 36 | |
| 37 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 38 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ |
| 39 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC) |
| 40 | typedef libtestdriver1_mbedtls_psa_mac_operation_t |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 41 | mbedtls_transparent_test_driver_mac_operation_t; |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 42 | typedef libtestdriver1_mbedtls_psa_mac_operation_t |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 43 | mbedtls_opaque_test_driver_mac_operation_t; |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 44 | |
| 45 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 46 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 47 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 48 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 49 | |
| 50 | #else |
| 51 | typedef mbedtls_psa_mac_operation_t |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 52 | mbedtls_transparent_test_driver_mac_operation_t; |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 53 | typedef mbedtls_psa_mac_operation_t |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 54 | mbedtls_opaque_test_driver_mac_operation_t; |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 55 | |
| 56 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 57 | MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 58 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 59 | MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 60 | |
| 61 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */ |
| 62 | |
| 63 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ |
| 64 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD) |
| 65 | typedef libtestdriver1_mbedtls_psa_aead_operation_t |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 66 | mbedtls_transparent_test_driver_aead_operation_t; |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 67 | |
| 68 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 69 | LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 70 | #else |
| 71 | typedef mbedtls_psa_aead_operation_t |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 72 | mbedtls_transparent_test_driver_aead_operation_t; |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 73 | |
| 74 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \ |
Gilles Peskine | 449bd83 | 2023-01-11 14:50:10 +0100 | [diff] [blame] | 75 | MBEDTLS_PSA_AEAD_OPERATION_INIT |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 76 | |
| 77 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */ |
| 78 | |
Przemek Stekiel | 96ae8b9 | 2022-12-07 11:52:08 +0100 | [diff] [blame] | 79 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ |
| 80 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE) |
| 81 | |
| 82 | typedef libtestdriver1_mbedtls_psa_pake_operation_t |
| 83 | mbedtls_transparent_test_driver_pake_operation_t; |
Przemek Stekiel | 251e86a | 2023-02-17 14:30:50 +0100 | [diff] [blame] | 84 | typedef libtestdriver1_mbedtls_psa_pake_operation_t |
Przemek Stekiel | 96ae8b9 | 2022-12-07 11:52:08 +0100 | [diff] [blame] | 85 | mbedtls_opaque_test_driver_pake_operation_t; |
| 86 | |
| 87 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 88 | LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 89 | #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 90 | LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 91 | |
| 92 | #else |
| 93 | typedef mbedtls_psa_pake_operation_t |
| 94 | mbedtls_transparent_test_driver_pake_operation_t; |
| 95 | typedef mbedtls_psa_pake_operation_t |
| 96 | mbedtls_opaque_test_driver_pake_operation_t; |
| 97 | |
| 98 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 99 | MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 100 | #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 101 | MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 102 | |
| 103 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE */ |
| 104 | |
Ronald Cron | 7975fae | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 105 | #endif /* PSA_CRYPTO_DRIVER_TEST */ |
Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 106 | |
| 107 | /* Define the context to be used for an operation that is executed through the |
| 108 | * PSA Driver wrapper layer as the union of all possible driver's contexts. |
| 109 | * |
| 110 | * The union members are the driver's context structures, and the member names |
| 111 | * are formatted as `'drivername'_ctx`. This allows for procedural generation |
Xiaokang Qian | 845693c | 2023-09-12 03:14:54 +0000 | [diff] [blame] | 112 | * of both this file and the content of psa_crypto_driver_wrappers.h */ |
Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 113 | |
Steven Cooreman | d13a70f | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 114 | typedef union { |
| 115 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 116 | mbedtls_psa_mac_operation_t mbedtls_ctx; |
| 117 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 118 | mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx; |
| 119 | mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx; |
| 120 | #endif |
| 121 | } psa_driver_mac_context_t; |
| 122 | |
Paul Elliott | 3dc1c24 | 2021-05-20 18:32:57 +0100 | [diff] [blame] | 123 | typedef union { |
| 124 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 125 | mbedtls_psa_aead_operation_t mbedtls_ctx; |
| 126 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 127 | mbedtls_transparent_test_driver_aead_operation_t transparent_test_driver_ctx; |
| 128 | #endif |
| 129 | } psa_driver_aead_context_t; |
| 130 | |
Paul Elliott | 588f8ed | 2022-12-02 18:10:26 +0000 | [diff] [blame] | 131 | typedef union { |
| 132 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 133 | mbedtls_psa_sign_hash_interruptible_operation_t mbedtls_ctx; |
| 134 | } psa_driver_sign_hash_interruptible_context_t; |
| 135 | |
| 136 | typedef union { |
| 137 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 138 | mbedtls_psa_verify_hash_interruptible_operation_t mbedtls_ctx; |
| 139 | } psa_driver_verify_hash_interruptible_context_t; |
| 140 | |
Przemek Stekiel | 96ae8b9 | 2022-12-07 11:52:08 +0100 | [diff] [blame] | 141 | typedef union { |
| 142 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 143 | mbedtls_psa_pake_operation_t mbedtls_ctx; |
| 144 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 145 | mbedtls_transparent_test_driver_pake_operation_t transparent_test_driver_ctx; |
| 146 | mbedtls_opaque_test_driver_pake_operation_t opaque_test_driver_ctx; |
| 147 | #endif |
| 148 | } psa_driver_pake_context_t; |
| 149 | |
Steven Cooreman | 3c8dd63 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 150 | #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */ |
| 151 | /* End of automatically generated file. */ |