xref: /optee_os/lib/libmbedtls/mbedtls/include/psa/crypto_driver_contexts_composites.h (revision b0563631928755fe864b97785160fb3088e9efdc)
132b31808SJens Wiklander /*
232b31808SJens Wiklander  *  Declaration of context structures for use with the PSA driver wrapper
332b31808SJens Wiklander  *  interface. This file contains the context structures for 'composite'
432b31808SJens Wiklander  *  operations, i.e. those operations which need to make use of other operations
532b31808SJens Wiklander  *  from the primitives (crypto_driver_contexts_primitives.h)
632b31808SJens Wiklander  *
732b31808SJens Wiklander  *  Warning: This file will be auto-generated in the future.
832b31808SJens Wiklander  *
932b31808SJens Wiklander  * \note This file may not be included directly. Applications must
1032b31808SJens Wiklander  * include psa/crypto.h.
1132b31808SJens Wiklander  *
12*b0563631STom Van Eyck  * \note This header and its content are not part of the Mbed TLS API and
1332b31808SJens Wiklander  * applications must not depend on it. Its main purpose is to define the
1432b31808SJens Wiklander  * multi-part state objects of the PSA drivers included in the cryptographic
15*b0563631STom Van Eyck  * library. The definitions of these objects are then used by crypto_struct.h
1632b31808SJens Wiklander  * to define the implementation-defined types of PSA multi-part state objects.
1732b31808SJens Wiklander  */
1832b31808SJens Wiklander /*  Copyright The Mbed TLS Contributors
19*b0563631STom Van Eyck  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2032b31808SJens Wiklander  */
2132b31808SJens Wiklander 
2232b31808SJens Wiklander #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
2332b31808SJens Wiklander #define PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
2432b31808SJens Wiklander 
2532b31808SJens Wiklander #include "psa/crypto_driver_common.h"
2632b31808SJens Wiklander 
2732b31808SJens Wiklander /* Include the context structure definitions for the Mbed TLS software drivers */
2832b31808SJens Wiklander #include "psa/crypto_builtin_composites.h"
2932b31808SJens Wiklander 
3032b31808SJens Wiklander /* Include the context structure definitions for those drivers that were
3132b31808SJens Wiklander  * declared during the autogeneration process. */
3232b31808SJens Wiklander 
3332b31808SJens Wiklander #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
3432b31808SJens Wiklander #include <libtestdriver1/include/psa/crypto.h>
3532b31808SJens Wiklander #endif
3632b31808SJens Wiklander 
3732b31808SJens Wiklander #if defined(PSA_CRYPTO_DRIVER_TEST)
3832b31808SJens Wiklander #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
3932b31808SJens Wiklander     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
4032b31808SJens Wiklander typedef libtestdriver1_mbedtls_psa_mac_operation_t
4132b31808SJens Wiklander     mbedtls_transparent_test_driver_mac_operation_t;
4232b31808SJens Wiklander typedef libtestdriver1_mbedtls_psa_mac_operation_t
4332b31808SJens Wiklander     mbedtls_opaque_test_driver_mac_operation_t;
4432b31808SJens Wiklander 
4532b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
4632b31808SJens Wiklander     LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
4732b31808SJens Wiklander #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
4832b31808SJens Wiklander     LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
4932b31808SJens Wiklander 
5032b31808SJens Wiklander #else
5132b31808SJens Wiklander typedef mbedtls_psa_mac_operation_t
5232b31808SJens Wiklander     mbedtls_transparent_test_driver_mac_operation_t;
5332b31808SJens Wiklander typedef mbedtls_psa_mac_operation_t
5432b31808SJens Wiklander     mbedtls_opaque_test_driver_mac_operation_t;
5532b31808SJens Wiklander 
5632b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
5732b31808SJens Wiklander     MBEDTLS_PSA_MAC_OPERATION_INIT
5832b31808SJens Wiklander #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
5932b31808SJens Wiklander     MBEDTLS_PSA_MAC_OPERATION_INIT
6032b31808SJens Wiklander 
6132b31808SJens Wiklander #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */
6232b31808SJens Wiklander 
6332b31808SJens Wiklander #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
6432b31808SJens Wiklander     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
6532b31808SJens Wiklander typedef libtestdriver1_mbedtls_psa_aead_operation_t
6632b31808SJens Wiklander     mbedtls_transparent_test_driver_aead_operation_t;
6732b31808SJens Wiklander 
6832b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
6932b31808SJens Wiklander     LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT
7032b31808SJens Wiklander #else
7132b31808SJens Wiklander typedef mbedtls_psa_aead_operation_t
7232b31808SJens Wiklander     mbedtls_transparent_test_driver_aead_operation_t;
7332b31808SJens Wiklander 
7432b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
7532b31808SJens Wiklander     MBEDTLS_PSA_AEAD_OPERATION_INIT
7632b31808SJens Wiklander 
7732b31808SJens Wiklander #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */
7832b31808SJens Wiklander 
7932b31808SJens Wiklander #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
8032b31808SJens Wiklander     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE)
8132b31808SJens Wiklander 
8232b31808SJens Wiklander typedef libtestdriver1_mbedtls_psa_pake_operation_t
8332b31808SJens Wiklander     mbedtls_transparent_test_driver_pake_operation_t;
8432b31808SJens Wiklander typedef libtestdriver1_mbedtls_psa_pake_operation_t
8532b31808SJens Wiklander     mbedtls_opaque_test_driver_pake_operation_t;
8632b31808SJens Wiklander 
8732b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
8832b31808SJens Wiklander     LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
8932b31808SJens Wiklander #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
9032b31808SJens Wiklander     LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
9132b31808SJens Wiklander 
9232b31808SJens Wiklander #else
9332b31808SJens Wiklander typedef mbedtls_psa_pake_operation_t
9432b31808SJens Wiklander     mbedtls_transparent_test_driver_pake_operation_t;
9532b31808SJens Wiklander typedef mbedtls_psa_pake_operation_t
9632b31808SJens Wiklander     mbedtls_opaque_test_driver_pake_operation_t;
9732b31808SJens Wiklander 
9832b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
9932b31808SJens Wiklander     MBEDTLS_PSA_PAKE_OPERATION_INIT
10032b31808SJens Wiklander #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
10132b31808SJens Wiklander     MBEDTLS_PSA_PAKE_OPERATION_INIT
10232b31808SJens Wiklander 
10332b31808SJens Wiklander #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE */
10432b31808SJens Wiklander 
10532b31808SJens Wiklander #endif /* PSA_CRYPTO_DRIVER_TEST */
10632b31808SJens Wiklander 
10732b31808SJens Wiklander /* Define the context to be used for an operation that is executed through the
10832b31808SJens Wiklander  * PSA Driver wrapper layer as the union of all possible driver's contexts.
10932b31808SJens Wiklander  *
11032b31808SJens Wiklander  * The union members are the driver's context structures, and the member names
11132b31808SJens Wiklander  * are formatted as `'drivername'_ctx`. This allows for procedural generation
112*b0563631STom Van Eyck  * of both this file and the content of psa_crypto_driver_wrappers.h */
11332b31808SJens Wiklander 
11432b31808SJens Wiklander typedef union {
11532b31808SJens Wiklander     unsigned dummy; /* Make sure this union is always non-empty */
11632b31808SJens Wiklander     mbedtls_psa_mac_operation_t mbedtls_ctx;
11732b31808SJens Wiklander #if defined(PSA_CRYPTO_DRIVER_TEST)
11832b31808SJens Wiklander     mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx;
11932b31808SJens Wiklander     mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx;
12032b31808SJens Wiklander #endif
12132b31808SJens Wiklander } psa_driver_mac_context_t;
12232b31808SJens Wiklander 
12332b31808SJens Wiklander typedef union {
12432b31808SJens Wiklander     unsigned dummy; /* Make sure this union is always non-empty */
12532b31808SJens Wiklander     mbedtls_psa_aead_operation_t mbedtls_ctx;
12632b31808SJens Wiklander #if defined(PSA_CRYPTO_DRIVER_TEST)
12732b31808SJens Wiklander     mbedtls_transparent_test_driver_aead_operation_t transparent_test_driver_ctx;
12832b31808SJens Wiklander #endif
12932b31808SJens Wiklander } psa_driver_aead_context_t;
13032b31808SJens Wiklander 
13132b31808SJens Wiklander typedef union {
13232b31808SJens Wiklander     unsigned dummy; /* Make sure this union is always non-empty */
13332b31808SJens Wiklander     mbedtls_psa_sign_hash_interruptible_operation_t mbedtls_ctx;
13432b31808SJens Wiklander } psa_driver_sign_hash_interruptible_context_t;
13532b31808SJens Wiklander 
13632b31808SJens Wiklander typedef union {
13732b31808SJens Wiklander     unsigned dummy; /* Make sure this union is always non-empty */
13832b31808SJens Wiklander     mbedtls_psa_verify_hash_interruptible_operation_t mbedtls_ctx;
13932b31808SJens Wiklander } psa_driver_verify_hash_interruptible_context_t;
14032b31808SJens Wiklander 
14132b31808SJens Wiklander typedef union {
14232b31808SJens Wiklander     unsigned dummy; /* Make sure this union is always non-empty */
14332b31808SJens Wiklander     mbedtls_psa_pake_operation_t mbedtls_ctx;
14432b31808SJens Wiklander #if defined(PSA_CRYPTO_DRIVER_TEST)
14532b31808SJens Wiklander     mbedtls_transparent_test_driver_pake_operation_t transparent_test_driver_ctx;
14632b31808SJens Wiklander     mbedtls_opaque_test_driver_pake_operation_t opaque_test_driver_ctx;
14732b31808SJens Wiklander #endif
14832b31808SJens Wiklander } psa_driver_pake_context_t;
14932b31808SJens Wiklander 
15032b31808SJens Wiklander #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
15132b31808SJens Wiklander /* End of automatically generated file. */
152