• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
19  *  SPDX-License-Identifier: Apache-2.0
20  *
21  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
22  *  not use this file except in compliance with the License.
23  *  You may obtain a copy of the License at
24  *
25  *  http://www.apache.org/licenses/LICENSE-2.0
26  *
27  *  Unless required by applicable law or agreed to in writing, software
28  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
29  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30  *  See the License for the specific language governing permissions and
31  *  limitations under the License.
32  */
33 
34 #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
35 #define PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
36 
37 #include "psa/crypto_driver_common.h"
38 
39 /* Include the context structure definitions for the Mbed TLS software drivers */
40 #include "psa/crypto_builtin_composites.h"
41 
42 /* Include the context structure definitions for those drivers that were
43  * declared during the autogeneration process. */
44 
45 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
46 #include <libtestdriver1/include/psa/crypto.h>
47 #endif
48 
49 #if defined(PSA_CRYPTO_DRIVER_TEST)
50 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
51     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
52 typedef libtestdriver1_mbedtls_psa_mac_operation_t
53         mbedtls_transparent_test_driver_mac_operation_t;
54 typedef libtestdriver1_mbedtls_psa_mac_operation_t
55         mbedtls_opaque_test_driver_mac_operation_t;
56 
57 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
58         LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
59 #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
60         LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
61 
62 #else
63 typedef mbedtls_psa_mac_operation_t
64         mbedtls_transparent_test_driver_mac_operation_t;
65 typedef mbedtls_psa_mac_operation_t
66         mbedtls_opaque_test_driver_mac_operation_t;
67 
68 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
69         MBEDTLS_PSA_MAC_OPERATION_INIT
70 #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
71         MBEDTLS_PSA_MAC_OPERATION_INIT
72 
73 #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */
74 
75 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
76     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
77 typedef libtestdriver1_mbedtls_psa_aead_operation_t
78         mbedtls_transparent_test_driver_aead_operation_t;
79 
80 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
81         LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT
82 #else
83 typedef mbedtls_psa_aead_operation_t
84         mbedtls_transparent_test_driver_aead_operation_t;
85 
86 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
87         MBEDTLS_PSA_AEAD_OPERATION_INIT
88 
89 #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */
90 
91 #endif /* PSA_CRYPTO_DRIVER_TEST */
92 
93 /* Define the context to be used for an operation that is executed through the
94  * PSA Driver wrapper layer as the union of all possible driver's contexts.
95  *
96  * The union members are the driver's context structures, and the member names
97  * are formatted as `'drivername'_ctx`. This allows for procedural generation
98  * of both this file and the content of psa_crypto_driver_wrappers.c */
99 
100 typedef union {
101     unsigned dummy; /* Make sure this union is always non-empty */
102     mbedtls_psa_mac_operation_t mbedtls_ctx;
103 #if defined(PSA_CRYPTO_DRIVER_TEST)
104     mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx;
105     mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx;
106 #endif
107 } psa_driver_mac_context_t;
108 
109 typedef union {
110     unsigned dummy; /* Make sure this union is always non-empty */
111     mbedtls_psa_aead_operation_t mbedtls_ctx;
112 #if defined(PSA_CRYPTO_DRIVER_TEST)
113     mbedtls_transparent_test_driver_aead_operation_t transparent_test_driver_ctx;
114 #endif
115 } psa_driver_aead_context_t;
116 
117 #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
118 /* End of automatically generated file. */
119