Steven Cooreman | aecf0d3 | 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 | * |
| 12 | * \note This header and its content is 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 definition 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 |
Dave Rodgman | 7ff7965 | 2023-11-03 12:04:52 +0000 | [diff] [blame^] | 19 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Steven Cooreman | aecf0d3 | 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 | b814bda | 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 | aecf0d3 | 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 | b814bda | 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 | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 41 | mbedtls_transparent_test_driver_mac_operation_t; |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 42 | typedef libtestdriver1_mbedtls_psa_mac_operation_t |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 43 | mbedtls_opaque_test_driver_mac_operation_t; |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 44 | |
| 45 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 46 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 47 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 48 | LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 49 | |
| 50 | #else |
| 51 | typedef mbedtls_psa_mac_operation_t |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 52 | mbedtls_transparent_test_driver_mac_operation_t; |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 53 | typedef mbedtls_psa_mac_operation_t |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 54 | mbedtls_opaque_test_driver_mac_operation_t; |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 55 | |
| 56 | #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 57 | MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 58 | #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \ |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame] | 59 | MBEDTLS_PSA_MAC_OPERATION_INIT |
Ronald Cron | b814bda | 2021-09-13 14:50:42 +0200 | [diff] [blame] | 60 | |
| 61 | #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 */ |
| 62 | #endif /* PSA_CRYPTO_DRIVER_TEST */ |
Steven Cooreman | aecf0d3 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 63 | |
| 64 | /* Define the context to be used for an operation that is executed through the |
| 65 | * PSA Driver wrapper layer as the union of all possible driver's contexts. |
| 66 | * |
| 67 | * The union members are the driver's context structures, and the member names |
| 68 | * are formatted as `'drivername'_ctx`. This allows for procedural generation |
| 69 | * of both this file and the content of psa_crypto_driver_wrappers.c */ |
| 70 | |
Steven Cooreman | 896d51e | 2021-03-19 15:24:23 +0100 | [diff] [blame] | 71 | typedef union { |
| 72 | unsigned dummy; /* Make sure this union is always non-empty */ |
| 73 | mbedtls_psa_mac_operation_t mbedtls_ctx; |
| 74 | #if defined(PSA_CRYPTO_DRIVER_TEST) |
| 75 | mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx; |
| 76 | mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx; |
| 77 | #endif |
| 78 | } psa_driver_mac_context_t; |
| 79 | |
Steven Cooreman | aecf0d3 | 2021-04-26 12:16:27 +0200 | [diff] [blame] | 80 | #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */ |
| 81 | /* End of automatically generated file. */ |