crypto_driver_contexts_composites.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * Declaration of context structures for use with the PSA driver wrapper
  3. * interface. This file contains the context structures for 'composite'
  4. * operations, i.e. those operations which need to make use of other operations
  5. * from the primitives (crypto_driver_contexts_primitives.h)
  6. *
  7. * Warning: This file will be auto-generated in the future.
  8. *
  9. * \note This file may not be included directly. Applications must
  10. * include psa/crypto.h.
  11. *
  12. * \note This header and its content are not part of the Mbed TLS API and
  13. * applications must not depend on it. Its main purpose is to define the
  14. * multi-part state objects of the PSA drivers included in the cryptographic
  15. * library. The definitions of these objects are then used by crypto_struct.h
  16. * to define the implementation-defined types of PSA multi-part state objects.
  17. */
  18. /* Copyright The Mbed TLS Contributors
  19. * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
  20. */
  21. #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
  22. #define PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
  23. #include "psa/crypto_driver_common.h"
  24. /* Include the context structure definitions for the Mbed TLS software drivers */
  25. #include "psa/crypto_builtin_composites.h"
  26. /* Include the context structure definitions for those drivers that were
  27. * declared during the autogeneration process. */
  28. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
  29. #include <libtestdriver1/include/psa/crypto.h>
  30. #endif
  31. #if defined(PSA_CRYPTO_DRIVER_TEST)
  32. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
  33. defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
  34. typedef libtestdriver1_mbedtls_psa_mac_operation_t
  35. mbedtls_transparent_test_driver_mac_operation_t;
  36. typedef libtestdriver1_mbedtls_psa_mac_operation_t
  37. mbedtls_opaque_test_driver_mac_operation_t;
  38. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
  39. LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
  40. #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
  41. LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
  42. #else
  43. typedef mbedtls_psa_mac_operation_t
  44. mbedtls_transparent_test_driver_mac_operation_t;
  45. typedef mbedtls_psa_mac_operation_t
  46. mbedtls_opaque_test_driver_mac_operation_t;
  47. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
  48. MBEDTLS_PSA_MAC_OPERATION_INIT
  49. #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
  50. MBEDTLS_PSA_MAC_OPERATION_INIT
  51. #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */
  52. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
  53. defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
  54. typedef libtestdriver1_mbedtls_psa_aead_operation_t
  55. mbedtls_transparent_test_driver_aead_operation_t;
  56. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
  57. LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT
  58. #else
  59. typedef mbedtls_psa_aead_operation_t
  60. mbedtls_transparent_test_driver_aead_operation_t;
  61. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
  62. MBEDTLS_PSA_AEAD_OPERATION_INIT
  63. #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */
  64. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
  65. defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE)
  66. typedef libtestdriver1_mbedtls_psa_pake_operation_t
  67. mbedtls_transparent_test_driver_pake_operation_t;
  68. typedef libtestdriver1_mbedtls_psa_pake_operation_t
  69. mbedtls_opaque_test_driver_pake_operation_t;
  70. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
  71. LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
  72. #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
  73. LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
  74. #else
  75. typedef mbedtls_psa_pake_operation_t
  76. mbedtls_transparent_test_driver_pake_operation_t;
  77. typedef mbedtls_psa_pake_operation_t
  78. mbedtls_opaque_test_driver_pake_operation_t;
  79. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
  80. MBEDTLS_PSA_PAKE_OPERATION_INIT
  81. #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
  82. MBEDTLS_PSA_PAKE_OPERATION_INIT
  83. #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE */
  84. #endif /* PSA_CRYPTO_DRIVER_TEST */
  85. /* Define the context to be used for an operation that is executed through the
  86. * PSA Driver wrapper layer as the union of all possible driver's contexts.
  87. *
  88. * The union members are the driver's context structures, and the member names
  89. * are formatted as `'drivername'_ctx`. This allows for procedural generation
  90. * of both this file and the content of psa_crypto_driver_wrappers.h */
  91. typedef union {
  92. unsigned dummy; /* Make sure this union is always non-empty */
  93. mbedtls_psa_mac_operation_t mbedtls_ctx;
  94. #if defined(PSA_CRYPTO_DRIVER_TEST)
  95. mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx;
  96. mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx;
  97. #endif
  98. } psa_driver_mac_context_t;
  99. typedef union {
  100. unsigned dummy; /* Make sure this union is always non-empty */
  101. mbedtls_psa_aead_operation_t mbedtls_ctx;
  102. #if defined(PSA_CRYPTO_DRIVER_TEST)
  103. mbedtls_transparent_test_driver_aead_operation_t transparent_test_driver_ctx;
  104. #endif
  105. } psa_driver_aead_context_t;
  106. typedef union {
  107. unsigned dummy; /* Make sure this union is always non-empty */
  108. mbedtls_psa_sign_hash_interruptible_operation_t mbedtls_ctx;
  109. } psa_driver_sign_hash_interruptible_context_t;
  110. typedef union {
  111. unsigned dummy; /* Make sure this union is always non-empty */
  112. mbedtls_psa_verify_hash_interruptible_operation_t mbedtls_ctx;
  113. } psa_driver_verify_hash_interruptible_context_t;
  114. typedef union {
  115. unsigned dummy; /* Make sure this union is always non-empty */
  116. mbedtls_psa_pake_operation_t mbedtls_ctx;
  117. #if defined(PSA_CRYPTO_DRIVER_TEST)
  118. mbedtls_transparent_test_driver_pake_operation_t transparent_test_driver_ctx;
  119. mbedtls_opaque_test_driver_pake_operation_t opaque_test_driver_ctx;
  120. #endif
  121. } psa_driver_pake_context_t;
  122. #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
  123. /* End of automatically generated file. */