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