File indexing completed on 2025-08-27 09:43:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
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
0027 #include "psa/crypto_builtin_primitives.h"
0028
0029
0030
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
0052
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
0068
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
0079
0080
0081
0082
0083
0084
0085
0086
0087 typedef union {
0088 unsigned dummy;
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;
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
0105