crypto_driver_contexts_composites.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 is 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 definition 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
  20. *
  21. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  22. * not use this file except in compliance with the License.
  23. * You may obtain a copy of the License at
  24. *
  25. * http://www.apache.org/licenses/LICENSE-2.0
  26. *
  27. * Unless required by applicable law or agreed to in writing, software
  28. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  29. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  30. * See the License for the specific language governing permissions and
  31. * limitations under the License.
  32. */
  33. #ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
  34. #define PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
  35. #include "psa/crypto_driver_common.h"
  36. /* Include the context structure definitions for the Mbed TLS software drivers */
  37. #include "psa/crypto_builtin_composites.h"
  38. /* Include the context structure definitions for those drivers that were
  39. * declared during the autogeneration process. */
  40. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
  41. #include <libtestdriver1/include/psa/crypto.h>
  42. #endif
  43. #if defined(PSA_CRYPTO_DRIVER_TEST)
  44. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
  45. defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
  46. typedef libtestdriver1_mbedtls_psa_mac_operation_t
  47. mbedtls_transparent_test_driver_mac_operation_t;
  48. typedef libtestdriver1_mbedtls_psa_mac_operation_t
  49. mbedtls_opaque_test_driver_mac_operation_t;
  50. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
  51. LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
  52. #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
  53. LIBTESTDRIVER1_MBEDTLS_PSA_MAC_OPERATION_INIT
  54. #else
  55. typedef mbedtls_psa_mac_operation_t
  56. mbedtls_transparent_test_driver_mac_operation_t;
  57. typedef mbedtls_psa_mac_operation_t
  58. mbedtls_opaque_test_driver_mac_operation_t;
  59. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_MAC_OPERATION_INIT \
  60. MBEDTLS_PSA_MAC_OPERATION_INIT
  61. #define MBEDTLS_OPAQUE_TEST_DRIVER_MAC_OPERATION_INIT \
  62. MBEDTLS_PSA_MAC_OPERATION_INIT
  63. #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC */
  64. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
  65. defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
  66. typedef libtestdriver1_mbedtls_psa_aead_operation_t
  67. mbedtls_transparent_test_driver_aead_operation_t;
  68. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
  69. LIBTESTDRIVER1_MBEDTLS_PSA_AEAD_OPERATION_INIT
  70. #else
  71. typedef mbedtls_psa_aead_operation_t
  72. mbedtls_transparent_test_driver_aead_operation_t;
  73. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_AEAD_OPERATION_INIT \
  74. MBEDTLS_PSA_AEAD_OPERATION_INIT
  75. #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD */
  76. #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
  77. defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE)
  78. typedef libtestdriver1_mbedtls_psa_pake_operation_t
  79. mbedtls_transparent_test_driver_pake_operation_t;
  80. typedef libtestdriver1_mbedtls_psa_pake_operation_t
  81. mbedtls_opaque_test_driver_pake_operation_t;
  82. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
  83. LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
  84. #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
  85. LIBTESTDRIVER1_MBEDTLS_PSA_PAKE_OPERATION_INIT
  86. #else
  87. typedef mbedtls_psa_pake_operation_t
  88. mbedtls_transparent_test_driver_pake_operation_t;
  89. typedef mbedtls_psa_pake_operation_t
  90. mbedtls_opaque_test_driver_pake_operation_t;
  91. #define MBEDTLS_TRANSPARENT_TEST_DRIVER_PAKE_OPERATION_INIT \
  92. MBEDTLS_PSA_PAKE_OPERATION_INIT
  93. #define MBEDTLS_OPAQUE_TEST_DRIVER_PAKE_OPERATION_INIT \
  94. MBEDTLS_PSA_PAKE_OPERATION_INIT
  95. #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 && LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_PAKE */
  96. #endif /* PSA_CRYPTO_DRIVER_TEST */
  97. /* Define the context to be used for an operation that is executed through the
  98. * PSA Driver wrapper layer as the union of all possible driver's contexts.
  99. *
  100. * The union members are the driver's context structures, and the member names
  101. * are formatted as `'drivername'_ctx`. This allows for procedural generation
  102. * of both this file and the content of psa_crypto_driver_wrappers.c */
  103. typedef union {
  104. unsigned dummy; /* Make sure this union is always non-empty */
  105. mbedtls_psa_mac_operation_t mbedtls_ctx;
  106. #if defined(PSA_CRYPTO_DRIVER_TEST)
  107. mbedtls_transparent_test_driver_mac_operation_t transparent_test_driver_ctx;
  108. mbedtls_opaque_test_driver_mac_operation_t opaque_test_driver_ctx;
  109. #endif
  110. } psa_driver_mac_context_t;
  111. typedef union {
  112. unsigned dummy; /* Make sure this union is always non-empty */
  113. mbedtls_psa_aead_operation_t mbedtls_ctx;
  114. #if defined(PSA_CRYPTO_DRIVER_TEST)
  115. mbedtls_transparent_test_driver_aead_operation_t transparent_test_driver_ctx;
  116. #endif
  117. } psa_driver_aead_context_t;
  118. typedef union {
  119. unsigned dummy; /* Make sure this union is always non-empty */
  120. mbedtls_psa_sign_hash_interruptible_operation_t mbedtls_ctx;
  121. } psa_driver_sign_hash_interruptible_context_t;
  122. typedef union {
  123. unsigned dummy; /* Make sure this union is always non-empty */
  124. mbedtls_psa_verify_hash_interruptible_operation_t mbedtls_ctx;
  125. } psa_driver_verify_hash_interruptible_context_t;
  126. typedef union {
  127. unsigned dummy; /* Make sure this union is always non-empty */
  128. mbedtls_psa_pake_operation_t mbedtls_ctx;
  129. #if defined(PSA_CRYPTO_DRIVER_TEST)
  130. mbedtls_transparent_test_driver_pake_operation_t transparent_test_driver_ctx;
  131. mbedtls_opaque_test_driver_pake_operation_t opaque_test_driver_ctx;
  132. #endif
  133. } psa_driver_pake_context_t;
  134. #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H */
  135. /* End of automatically generated file. */