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 'primitive' 432b31808SJens Wiklander * operations, i.e. those operations which do not rely on other contexts. 532b31808SJens Wiklander * 632b31808SJens Wiklander * Warning: This file will be auto-generated in the future. 732b31808SJens Wiklander * 832b31808SJens Wiklander * \note This file may not be included directly. Applications must 932b31808SJens Wiklander * include psa/crypto.h. 1032b31808SJens Wiklander * 11*b0563631STom Van Eyck * \note This header and its content are not part of the Mbed TLS API and 1232b31808SJens Wiklander * applications must not depend on it. Its main purpose is to define the 1332b31808SJens Wiklander * multi-part state objects of the PSA drivers included in the cryptographic 14*b0563631STom Van Eyck * library. The definitions of these objects are then used by crypto_struct.h 1532b31808SJens Wiklander * to define the implementation-defined types of PSA multi-part state objects. 1632b31808SJens Wiklander */ 1732b31808SJens Wiklander /* Copyright The Mbed TLS Contributors 18*b0563631STom Van Eyck * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 1932b31808SJens Wiklander */ 2032b31808SJens Wiklander 2132b31808SJens Wiklander #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H 2232b31808SJens Wiklander #define PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H 2332b31808SJens Wiklander 2432b31808SJens Wiklander #include "psa/crypto_driver_common.h" 2532b31808SJens Wiklander 2632b31808SJens Wiklander /* Include the context structure definitions for the Mbed TLS software drivers */ 2732b31808SJens Wiklander #include "psa/crypto_builtin_primitives.h" 2832b31808SJens Wiklander 2932b31808SJens Wiklander /* Include the context structure definitions for those drivers that were 3032b31808SJens Wiklander * declared during the autogeneration process. */ 3132b31808SJens Wiklander 3232b31808SJens Wiklander #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) 3332b31808SJens Wiklander #include <libtestdriver1/include/psa/crypto.h> 3432b31808SJens Wiklander #endif 3532b31808SJens Wiklander 3632b31808SJens Wiklander #if defined(PSA_CRYPTO_DRIVER_TEST) 3732b31808SJens Wiklander 3832b31808SJens Wiklander #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ 3932b31808SJens Wiklander defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER) 4032b31808SJens Wiklander typedef libtestdriver1_mbedtls_psa_cipher_operation_t 4132b31808SJens Wiklander mbedtls_transparent_test_driver_cipher_operation_t; 4232b31808SJens Wiklander 4332b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \ 4432b31808SJens Wiklander LIBTESTDRIVER1_MBEDTLS_PSA_CIPHER_OPERATION_INIT 4532b31808SJens Wiklander #else 4632b31808SJens Wiklander typedef mbedtls_psa_cipher_operation_t 4732b31808SJens Wiklander mbedtls_transparent_test_driver_cipher_operation_t; 4832b31808SJens Wiklander 4932b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \ 5032b31808SJens Wiklander MBEDTLS_PSA_CIPHER_OPERATION_INIT 5132b31808SJens Wiklander #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && 5232b31808SJens Wiklander LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER */ 5332b31808SJens Wiklander 5432b31808SJens Wiklander #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \ 5532b31808SJens Wiklander defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH) 5632b31808SJens Wiklander typedef libtestdriver1_mbedtls_psa_hash_operation_t 5732b31808SJens Wiklander mbedtls_transparent_test_driver_hash_operation_t; 5832b31808SJens Wiklander 5932b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \ 6032b31808SJens Wiklander LIBTESTDRIVER1_MBEDTLS_PSA_HASH_OPERATION_INIT 6132b31808SJens Wiklander #else 6232b31808SJens Wiklander typedef mbedtls_psa_hash_operation_t 6332b31808SJens Wiklander mbedtls_transparent_test_driver_hash_operation_t; 6432b31808SJens Wiklander 6532b31808SJens Wiklander #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \ 6632b31808SJens Wiklander MBEDTLS_PSA_HASH_OPERATION_INIT 6732b31808SJens Wiklander #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && 6832b31808SJens Wiklander LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH */ 6932b31808SJens Wiklander 7032b31808SJens Wiklander typedef struct { 7132b31808SJens Wiklander unsigned int initialised : 1; 7232b31808SJens Wiklander mbedtls_transparent_test_driver_cipher_operation_t ctx; 7332b31808SJens Wiklander } mbedtls_opaque_test_driver_cipher_operation_t; 7432b31808SJens Wiklander 7532b31808SJens Wiklander #define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \ 7632b31808SJens Wiklander { 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT } 7732b31808SJens Wiklander 7832b31808SJens Wiklander #endif /* PSA_CRYPTO_DRIVER_TEST */ 7932b31808SJens Wiklander 8032b31808SJens Wiklander /* Define the context to be used for an operation that is executed through the 8132b31808SJens Wiklander * PSA Driver wrapper layer as the union of all possible driver's contexts. 8232b31808SJens Wiklander * 8332b31808SJens Wiklander * The union members are the driver's context structures, and the member names 8432b31808SJens Wiklander * are formatted as `'drivername'_ctx`. This allows for procedural generation 85*b0563631STom Van Eyck * of both this file and the content of psa_crypto_driver_wrappers.h */ 8632b31808SJens Wiklander 8732b31808SJens Wiklander typedef union { 8832b31808SJens Wiklander unsigned dummy; /* Make sure this union is always non-empty */ 8932b31808SJens Wiklander mbedtls_psa_hash_operation_t mbedtls_ctx; 9032b31808SJens Wiklander #if defined(PSA_CRYPTO_DRIVER_TEST) 9132b31808SJens Wiklander mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx; 9232b31808SJens Wiklander #endif 9332b31808SJens Wiklander } psa_driver_hash_context_t; 9432b31808SJens Wiklander 9532b31808SJens Wiklander typedef union { 9632b31808SJens Wiklander unsigned dummy; /* Make sure this union is always non-empty */ 9732b31808SJens Wiklander mbedtls_psa_cipher_operation_t mbedtls_ctx; 9832b31808SJens Wiklander #if defined(PSA_CRYPTO_DRIVER_TEST) 9932b31808SJens Wiklander mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx; 10032b31808SJens Wiklander mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx; 10132b31808SJens Wiklander #endif 10232b31808SJens Wiklander } psa_driver_cipher_context_t; 10332b31808SJens Wiklander 10432b31808SJens Wiklander #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H */ 10532b31808SJens Wiklander /* End of automatically generated file. */ 106