blob: 1e37682f1a8e05b3b0f3fdeb838cc3db7332b7eb [file] [log] [blame]
Steven Cooremanaecf0d32021-04-26 12:16:27 +02001/*
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 Rodgman7ff79652023-11-03 12:04:52 +000019 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Steven Cooremanaecf0d32021-04-26 12:16:27 +020020 */
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 Cronb814bda2021-09-13 14:50:42 +020027/* Include the context structure definitions for the Mbed TLS software drivers */
28#include "psa/crypto_builtin_composites.h"
29
Steven Cooremanaecf0d32021-04-26 12:16:27 +020030/* Include the context structure definitions for those drivers that were
31 * declared during the autogeneration process. */
32
Ronald Cronb814bda2021-09-13 14:50:42 +020033#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)
40typedef libtestdriver1_mbedtls_psa_mac_operation_t
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010041 mbedtls_transparent_test_driver_mac_operation_t;
Ronald Cronb814bda2021-09-13 14:50:42 +020042typedef libtestdriver1_mbedtls_psa_mac_operation_t
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010043 mbedtls_opaque_test_driver_mac_operation_t;
Ronald Cronb814bda2021-09-13 14:50:42 +020044
45#define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010046 LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cronb814bda2021-09-13 14:50:42 +020047#define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010048 LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cronb814bda2021-09-13 14:50:42 +020049
50#else
51typedef mbedtls_psa_mac_operation_t
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010052 mbedtls_transparent_test_driver_mac_operation_t;
Ronald Cronb814bda2021-09-13 14:50:42 +020053typedef mbedtls_psa_mac_operation_t
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010054 mbedtls_opaque_test_driver_mac_operation_t;
Ronald Cronb814bda2021-09-13 14:50:42 +020055
56#define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010057 MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cronb814bda2021-09-13 14:50:42 +020058#define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010059 MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cronb814bda2021-09-13 14:50:42 +020060
61#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 */
62#endif /* PSA_CRYPTO_DRIVER_TEST */
Steven Cooremanaecf0d32021-04-26 12:16:27 +020063
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 Cooreman896d51e2021-03-19 15:24:23 +010071typedef 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 Cooremanaecf0d32021-04-26 12:16:27 +020080#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
81/* End of automatically generated file. */