psa_crypto_driver_wrappers.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /*
  2. * Function signatures for functionality that can be provided by
  3. * cryptographic accelerators.
  4. * Warning: This file will be auto-generated in the future.
  5. */
  6. /* Copyright The Mbed TLS Contributors
  7. * SPDX-License-Identifier: Apache-2.0
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  10. * not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  17. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. */
  21. #ifndef PSA_CRYPTO_DRIVER_WRAPPERS_H
  22. #define PSA_CRYPTO_DRIVER_WRAPPERS_H
  23. #include "psa/crypto.h"
  24. #include "psa/crypto_driver_common.h"
  25. /*
  26. * Initialization and termination functions
  27. */
  28. psa_status_t psa_driver_wrapper_init( void );
  29. void psa_driver_wrapper_free( void );
  30. /*
  31. * Signature functions
  32. */
  33. psa_status_t psa_driver_wrapper_sign_message(
  34. const psa_key_attributes_t *attributes,
  35. const uint8_t *key_buffer,
  36. size_t key_buffer_size,
  37. psa_algorithm_t alg,
  38. const uint8_t *input,
  39. size_t input_length,
  40. uint8_t *signature,
  41. size_t signature_size,
  42. size_t *signature_length );
  43. psa_status_t psa_driver_wrapper_verify_message(
  44. const psa_key_attributes_t *attributes,
  45. const uint8_t *key_buffer,
  46. size_t key_buffer_size,
  47. psa_algorithm_t alg,
  48. const uint8_t *input,
  49. size_t input_length,
  50. const uint8_t *signature,
  51. size_t signature_length );
  52. psa_status_t psa_driver_wrapper_sign_hash(
  53. const psa_key_attributes_t *attributes,
  54. const uint8_t *key_buffer, size_t key_buffer_size,
  55. psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
  56. uint8_t *signature, size_t signature_size, size_t *signature_length );
  57. psa_status_t psa_driver_wrapper_verify_hash(
  58. const psa_key_attributes_t *attributes,
  59. const uint8_t *key_buffer, size_t key_buffer_size,
  60. psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
  61. const uint8_t *signature, size_t signature_length );
  62. /*
  63. * Key handling functions
  64. */
  65. psa_status_t psa_driver_wrapper_import_key(
  66. const psa_key_attributes_t *attributes,
  67. const uint8_t *data, size_t data_length,
  68. uint8_t *key_buffer, size_t key_buffer_size,
  69. size_t *key_buffer_length, size_t *bits );
  70. psa_status_t psa_driver_wrapper_export_key(
  71. const psa_key_attributes_t *attributes,
  72. const uint8_t *key_buffer, size_t key_buffer_size,
  73. uint8_t *data, size_t data_size, size_t *data_length );
  74. psa_status_t psa_driver_wrapper_export_public_key(
  75. const psa_key_attributes_t *attributes,
  76. const uint8_t *key_buffer, size_t key_buffer_size,
  77. uint8_t *data, size_t data_size, size_t *data_length );
  78. psa_status_t psa_driver_wrapper_get_key_buffer_size(
  79. const psa_key_attributes_t *attributes,
  80. size_t *key_buffer_size );
  81. psa_status_t psa_driver_wrapper_generate_key(
  82. const psa_key_attributes_t *attributes,
  83. uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length );
  84. psa_status_t psa_driver_wrapper_get_builtin_key(
  85. psa_drv_slot_number_t slot_number,
  86. psa_key_attributes_t *attributes,
  87. uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length );
  88. /*
  89. * Cipher functions
  90. */
  91. psa_status_t psa_driver_wrapper_cipher_encrypt(
  92. const psa_key_attributes_t *attributes,
  93. const uint8_t *key_buffer,
  94. size_t key_buffer_size,
  95. psa_algorithm_t alg,
  96. const uint8_t *iv,
  97. size_t iv_length,
  98. const uint8_t *input,
  99. size_t input_length,
  100. uint8_t *output,
  101. size_t output_size,
  102. size_t *output_length );
  103. psa_status_t psa_driver_wrapper_cipher_decrypt(
  104. const psa_key_attributes_t *attributes,
  105. const uint8_t *key_buffer,
  106. size_t key_buffer_size,
  107. psa_algorithm_t alg,
  108. const uint8_t *input,
  109. size_t input_length,
  110. uint8_t *output,
  111. size_t output_size,
  112. size_t *output_length );
  113. psa_status_t psa_driver_wrapper_cipher_encrypt_setup(
  114. psa_cipher_operation_t *operation,
  115. const psa_key_attributes_t *attributes,
  116. const uint8_t *key_buffer, size_t key_buffer_size,
  117. psa_algorithm_t alg );
  118. psa_status_t psa_driver_wrapper_cipher_decrypt_setup(
  119. psa_cipher_operation_t *operation,
  120. const psa_key_attributes_t *attributes,
  121. const uint8_t *key_buffer, size_t key_buffer_size,
  122. psa_algorithm_t alg );
  123. psa_status_t psa_driver_wrapper_cipher_set_iv(
  124. psa_cipher_operation_t *operation,
  125. const uint8_t *iv,
  126. size_t iv_length );
  127. psa_status_t psa_driver_wrapper_cipher_update(
  128. psa_cipher_operation_t *operation,
  129. const uint8_t *input,
  130. size_t input_length,
  131. uint8_t *output,
  132. size_t output_size,
  133. size_t *output_length );
  134. psa_status_t psa_driver_wrapper_cipher_finish(
  135. psa_cipher_operation_t *operation,
  136. uint8_t *output,
  137. size_t output_size,
  138. size_t *output_length );
  139. psa_status_t psa_driver_wrapper_cipher_abort(
  140. psa_cipher_operation_t *operation );
  141. /*
  142. * Hashing functions
  143. */
  144. psa_status_t psa_driver_wrapper_hash_compute(
  145. psa_algorithm_t alg,
  146. const uint8_t *input,
  147. size_t input_length,
  148. uint8_t *hash,
  149. size_t hash_size,
  150. size_t *hash_length);
  151. psa_status_t psa_driver_wrapper_hash_setup(
  152. psa_hash_operation_t *operation,
  153. psa_algorithm_t alg );
  154. psa_status_t psa_driver_wrapper_hash_clone(
  155. const psa_hash_operation_t *source_operation,
  156. psa_hash_operation_t *target_operation );
  157. psa_status_t psa_driver_wrapper_hash_update(
  158. psa_hash_operation_t *operation,
  159. const uint8_t *input,
  160. size_t input_length );
  161. psa_status_t psa_driver_wrapper_hash_finish(
  162. psa_hash_operation_t *operation,
  163. uint8_t *hash,
  164. size_t hash_size,
  165. size_t *hash_length );
  166. psa_status_t psa_driver_wrapper_hash_abort(
  167. psa_hash_operation_t *operation );
  168. /*
  169. * AEAD functions
  170. */
  171. psa_status_t psa_driver_wrapper_aead_encrypt(
  172. const psa_key_attributes_t *attributes,
  173. const uint8_t *key_buffer, size_t key_buffer_size,
  174. psa_algorithm_t alg,
  175. const uint8_t *nonce, size_t nonce_length,
  176. const uint8_t *additional_data, size_t additional_data_length,
  177. const uint8_t *plaintext, size_t plaintext_length,
  178. uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length );
  179. psa_status_t psa_driver_wrapper_aead_decrypt(
  180. const psa_key_attributes_t *attributes,
  181. const uint8_t *key_buffer, size_t key_buffer_size,
  182. psa_algorithm_t alg,
  183. const uint8_t *nonce, size_t nonce_length,
  184. const uint8_t *additional_data, size_t additional_data_length,
  185. const uint8_t *ciphertext, size_t ciphertext_length,
  186. uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length );
  187. /*
  188. * MAC functions
  189. */
  190. psa_status_t psa_driver_wrapper_mac_compute(
  191. const psa_key_attributes_t *attributes,
  192. const uint8_t *key_buffer,
  193. size_t key_buffer_size,
  194. psa_algorithm_t alg,
  195. const uint8_t *input,
  196. size_t input_length,
  197. uint8_t *mac,
  198. size_t mac_size,
  199. size_t *mac_length );
  200. psa_status_t psa_driver_wrapper_mac_sign_setup(
  201. psa_mac_operation_t *operation,
  202. const psa_key_attributes_t *attributes,
  203. const uint8_t *key_buffer,
  204. size_t key_buffer_size,
  205. psa_algorithm_t alg );
  206. psa_status_t psa_driver_wrapper_mac_verify_setup(
  207. psa_mac_operation_t *operation,
  208. const psa_key_attributes_t *attributes,
  209. const uint8_t *key_buffer,
  210. size_t key_buffer_size,
  211. psa_algorithm_t alg );
  212. psa_status_t psa_driver_wrapper_mac_update(
  213. psa_mac_operation_t *operation,
  214. const uint8_t *input,
  215. size_t input_length );
  216. psa_status_t psa_driver_wrapper_mac_sign_finish(
  217. psa_mac_operation_t *operation,
  218. uint8_t *mac,
  219. size_t mac_size,
  220. size_t *mac_length );
  221. psa_status_t psa_driver_wrapper_mac_verify_finish(
  222. psa_mac_operation_t *operation,
  223. const uint8_t *mac,
  224. size_t mac_length );
  225. psa_status_t psa_driver_wrapper_mac_abort(
  226. psa_mac_operation_t *operation );
  227. #endif /* PSA_CRYPTO_DRIVER_WRAPPERS_H */
  228. /* End of automatically generated file. */