Mbed TLS v4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 */
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 #include <libtestdriver1/tf-psa-crypto/include/psa/crypto.h>
36 #endif
37 
38 #if defined(PSA_CRYPTO_DRIVER_TEST)
39 
40 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
41  defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
42 typedef libtestdriver1_mbedtls_psa_cipher_operation_t
43  mbedtls_transparent_test_driver_cipher_operation_t;
44 
45 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
46  LIBTESTDRIVER1_MBEDTLS_PSA_CIPHER_OPERATION_INIT
47 #else
49  mbedtls_transparent_test_driver_cipher_operation_t;
50 
51 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
52  MBEDTLS_PSA_CIPHER_OPERATION_INIT
53 #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
54  LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER */
55 
56 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
57  defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
58 typedef libtestdriver1_mbedtls_psa_hash_operation_t
59  mbedtls_transparent_test_driver_hash_operation_t;
60 
61 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
62  LIBTESTDRIVER1_MBEDTLS_PSA_HASH_OPERATION_INIT
63 #else
65  mbedtls_transparent_test_driver_hash_operation_t;
66 
67 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
68  MBEDTLS_PSA_HASH_OPERATION_INIT
69 #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
70  LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH */
71 
72 typedef struct {
73  unsigned int initialised : 1;
74  mbedtls_transparent_test_driver_cipher_operation_t ctx;
75 } mbedtls_opaque_test_driver_cipher_operation_t;
76 
77 #define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \
78  { 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT }
79 
80 #endif /* PSA_CRYPTO_DRIVER_TEST */
81 
82 /* Define the context to be used for an operation that is executed through the
83  * PSA Driver wrapper layer as the union of all possible driver's contexts.
84  *
85  * The union members are the driver's context structures, and the member names
86  * are formatted as `'drivername'_ctx`. This allows for procedural generation
87  * of both this file and the content of psa_crypto_driver_wrappers.h */
88 
89 typedef union {
90  unsigned dummy; /* Make sure this union is always non-empty */
92 #if defined(PSA_CRYPTO_DRIVER_TEST)
93  mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx;
94 #endif
96 
97 typedef union {
98  unsigned dummy; /* Make sure this union is always non-empty */
100 #if defined(PSA_CRYPTO_DRIVER_TEST)
101  mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx;
102  mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx;
103 #endif
105 
106 #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H */
107 /* End of automatically generated file. */
Context structure declaration of the Mbed TLS software-based PSA drivers called through the PSA Crypt...
mbedtls_psa_cipher_operation_t mbedtls_ctx
mbedtls_psa_hash_operation_t mbedtls_ctx
Definitions for all PSA crypto drivers.