| 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(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 |
| 41 | mbedtls_transparent_test_driver_mac_operation_t; |
| 42 | typedef libtestdriver1_mbedtls_psa_mac_operation_t |
| 43 | mbedtls_opaque_test_driver_mac_operation_t; |
| 44 | |
| 45 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 46 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
| 47 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 48 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
| 49 | |
| 50 | #else |
| 51 | typedef mbedtls_psa_mac_operation_t |
| 52 | mbedtls_transparent_test_driver_mac_operation_t; |
| 53 | typedef mbedtls_psa_mac_operation_t |
| 54 | mbedtls_opaque_test_driver_mac_operation_t; |
| 55 | |
| 56 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 57 | MBEDTLS_PSA_MAC_OPERATION_INIT |
| 58 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
| 59 | MBEDTLS_PSA_MAC_OPERATION_INIT |
| 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 |
| 66 | mbedtls_transparent_test_driver_aead_operation_t; |
| 67 | |
| 68 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \ |
| 69 | LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT |
| 70 | #else |
| 71 | typedef mbedtls_psa_aead_operation_t |
| 72 | mbedtls_transparent_test_driver_aead_operation_t; |
| 73 | |
| 74 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \ |
| 75 | MBEDTLS_PSA_AEAD_OPERATION_INIT |
| 76 | |
| 77 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */ |
| 78 | |
| 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; |
| 84 | typedef libtestdriver1_mbedtls_psa_pake_operation_t |
| 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 | |
| 105 | #endif /* PSA_CRYPTO_DRIVER_TEST */ |
| 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 |
| 112 | * of both this file and the content of psa_crypto_driver_wrappers.h */ |
| 113 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 150 | #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */ |
| 151 | /* End of automatically generated file. */ |
| 152 | |