blob: d717c519091abe81d0787312b79db473e8fd999f [file] [log] [blame]
Steven Cooreman3c8dd632021-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 *
Ronald Cron789cef82023-03-27 16:31:19 +020012 * \note This header and its content are not part of the Mbed TLS API and
Steven Cooreman3c8dd632021-04-26 12:16:27 +020013 * 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
Ronald Cron789cef82023-03-27 16:31:19 +020015 * library. The definitions of these objects are then used by crypto_struct.h
Steven Cooreman3c8dd632021-04-26 12:16:27 +020016 * to define the implementation-defined types of PSA multi-part state objects.
17 */
18/* Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +000019 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Steven Cooreman3c8dd632021-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 Cron7975fae2021-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 Cooreman3c8dd632021-04-26 12:16:27 +020030/* Include the context structure definitions for those drivers that were
31 * declared during the autogeneration process. */
32
Ronald Cron7975fae2021-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 Peskine449bd832023-01-11 14:50:10 +010041 mbedtls_transparent_test_driver_mac_operation_t;
Ronald Cron7975fae2021-09-13 14:50:42 +020042typedef libtestdriver1_mbedtls_psa_mac_operation_t
Gilles Peskine449bd832023-01-11 14:50:10 +010043 mbedtls_opaque_test_driver_mac_operation_t;
Ronald Cron7975fae2021-09-13 14:50:42 +020044
45#define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine449bd832023-01-11 14:50:10 +010046 LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cron7975fae2021-09-13 14:50:42 +020047#define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine449bd832023-01-11 14:50:10 +010048 LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cron7975fae2021-09-13 14:50:42 +020049
50#else
51typedef mbedtls_psa_mac_operation_t
Gilles Peskine449bd832023-01-11 14:50:10 +010052 mbedtls_transparent_test_driver_mac_operation_t;
Ronald Cron7975fae2021-09-13 14:50:42 +020053typedef mbedtls_psa_mac_operation_t
Gilles Peskine449bd832023-01-11 14:50:10 +010054 mbedtls_opaque_test_driver_mac_operation_t;
Ronald Cron7975fae2021-09-13 14:50:42 +020055
56#define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine449bd832023-01-11 14:50:10 +010057 MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cron7975fae2021-09-13 14:50:42 +020058#define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
Gilles Peskine449bd832023-01-11 14:50:10 +010059 MBEDTLS_PSA_MAC_OPERATION_INIT
Ronald Cron7975fae2021-09-13 14:50:42 +020060
61#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */
62
63#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
64 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
65typedef libtestdriver1_mbedtls_psa_aead_operation_t
Gilles Peskine449bd832023-01-11 14:50:10 +010066 mbedtls_transparent_test_driver_aead_operation_t;
Ronald Cron7975fae2021-09-13 14:50:42 +020067
68#define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
Gilles Peskine449bd832023-01-11 14:50:10 +010069 LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT
Ronald Cron7975fae2021-09-13 14:50:42 +020070#else
71typedef mbedtls_psa_aead_operation_t
Gilles Peskine449bd832023-01-11 14:50:10 +010072 mbedtls_transparent_test_driver_aead_operation_t;
Ronald Cron7975fae2021-09-13 14:50:42 +020073
74#define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
Gilles Peskine449bd832023-01-11 14:50:10 +010075 MBEDTLS_PSA_AEAD_OPERATION_INIT
Ronald Cron7975fae2021-09-13 14:50:42 +020076
77#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */
78
Przemek Stekiel96ae8b92022-12-07 11:52:08 +010079#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
80 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE)
81
82typedef libtestdriver1_mbedtls_psa_pake_operation_t
83 mbedtls_transparent_test_driver_pake_operation_t;
Przemek Stekiel251e86a2023-02-17 14:30:50 +010084typedef libtestdriver1_mbedtls_psa_pake_operation_t
Przemek Stekiel96ae8b92022-12-07 11:52:08 +010085 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
93typedef mbedtls_psa_pake_operation_t
94 mbedtls_transparent_test_driver_pake_operation_t;
95typedef 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
Ronald Cron7975fae2021-09-13 14:50:42 +0200105#endif /* PSA_CRYPTO_DRIVER_TEST */
Steven Cooreman3c8dd632021-04-26 12:16:27 +0200106
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
Xiaokang Qian845693c2023-09-12 03:14:54 +0000112 * of both this file and the content of psa_crypto_driver_wrappers.h */
Steven Cooreman3c8dd632021-04-26 12:16:27 +0200113
Steven Cooremand13a70f2021-03-19 15:24:23 +0100114typedef 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
Paul Elliott3dc1c242021-05-20 18:32:57 +0100123typedef 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
Paul Elliott588f8ed2022-12-02 18:10:26 +0000131typedef 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
136typedef 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
Przemek Stekiel96ae8b92022-12-07 11:52:08 +0100141typedef 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
Steven Cooreman3c8dd632021-04-26 12:16:27 +0200150#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
151/* End of automatically generated file. */