Mbed TLS v2.28.8
Loading...
Searching...
No Matches
crypto_driver_contexts_primitives.h
Go to the documentation of this file.
1/*
2 * Declaration of context structures for use with the PSA driver wrapper
3 * interface. This file contains the context structures for 'primitive'
4 * operations, i.e. those operations which do not rely on other contexts.
5 *
6 * Warning: This file will be auto-generated in the future.
7 *
8 * \note This file may not be included directly. Applications must
9 * include psa/crypto.h.
10 *
11 * \note This header and its content is not part of the Mbed TLS API and
12 * applications must not depend on it. Its main purpose is to define the
13 * multi-part state objects of the PSA drivers included in the cryptographic
14 * library. The definition of these objects are then used by crypto_struct.h
15 * to define the implementation-defined types of PSA multi-part state objects.
16 */
17/* Copyright The Mbed TLS Contributors
18 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
19 */
20
21#ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
22#define PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
23
25
26/* Include the context structure definitions for the Mbed TLS software drivers */
28
29/* Include the context structure definitions for those drivers that were
30 * declared during the autogeneration process. */
31
32#if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
33#include <libtestdriver1/include/psa/crypto.h>
34#endif
35
36#if defined(PSA_CRYPTO_DRIVER_TEST)
37
38#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
39 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
40typedef libtestdriver1_mbedtls_psa_cipher_operation_t
41 mbedtls_transparent_test_driver_cipher_operation_t;
42
43#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
44 LIBTESTDRIVER1_MBEDTLS_PSA_CIPHER_OPERATION_INIT
45#else
47 mbedtls_transparent_test_driver_cipher_operation_t;
48
49#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
50 MBEDTLS_PSA_CIPHER_OPERATION_INIT
51#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
52 LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER */
53
54#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
55 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
56typedef libtestdriver1_mbedtls_psa_hash_operation_t
57 mbedtls_transparent_test_driver_hash_operation_t;
58
59#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
60 LIBTESTDRIVER1_MBEDTLS_PSA_HASH_OPERATION_INIT
61#else
63 mbedtls_transparent_test_driver_hash_operation_t;
64
65#define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
66 MBEDTLS_PSA_HASH_OPERATION_INIT
67#endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
68 LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH */
69
70typedef struct {
71 unsigned int initialised : 1;
72 mbedtls_transparent_test_driver_cipher_operation_t ctx;
73} mbedtls_opaque_test_driver_cipher_operation_t;
74
75#define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \
76 { 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT }
77
78#endif /* PSA_CRYPTO_DRIVER_TEST */
79
80/* Define the context to be used for an operation that is executed through the
81 * PSA Driver wrapper layer as the union of all possible driver's contexts.
82 *
83 * The union members are the driver's context structures, and the member names
84 * are formatted as `'drivername'_ctx`. This allows for procedural generation
85 * of both this file and the content of psa_crypto_driver_wrappers.c */
86
87typedef union {
88 unsigned dummy; /* Make sure this union is always non-empty */
90#if defined(PSA_CRYPTO_DRIVER_TEST)
91 mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx;
92#endif
94
95typedef union {
96 unsigned dummy; /* Make sure this union is always non-empty */
98#if defined(PSA_CRYPTO_DRIVER_TEST)
99 mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx;
100 mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx;
101#endif
103
104#endif /* PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H */
105/* End of automatically generated file. */
Definitions for all PSA crypto drivers.
mbedtls_psa_cipher_operation_t mbedtls_ctx
mbedtls_psa_hash_operation_t mbedtls_ctx