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