Mbed TLS v4.1.1
Loading...
Searching...
No Matches
crypto_driver_contexts_primitives.h
Go to the documentation of this file.
1
19/* Copyright The Mbed TLS Contributors
20 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
21 */
22
23#ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
24#define PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
25
27
28/* Include the context structure definitions for the Mbed TLS software drivers */
29#include "mbedtls/private/crypto_builtin_primitives.h"
30
31/* Include the context structure definitions for those drivers that were
32 * declared during the autogeneration process. */
33
34#if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
35#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
36#include "mbedtls/private/libtestdriver1-crypto_builtin_primitives.h"
37#else
38#include <libtestdriver1/tf-psa-crypto/include/psa/crypto.h>
39#endif
40#endif
41
42#if defined(PSA_CRYPTO_DRIVER_TEST)
43
44#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
45 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
46typedef libtestdriver1_mbedtls_psa_cipher_operation_t
47 mbedtls_transparent_test_driver_cipher_operation_t;
48
49#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
50 LIBTESTDRIVER1_MBEDTLS_PSA_CIPHER_OPERATION_INIT
51#else
52typedef mbedtls_psa_cipher_operation_t
53 mbedtls_transparent_test_driver_cipher_operation_t;
54
55#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
56 MBEDTLS_PSA_CIPHER_OPERATION_INIT
57#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
58 LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER */
59
60#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
61 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
62typedef libtestdriver1_mbedtls_psa_hash_operation_t
63 mbedtls_transparent_test_driver_hash_operation_t;
64
65#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
66 LIBTESTDRIVER1_MBEDTLS_PSA_HASH_OPERATION_INIT
67#else
68typedef mbedtls_psa_hash_operation_t
69 mbedtls_transparent_test_driver_hash_operation_t;
70
71#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
72 MBEDTLS_PSA_HASH_OPERATION_INIT
73#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
74 LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH */
75
76#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
77 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_XOF)
78typedef libtestdriver1_mbedtls_psa_xof_operation_t
79 mbedtls_transparent_test_driver_xof_operation_t;
80
81#define MBEDTLS_TRANSPARENT_TEST_DRIVER_XOF_OPERATION_INIT \
82 LIBTESTDRIVER1_MBEDTLS_PSA_XOF_OPERATION_INIT
83#else
84typedef mbedtls_psa_xof_operation_t
85 mbedtls_transparent_test_driver_xof_operation_t;
86
87#define MBEDTLS_TRANSPARENT_TEST_DRIVER_XOF_OPERATION_INIT \
88 MBEDTLS_PSA_XOF_OPERATION_INIT
89#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
90 LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_XOF */
91
92typedef struct {
93 unsigned int initialised : 1;
94 mbedtls_transparent_test_driver_cipher_operation_t ctx;
95} mbedtls_opaque_test_driver_cipher_operation_t;
96
97#define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \
98 { 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT }
99
100#endif /* PSA_CRYPTO_DRIVER_TEST */
101
102/* Define the context to be used for an operation that is executed through the
103 * PSA Driver wrapper layer as the union of all possible driver's contexts.
104 *
105 * The union members are the driver's context structures, and the member names
106 * are formatted as `'drivername'_ctx`. This allows for procedural generation
107 * of both this file and the content of psa_crypto_driver_wrappers.h */
108
109typedef union {
110 unsigned dummy; /* Make sure this union is always non-empty */
111 mbedtls_psa_hash_operation_t mbedtls_ctx;
112#if defined(PSA_CRYPTO_DRIVER_TEST)
113 mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx;
114#endif
116
117typedef union {
118 unsigned dummy; /* Make sure this union is always non-empty */
119 mbedtls_psa_xof_operation_t mbedtls_ctx;
120#if defined(PSA_CRYPTO_DRIVER_TEST)
121 mbedtls_transparent_test_driver_xof_operation_t test_driver_ctx;
122#endif
124
125typedef union {
126 unsigned dummy; /* Make sure this union is always non-empty */
127 mbedtls_psa_cipher_operation_t mbedtls_ctx;
128#if defined(PSA_CRYPTO_DRIVER_TEST)
129 mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx;
130 mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx;
131#endif
133
134#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H */
135/* End of automatically generated file. */
Definitions for all PSA crypto drivers.
mbedtls_psa_cipher_operation_t mbedtls_ctx