Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-27 09:43:22

0001 /*
0002  *  Declaration of context structures for use with the PSA driver wrapper
0003  *  interface. This file contains the context structures for 'primitive'
0004  *  operations, i.e. those operations which do not rely on other contexts.
0005  *
0006  *  Warning: This file will be auto-generated in the future.
0007  *
0008  * \note This file may not be included directly. Applications must
0009  * include psa/crypto.h.
0010  *
0011  * \note This header and its content are not part of the Mbed TLS API and
0012  * applications must not depend on it. Its main purpose is to define the
0013  * multi-part state objects of the PSA drivers included in the cryptographic
0014  * library. The definitions of these objects are then used by crypto_struct.h
0015  * to define the implementation-defined types of PSA multi-part state objects.
0016  */
0017 /*  Copyright The Mbed TLS Contributors
0018  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
0019  */
0020 
0021 #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
0022 #define PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
0023 
0024 #include "psa/crypto_driver_common.h"
0025 
0026 /* Include the context structure definitions for the Mbed TLS software drivers */
0027 #include "psa/crypto_builtin_primitives.h"
0028 
0029 /* Include the context structure definitions for those drivers that were
0030  * declared during the autogeneration process. */
0031 
0032 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
0033 #include <libtestdriver1/include/psa/crypto.h>
0034 #endif
0035 
0036 #if defined(PSA_CRYPTO_DRIVER_TEST)
0037 
0038 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
0039     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
0040 typedef libtestdriver1_mbedtls_psa_cipher_operation_t
0041     mbedtls_transparent_test_driver_cipher_operation_t;
0042 
0043 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
0044     LIBTESTDRIVER1_MBEDTLS_PSA_CIPHER_OPERATION_INIT
0045 #else
0046 typedef mbedtls_psa_cipher_operation_t
0047     mbedtls_transparent_test_driver_cipher_operation_t;
0048 
0049 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \
0050     MBEDTLS_PSA_CIPHER_OPERATION_INIT
0051 #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
0052           LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER */
0053 
0054 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
0055     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
0056 typedef libtestdriver1_mbedtls_psa_hash_operation_t
0057     mbedtls_transparent_test_driver_hash_operation_t;
0058 
0059 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
0060     LIBTESTDRIVER1_MBEDTLS_PSA_HASH_OPERATION_INIT
0061 #else
0062 typedef mbedtls_psa_hash_operation_t
0063     mbedtls_transparent_test_driver_hash_operation_t;
0064 
0065 #define MBEDTLS_TRANSPARENT_TEST_DRIVER_HASH_OPERATION_INIT \
0066     MBEDTLS_PSA_HASH_OPERATION_INIT
0067 #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 &&
0068           LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH */
0069 
0070 typedef struct {
0071     unsigned int initialised : 1;
0072     mbedtls_transparent_test_driver_cipher_operation_t ctx;
0073 } mbedtls_opaque_test_driver_cipher_operation_t;
0074 
0075 #define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \
0076     { 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT }
0077 
0078 #endif /* PSA_CRYPTO_DRIVER_TEST */
0079 
0080 /* Define the context to be used for an operation that is executed through the
0081  * PSA Driver wrapper layer as the union of all possible driver's contexts.
0082  *
0083  * The union members are the driver's context structures, and the member names
0084  * are formatted as `'drivername'_ctx`. This allows for procedural generation
0085  * of both this file and the content of psa_crypto_driver_wrappers.h */
0086 
0087 typedef union {
0088     unsigned dummy; /* Make sure this union is always non-empty */
0089     mbedtls_psa_hash_operation_t mbedtls_ctx;
0090 #if defined(PSA_CRYPTO_DRIVER_TEST)
0091     mbedtls_transparent_test_driver_hash_operation_t test_driver_ctx;
0092 #endif
0093 } psa_driver_hash_context_t;
0094 
0095 typedef union {
0096     unsigned dummy; /* Make sure this union is always non-empty */
0097     mbedtls_psa_cipher_operation_t mbedtls_ctx;
0098 #if defined(PSA_CRYPTO_DRIVER_TEST)
0099     mbedtls_transparent_test_driver_cipher_operation_t transparent_test_driver_ctx;
0100     mbedtls_opaque_test_driver_cipher_operation_t opaque_test_driver_ctx;
0101 #endif
0102 } psa_driver_cipher_context_t;
0103 
0104 #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H */
0105 /* End of automatically generated file. */