Antonio de Angelis | 8bb9851 | 2024-01-16 14:13:36 +0000 | [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 | * |
| 12 | * \note This header and its content are not part of the Mbed TLS API and |
| 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 |
| 15 | * library. The definitions of these objects are then used by crypto_struct.h |
| 16 | * to define the implementation-defined types of PSA multi-part state objects. |
| 17 | */ |
| 18 | /* Copyright The Mbed TLS Contributors |
| 19 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| 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 | |
| 27 | /* Include the context structure definitions for the Mbed TLS software drivers */ |
| 28 | #include "psa/crypto_builtin_composites.h" |
| 29 | |
| 30 | /* Include the context structure definitions for those drivers that were |
| 31 | * declared during the autogeneration process. */ |
| 32 | |
| 33 | #if defined(PSA_CRYPTO_DRIVER_CC3XX) |
| 34 | #include "cc3xx_crypto_primitives_private.h" |
| 35 | #endif |
| 36 | |
| 37 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) |
| 38 | #include <libtestdriver1/include/psa/crypto.h> |
| 39 | #endif |
| 40 | |
| 41 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 42 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ |
| 43 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC) |
| 44 | typedef libtestdriver1_mbedtls_psa_mac_operation_t |
| 45 | mbedtls_transparent_test_driver_mac_operation_t; |
| 46 | typedef libtestdriver1_mbedtls_psa_mac_operation_t |
| 47 | mbedtls_opaque_test_driver_mac_operation_t; |
| 48 | |
| 49 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 50 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
| 51 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 52 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
| 53 | |
| 54 | #else |
| 55 | typedef mbedtls_psa_mac_operation_t |
| 56 | mbedtls_transparent_test_driver_mac_operation_t; |
| 57 | typedef mbedtls_psa_mac_operation_t |
| 58 | mbedtls_opaque_test_driver_mac_operation_t; |
| 59 | |
| 60 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 61 | MBEDTLS_PSA_MAC_OPERATION_INIT |
| 62 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 63 | MBEDTLS_PSA_MAC_OPERATION_INIT |
| 64 | |
| 65 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */ |
| 66 | |
| 67 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ |
| 68 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD) |
| 69 | typedef libtestdriver1_mbedtls_psa_aead_operation_t |
| 70 | mbedtls_transparent_test_driver_aead_operation_t; |
| 71 | |
| 72 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \ |
| 73 | LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT |
| 74 | #else |
| 75 | typedef mbedtls_psa_aead_operation_t |
| 76 | mbedtls_transparent_test_driver_aead_operation_t; |
| 77 | |
| 78 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \ |
| 79 | MBEDTLS_PSA_AEAD_OPERATION_INIT |
| 80 | |
| 81 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */ |
| 82 | |
| 83 | #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ |
| 84 | defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE) |
| 85 | |
| 86 | typedef libtestdriver1_mbedtls_psa_pake_operation_t |
| 87 | mbedtls_transparent_test_driver_pake_operation_t; |
| 88 | typedef libtestdriver1_mbedtls_psa_pake_operation_t |
| 89 | mbedtls_opaque_test_driver_pake_operation_t; |
| 90 | |
| 91 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 92 | LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 93 | #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 94 | LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 95 | |
| 96 | #else |
| 97 | typedef mbedtls_psa_pake_operation_t |
| 98 | mbedtls_transparent_test_driver_pake_operation_t; |
| 99 | typedef mbedtls_psa_pake_operation_t |
| 100 | mbedtls_opaque_test_driver_pake_operation_t; |
| 101 | |
| 102 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 103 | MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 104 | #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \ |
| 105 | MBEDTLS_PSA_PAKE_OPERATION_INIT |
| 106 | |
| 107 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE */ |
| 108 | |
| 109 | #endif /* PSA_CRYPTO_DRIVER_TEST */ |
| 110 | |
| 111 | /* Define the context to be used for an operation that is executed through the |
| 112 | * PSA Driver wrapper layer as the union of all possible driver's contexts. |
| 113 | * |
| 114 | * The union members are the driver's context structures, and the member names |
| 115 | * are formatted as `'drivername'_ctx`. This allows for procedural generation |
| 116 | * of both this file and the content of psa_crypto_driver_wrappers.h */ |
| 117 | |
| 118 | typedef union { |
| 119 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 120 | mbedtls_psa_mac_operation_t mbedtls_ctx; |
| 121 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 122 | mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx; |
| 123 | mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx; |
| 124 | #endif |
| 125 | #if defined(PSA_CRYPTO_DRIVER_CC3XX) |
| 126 | cc3xx_mac_operation_t cc3xx_driver_ctx; |
| 127 | #endif |
| 128 | } psa_driver_mac_context_t; |
| 129 | |
| 130 | typedef union { |
| 131 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 132 | mbedtls_psa_aead_operation_t mbedtls_ctx; |
| 133 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 134 | mbedtls_transparent_test_driver_aead_operation_t transparent_test_driver_ctx; |
| 135 | #endif |
| 136 | #if defined(PSA_CRYPTO_DRIVER_CC3XX) |
| 137 | cc3xx_aead_operation_t cc3xx_driver_ctx; |
| 138 | #endif /* PSA_CRYPTO_DRIVER_CC3XX */ |
| 139 | } psa_driver_aead_context_t; |
| 140 | |
| 141 | typedef union { |
| 142 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 143 | mbedtls_psa_sign_hash_interruptible_operation_t mbedtls_ctx; |
| 144 | } psa_driver_sign_hash_interruptible_context_t; |
| 145 | |
| 146 | typedef union { |
| 147 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 148 | mbedtls_psa_verify_hash_interruptible_operation_t mbedtls_ctx; |
| 149 | } psa_driver_verify_hash_interruptible_context_t; |
| 150 | |
| 151 | typedef union { |
| 152 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 153 | mbedtls_psa_pake_operation_t mbedtls_ctx; |
| 154 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 155 | mbedtls_transparent_test_driver_pake_operation_t transparent_test_driver_ctx; |
| 156 | mbedtls_opaque_test_driver_pake_operation_t opaque_test_driver_ctx; |
| 157 | #endif |
| 158 | } psa_driver_pake_context_t; |
| 159 | |
| 160 | #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */ |
| 161 | /* End of automatically generated file. */ |