react-native-nitro-bsx 0.0.0-stage → 0.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (931) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +7 -2
  3. package/android/CMakeLists.txt +28 -0
  4. package/android/build.gradle +99 -0
  5. package/android/src/main/AndroidManifest.xml +35 -0
  6. package/android/src/main/cpp/cpp-adapter.cpp +12 -0
  7. package/android/src/main/java/com/nitrobsx/BSXAlarmReceiver.kt +29 -0
  8. package/android/src/main/java/com/nitrobsx/BSXAlarmScheduler.kt +112 -0
  9. package/android/src/main/java/com/nitrobsx/BSXForegroundService.kt +78 -0
  10. package/android/src/main/java/com/nitrobsx/BSXNotifications.kt +47 -0
  11. package/android/src/main/java/com/nitrobsx/BSXServiceController.kt +90 -0
  12. package/android/src/main/java/com/nitrobsx/BSXWakeWorker.kt +136 -0
  13. package/android/src/main/java/com/nitrobsx/HeadlessJsTaskSupportShim.kt +41 -0
  14. package/android/src/main/java/com/nitrobsx/NitroBSXPackage.kt +28 -0
  15. package/android/src/main/res/drawable/bsx_ic_stat_swap.xml +9 -0
  16. package/cpp/BSXContext.cpp +263 -0
  17. package/cpp/BSXContext.h +49 -0
  18. package/cpp/BSXModule.cpp +21191 -0
  19. package/cpp/BSXModule.h +1523 -0
  20. package/cpp/CMakeLists.txt +463 -0
  21. package/cpp/HybridNitroBSX.cpp +1483 -0
  22. package/cpp/HybridNitroBSX.hpp +173 -0
  23. package/cpp/arith_uint256.cpp +232 -0
  24. package/cpp/arith_uint256.h +277 -0
  25. package/cpp/bsx/event.cpp +48 -0
  26. package/cpp/bsx/event.h +29 -0
  27. package/cpp/bsx/swap.h +293 -0
  28. package/cpp/bsx/types.cpp +486 -0
  29. package/cpp/bsx/types.h +308 -0
  30. package/cpp/bsx_db.cpp +4951 -0
  31. package/cpp/bsx_db.h +465 -0
  32. package/cpp/chain_client.h +143 -0
  33. package/cpp/cmake/GenVersion.cmake +52 -0
  34. package/cpp/coin_config.h.in +12 -0
  35. package/cpp/coins/block_index.cpp +33 -0
  36. package/cpp/coins/block_index.h +35 -0
  37. package/cpp/coins/btc/chainparams.cpp +70 -0
  38. package/cpp/coins/btc/chainparams.h +23 -0
  39. package/cpp/coins/btc/interface.h +30 -0
  40. package/cpp/coins/btc_base/interface.cpp +2200 -0
  41. package/cpp/coins/btc_base/interface.h +225 -0
  42. package/cpp/coins/btc_base/primitives.cpp +560 -0
  43. package/cpp/coins/btc_base/primitives.h +157 -0
  44. package/cpp/coins/btc_base/psbt.cpp +150 -0
  45. package/cpp/coins/btc_base/psbt.h +52 -0
  46. package/cpp/coins/btc_base/script.cpp +304 -0
  47. package/cpp/coins/btc_base/script.h +181 -0
  48. package/cpp/coins/chainparams.cpp +47 -0
  49. package/cpp/coins/chainparams.h +58 -0
  50. package/cpp/coins/firo/chainparams.cpp +52 -0
  51. package/cpp/coins/firo/chainparams.h +24 -0
  52. package/cpp/coins/firo/firo.cpp +118 -0
  53. package/cpp/coins/firo/firo.h +79 -0
  54. package/cpp/coins/firo/primitives.cpp +109 -0
  55. package/cpp/coins/firo/primitives.h +47 -0
  56. package/cpp/coins/interface.cpp +1815 -0
  57. package/cpp/coins/interface.h +554 -0
  58. package/cpp/coins/ltc/chainparams.cpp +70 -0
  59. package/cpp/coins/ltc/chainparams.h +22 -0
  60. package/cpp/coins/ltc/ltc.cpp +69 -0
  61. package/cpp/coins/ltc/ltc.h +82 -0
  62. package/cpp/coins/ltc/primitives.cpp +20 -0
  63. package/cpp/coins/ltc/primitives.h +18 -0
  64. package/cpp/coins/part/chainparams.cpp +89 -0
  65. package/cpp/coins/part/chainparams.h +47 -0
  66. package/cpp/coins/part/part.cpp +905 -0
  67. package/cpp/coins/part/part.h +164 -0
  68. package/cpp/coins/part/primitives.cpp +548 -0
  69. package/cpp/coins/part/primitives.h +187 -0
  70. package/cpp/coins/part/stake.cpp +330 -0
  71. package/cpp/coins/part/stake.h +92 -0
  72. package/cpp/coins/primitives.h +125 -0
  73. package/cpp/coins/registry.cpp +99 -0
  74. package/cpp/coins/registry.h +32 -0
  75. package/cpp/coins/script.h +18 -0
  76. package/cpp/coins/types.cpp +60 -0
  77. package/cpp/coins/types.h +41 -0
  78. package/cpp/coins/xmr/chainparams.cpp +28 -0
  79. package/cpp/coins/xmr/chainparams.h +24 -0
  80. package/cpp/coins/xmr/tx.cpp +670 -0
  81. package/cpp/coins/xmr/tx.h +77 -0
  82. package/cpp/coins/xmr/xmr.cpp +639 -0
  83. package/cpp/coins/xmr/xmr.h +223 -0
  84. package/cpp/compat/byteswap.h +74 -0
  85. package/cpp/compat/endian.h +98 -0
  86. package/cpp/compat/mbedtls/threading_alt.h +20 -0
  87. package/cpp/compat/sockets.h +160 -0
  88. package/cpp/contrib/mbedtls/CMakeLists.txt +566 -0
  89. package/cpp/contrib/mbedtls/LICENSE +553 -0
  90. package/cpp/contrib/mbedtls/cmake/MbedTLSConfig.cmake.in +3 -0
  91. package/cpp/contrib/mbedtls/doxygen/input/doc_encdec.h +52 -0
  92. package/cpp/contrib/mbedtls/doxygen/input/doc_hashing.h +30 -0
  93. package/cpp/contrib/mbedtls/doxygen/input/doc_mainpage.h +52 -0
  94. package/cpp/contrib/mbedtls/doxygen/input/doc_rng.h +27 -0
  95. package/cpp/contrib/mbedtls/doxygen/input/doc_ssltls.h +37 -0
  96. package/cpp/contrib/mbedtls/doxygen/input/doc_tcpip.h +32 -0
  97. package/cpp/contrib/mbedtls/doxygen/input/doc_x509.h +31 -0
  98. package/cpp/contrib/mbedtls/doxygen/mbedtls.doxyfile +56 -0
  99. package/cpp/contrib/mbedtls/framework/CMakeLists.txt +1 -0
  100. package/cpp/contrib/mbedtls/framework/LICENSE +553 -0
  101. package/cpp/contrib/mbedtls/include/CMakeLists.txt +21 -0
  102. package/cpp/contrib/mbedtls/include/mbedtls/build_info.h +93 -0
  103. package/cpp/contrib/mbedtls/include/mbedtls/debug.h +120 -0
  104. package/cpp/contrib/mbedtls/include/mbedtls/error.h +39 -0
  105. package/cpp/contrib/mbedtls/include/mbedtls/mbedtls_config.h +1189 -0
  106. package/cpp/contrib/mbedtls/include/mbedtls/net_sockets.h +299 -0
  107. package/cpp/contrib/mbedtls/include/mbedtls/oid.h +304 -0
  108. package/cpp/contrib/mbedtls/include/mbedtls/pkcs7.h +250 -0
  109. package/cpp/contrib/mbedtls/include/mbedtls/private/config_adjust_ssl.h +84 -0
  110. package/cpp/contrib/mbedtls/include/mbedtls/private/config_adjust_x509.h +35 -0
  111. package/cpp/contrib/mbedtls/include/mbedtls/ssl.h +5622 -0
  112. package/cpp/contrib/mbedtls/include/mbedtls/ssl_cache.h +187 -0
  113. package/cpp/contrib/mbedtls/include/mbedtls/ssl_ciphersuites.h +303 -0
  114. package/cpp/contrib/mbedtls/include/mbedtls/ssl_cookie.h +90 -0
  115. package/cpp/contrib/mbedtls/include/mbedtls/ssl_ticket.h +186 -0
  116. package/cpp/contrib/mbedtls/include/mbedtls/timing.h +105 -0
  117. package/cpp/contrib/mbedtls/include/mbedtls/version.h +69 -0
  118. package/cpp/contrib/mbedtls/include/mbedtls/x509.h +503 -0
  119. package/cpp/contrib/mbedtls/include/mbedtls/x509_crl.h +180 -0
  120. package/cpp/contrib/mbedtls/include/mbedtls/x509_crt.h +1174 -0
  121. package/cpp/contrib/mbedtls/include/mbedtls/x509_csr.h +368 -0
  122. package/cpp/contrib/mbedtls/library/CMakeLists.txt +375 -0
  123. package/cpp/contrib/mbedtls/library/Makefile +334 -0
  124. package/cpp/contrib/mbedtls/library/debug.c +285 -0
  125. package/cpp/contrib/mbedtls/library/debug_internal.h +108 -0
  126. package/cpp/contrib/mbedtls/library/error.c +505 -0
  127. package/cpp/contrib/mbedtls/library/mbedtls_check_config.h +376 -0
  128. package/cpp/contrib/mbedtls/library/mbedtls_common.h +51 -0
  129. package/cpp/contrib/mbedtls/library/mbedtls_config.c +40 -0
  130. package/cpp/contrib/mbedtls/library/mbedtls_config_check_before.h +1769 -0
  131. package/cpp/contrib/mbedtls/library/mbedtls_config_check_final.h +12 -0
  132. package/cpp/contrib/mbedtls/library/mbedtls_config_check_user.h +2436 -0
  133. package/cpp/contrib/mbedtls/library/mbedtls_platform_requirements.h +55 -0
  134. package/cpp/contrib/mbedtls/library/mbedtls_utils.h +23 -0
  135. package/cpp/contrib/mbedtls/library/mps_common.h +181 -0
  136. package/cpp/contrib/mbedtls/library/mps_error.h +89 -0
  137. package/cpp/contrib/mbedtls/library/mps_reader.c +538 -0
  138. package/cpp/contrib/mbedtls/library/mps_reader.h +366 -0
  139. package/cpp/contrib/mbedtls/library/mps_trace.c +112 -0
  140. package/cpp/contrib/mbedtls/library/mps_trace.h +154 -0
  141. package/cpp/contrib/mbedtls/library/net_sockets.c +684 -0
  142. package/cpp/contrib/mbedtls/library/pkcs7.c +784 -0
  143. package/cpp/contrib/mbedtls/library/ssl_cache.c +409 -0
  144. package/cpp/contrib/mbedtls/library/ssl_ciphersuites.c +996 -0
  145. package/cpp/contrib/mbedtls/library/ssl_ciphersuites_internal.h +108 -0
  146. package/cpp/contrib/mbedtls/library/ssl_client.c +1019 -0
  147. package/cpp/contrib/mbedtls/library/ssl_client.h +18 -0
  148. package/cpp/contrib/mbedtls/library/ssl_cookie.c +251 -0
  149. package/cpp/contrib/mbedtls/library/ssl_debug_helpers.h +83 -0
  150. package/cpp/contrib/mbedtls/library/ssl_debug_helpers_generated.c +243 -0
  151. package/cpp/contrib/mbedtls/library/ssl_misc.h +2851 -0
  152. package/cpp/contrib/mbedtls/library/ssl_msg.c +6275 -0
  153. package/cpp/contrib/mbedtls/library/ssl_ticket.c +453 -0
  154. package/cpp/contrib/mbedtls/library/ssl_tls.c +9048 -0
  155. package/cpp/contrib/mbedtls/library/ssl_tls12_client.c +3054 -0
  156. package/cpp/contrib/mbedtls/library/ssl_tls12_server.c +3546 -0
  157. package/cpp/contrib/mbedtls/library/ssl_tls13_client.c +3202 -0
  158. package/cpp/contrib/mbedtls/library/ssl_tls13_generic.c +1773 -0
  159. package/cpp/contrib/mbedtls/library/ssl_tls13_invasive.h +23 -0
  160. package/cpp/contrib/mbedtls/library/ssl_tls13_keys.c +1860 -0
  161. package/cpp/contrib/mbedtls/library/ssl_tls13_keys.h +668 -0
  162. package/cpp/contrib/mbedtls/library/ssl_tls13_server.c +3602 -0
  163. package/cpp/contrib/mbedtls/library/timing.c +76 -0
  164. package/cpp/contrib/mbedtls/library/version.c +30 -0
  165. package/cpp/contrib/mbedtls/library/version_features.c +244 -0
  166. package/cpp/contrib/mbedtls/library/x509.c +1848 -0
  167. package/cpp/contrib/mbedtls/library/x509_create.c +747 -0
  168. package/cpp/contrib/mbedtls/library/x509_crl.c +701 -0
  169. package/cpp/contrib/mbedtls/library/x509_crt.c +3278 -0
  170. package/cpp/contrib/mbedtls/library/x509_csr.c +642 -0
  171. package/cpp/contrib/mbedtls/library/x509_internal.h +97 -0
  172. package/cpp/contrib/mbedtls/library/x509_oid.c +603 -0
  173. package/cpp/contrib/mbedtls/library/x509_oid.h +150 -0
  174. package/cpp/contrib/mbedtls/library/x509write.c +171 -0
  175. package/cpp/contrib/mbedtls/library/x509write_crt.c +637 -0
  176. package/cpp/contrib/mbedtls/library/x509write_csr.c +317 -0
  177. package/cpp/contrib/mbedtls/pkgconfig/CMakeLists.txt +25 -0
  178. package/cpp/contrib/mbedtls/pkgconfig/JoinPaths.cmake +27 -0
  179. package/cpp/contrib/mbedtls/pkgconfig/mbedcrypto.pc.in +10 -0
  180. package/cpp/contrib/mbedtls/pkgconfig/mbedtls.pc.in +11 -0
  181. package/cpp/contrib/mbedtls/pkgconfig/mbedx509.pc.in +11 -0
  182. package/cpp/contrib/mbedtls/tf-psa-crypto/CMakeLists.txt +584 -0
  183. package/cpp/contrib/mbedtls/tf-psa-crypto/LICENSE +552 -0
  184. package/cpp/contrib/mbedtls/tf-psa-crypto/cmake/TF-PSA-CryptoConfig.cmake.in +3 -0
  185. package/cpp/contrib/mbedtls/tf-psa-crypto/core/CMakeLists.txt +193 -0
  186. package/cpp/contrib/mbedtls/tf-psa-crypto/core/alignment.h +700 -0
  187. package/cpp/contrib/mbedtls/tf-psa-crypto/core/check_crypto_config.h +111 -0
  188. package/cpp/contrib/mbedtls/tf-psa-crypto/core/crypto-library.make +57 -0
  189. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto.c +9820 -0
  190. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_client.c +22 -0
  191. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_core.h +972 -0
  192. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_core_common.h +52 -0
  193. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_driver_wrappers.h +3395 -0
  194. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c +247 -0
  195. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_invasive.h +85 -0
  196. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_its.h +131 -0
  197. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_random.c +168 -0
  198. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_random.h +72 -0
  199. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_random_impl.h +215 -0
  200. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_slot_management.c +998 -0
  201. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_slot_management.h +330 -0
  202. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_storage.c +400 -0
  203. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_storage.h +201 -0
  204. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_its_file.c +254 -0
  205. package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_util.c +295 -0
  206. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_check_config.h +598 -0
  207. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_common.h +628 -0
  208. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config.c +72 -0
  209. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config_check_before.h +12 -0
  210. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config_check_final.h +12 -0
  211. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config_check_user.h +1220 -0
  212. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_platform_requirements.h +62 -0
  213. package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_version.c +28 -0
  214. package/cpp/contrib/mbedtls/tf-psa-crypto/dispatch/psa_crypto_driver_wrappers_no_static.h +31 -0
  215. package/cpp/contrib/mbedtls/tf-psa-crypto/doxygen/input/doc_mainpage.h.in +51 -0
  216. package/cpp/contrib/mbedtls/tf-psa-crypto/doxygen/tfpsacrypto.doxyfile.in +54 -0
  217. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/CMakeLists.txt +142 -0
  218. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/CMakeLists.txt +3 -0
  219. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/aes.h +607 -0
  220. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/aria.h +342 -0
  221. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/bignum.h +1137 -0
  222. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/block_cipher.h +76 -0
  223. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/camellia.h +302 -0
  224. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ccm.h +523 -0
  225. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/chacha20.h +230 -0
  226. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/chachapoly.h +339 -0
  227. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/cipher.h +1173 -0
  228. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/cmac.h +209 -0
  229. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/config_adjust_test_accelerators.h +111 -0
  230. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_adjust_config_enable_builtins.h +820 -0
  231. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_adjust_config_tweak_builtins.h +203 -0
  232. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_builtin_composites.h +278 -0
  233. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_builtin_key_derivation.h +120 -0
  234. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_builtin_primitives.h +136 -0
  235. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ctr_drbg.h +554 -0
  236. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ecdsa.h +667 -0
  237. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ecjpake.h +296 -0
  238. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ecp.h +1452 -0
  239. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/entropy.h +253 -0
  240. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/error_common.h +79 -0
  241. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/gcm.h +382 -0
  242. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/hmac_drbg.h +426 -0
  243. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/md5.h +169 -0
  244. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/pkcs5.h +123 -0
  245. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/poly1305.h +165 -0
  246. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ripemd160.h +120 -0
  247. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/rsa.h +821 -0
  248. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha1.h +196 -0
  249. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha256.h +180 -0
  250. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha3.h +189 -0
  251. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha512.h +188 -0
  252. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private_access.h +53 -0
  253. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aes.c +2236 -0
  254. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesce.c +624 -0
  255. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesce.h +135 -0
  256. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesni.c +846 -0
  257. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesni.h +162 -0
  258. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aria.c +966 -0
  259. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum.c +2635 -0
  260. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core.c +1242 -0
  261. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core.h +885 -0
  262. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core_invasive.h +38 -0
  263. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_internal.h +164 -0
  264. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod.c +394 -0
  265. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod.h +452 -0
  266. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod_raw.c +276 -0
  267. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod_raw.h +416 -0
  268. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod_raw_invasive.h +34 -0
  269. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/block_cipher.c +207 -0
  270. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/block_cipher_internal.h +99 -0
  271. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bn_mul.h +1094 -0
  272. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/camellia.c +1055 -0
  273. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ccm.c +773 -0
  274. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chacha20.c +576 -0
  275. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chacha20_neon.c +294 -0
  276. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chacha20_neon.h +62 -0
  277. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chachapoly.c +479 -0
  278. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher.c +1126 -0
  279. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_invasive.h +28 -0
  280. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_wrap.c +1937 -0
  281. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_wrap.h +173 -0
  282. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cmac.c +911 -0
  283. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ctr.h +35 -0
  284. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ctr_drbg.c +1017 -0
  285. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecdsa.c +826 -0
  286. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecjpake.c +1206 -0
  287. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp.c +3478 -0
  288. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp_curves.c +4798 -0
  289. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp_invasive.h +220 -0
  290. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy.c +677 -0
  291. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy_poll.c +89 -0
  292. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy_poll.h +44 -0
  293. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/gcm.c +1314 -0
  294. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/hmac_drbg.c +639 -0
  295. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/md5.c +419 -0
  296. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/md_psa.h +26 -0
  297. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/poly1305.c +488 -0
  298. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_aead.c +648 -0
  299. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_aead.h +499 -0
  300. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_cipher.c +752 -0
  301. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_cipher.h +314 -0
  302. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c +921 -0
  303. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.h +516 -0
  304. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ffdh.c +781 -0
  305. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ffdh.h +131 -0
  306. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_hash.c +458 -0
  307. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_hash.h +211 -0
  308. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_mac.c +495 -0
  309. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_mac.h +264 -0
  310. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_pake.c +568 -0
  311. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_pake.h +159 -0
  312. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_rsa.c +698 -0
  313. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_rsa.h +321 -0
  314. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_xof.c +149 -0
  315. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_xof.h +155 -0
  316. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_util_internal.c +282 -0
  317. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_util_internal.h +132 -0
  318. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ripemd160.c +482 -0
  319. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa.c +2720 -0
  320. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_alt_helpers.c +294 -0
  321. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_alt_helpers.h +185 -0
  322. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_internal.h +172 -0
  323. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_invasive.h +57 -0
  324. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha1.c +473 -0
  325. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha256.c +956 -0
  326. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha3.c +951 -0
  327. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha512.c +1089 -0
  328. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/driver.cmake +54 -0
  329. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/CMakeLists.txt +45 -0
  330. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/Makefile.inc +5 -0
  331. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/README.md +5 -0
  332. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/Hacl_Curve25519.h +25 -0
  333. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib/FStar_UInt128.h +124 -0
  334. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.h +280 -0
  335. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib.h +29 -0
  336. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/c_endianness.h +206 -0
  337. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/builtin.h +16 -0
  338. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/callconv.h +48 -0
  339. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/compat.h +34 -0
  340. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/debug.h +57 -0
  341. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/target.h +102 -0
  342. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/types.h +61 -0
  343. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/wasmsupport.h +5 -0
  344. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/vs2013/Hacl_Curve25519.h +21 -0
  345. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/x25519.h +48 -0
  346. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/Hacl_Curve25519.c +760 -0
  347. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/Hacl_Curve25519_joined.c +50 -0
  348. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/kremlib/FStar_UInt128_extracted.c +413 -0
  349. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.c +100 -0
  350. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/legacy/Hacl_Curve25519.c +805 -0
  351. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/x25519.c +52 -0
  352. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/CMakeLists.txt +36 -0
  353. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/Makefile.inc +5 -0
  354. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/README.md +4 -0
  355. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m/README.md +544 -0
  356. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m/p256-m.c +1514 -0
  357. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m/p256-m.h +135 -0
  358. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m_driver_entrypoints.c +312 -0
  359. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m_driver_entrypoints.h +219 -0
  360. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/CMakeLists.txt +14 -0
  361. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/Makefile.inc +6 -0
  362. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/include/tf-psa-crypto/private/crypto_struct_pqcp.h +52 -0
  363. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/fips202_psa.h +117 -0
  364. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/pqcp-config.h +68 -0
  365. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/psa_crypto_mldsa.c +528 -0
  366. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/psa_crypto_mldsa.h +301 -0
  367. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/wrap_mldsa_native.c +66 -0
  368. package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/wrap_mldsa_native.h +37 -0
  369. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/CMakeLists.txt +3 -0
  370. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/lmots.c +768 -0
  371. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/lmots.h +272 -0
  372. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/lms.c +772 -0
  373. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/md.c +1182 -0
  374. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/md_wrap.h +46 -0
  375. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/nist_kw.c +458 -0
  376. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk.c +1464 -0
  377. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_ecc.c +175 -0
  378. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_internal.h +188 -0
  379. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_rsa.c +106 -0
  380. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_wrap.c +667 -0
  381. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_wrap.h +101 -0
  382. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pkparse.c +1351 -0
  383. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pkwrite.c +574 -0
  384. package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pkwrite.h +101 -0
  385. package/cpp/contrib/mbedtls/tf-psa-crypto/framework/CMakeLists.txt +1 -0
  386. package/cpp/contrib/mbedtls/tf-psa-crypto/framework/LICENSE +553 -0
  387. package/cpp/contrib/mbedtls/tf-psa-crypto/include/CMakeLists.txt +41 -0
  388. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/asn1.h +623 -0
  389. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/asn1write.h +397 -0
  390. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/base64.h +81 -0
  391. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/compat-3-crypto.h +43 -0
  392. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/constant_time.h +36 -0
  393. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/lms.h +431 -0
  394. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/md.h +538 -0
  395. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/memory_buffer_alloc.h +142 -0
  396. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/nist_kw.h +106 -0
  397. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/pem.h +157 -0
  398. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/pk.h +888 -0
  399. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/platform.h +513 -0
  400. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/platform_time.h +79 -0
  401. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/platform_util.h +197 -0
  402. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/private/pk_private.h +150 -0
  403. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/psa_util.h +199 -0
  404. package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/threading.h +412 -0
  405. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto.h +6082 -0
  406. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_compat.h +74 -0
  407. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_config.h +2073 -0
  408. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_common.h +42 -0
  409. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_contexts_composites.h +182 -0
  410. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_contexts_key_derivation.h +54 -0
  411. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_contexts_primitives.h +135 -0
  412. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_random.h +49 -0
  413. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_extra.h +2115 -0
  414. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_platform.h +94 -0
  415. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_sizes.h +1301 -0
  416. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_struct.h +682 -0
  417. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_types.h +466 -0
  418. package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_values.h +2827 -0
  419. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/build_info.h +193 -0
  420. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_auto_enabled.h +23 -0
  421. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_dependencies.h +58 -0
  422. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_derived.h +135 -0
  423. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_key_pair_types.h +93 -0
  424. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_support.h +211 -0
  425. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_synonyms.h +41 -0
  426. package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/version.h +44 -0
  427. package/cpp/contrib/mbedtls/tf-psa-crypto/objlib.cmake +71 -0
  428. package/cpp/contrib/mbedtls/tf-psa-crypto/pkgconfig/CMakeLists.txt +15 -0
  429. package/cpp/contrib/mbedtls/tf-psa-crypto/pkgconfig/JoinPaths.cmake +27 -0
  430. package/cpp/contrib/mbedtls/tf-psa-crypto/pkgconfig/tfpsacrypto.pc.in +10 -0
  431. package/cpp/contrib/mbedtls/tf-psa-crypto/platform/CMakeLists.txt +3 -0
  432. package/cpp/contrib/mbedtls/tf-psa-crypto/platform/memory_buffer_alloc.c +751 -0
  433. package/cpp/contrib/mbedtls/tf-psa-crypto/platform/platform.c +362 -0
  434. package/cpp/contrib/mbedtls/tf-psa-crypto/platform/platform_util.c +428 -0
  435. package/cpp/contrib/mbedtls/tf-psa-crypto/platform/threading.c +311 -0
  436. package/cpp/contrib/mbedtls/tf-psa-crypto/platform/threading_internal.h +75 -0
  437. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/CMakeLists.txt +3 -0
  438. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/asn1parse.c +483 -0
  439. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/asn1write.c +465 -0
  440. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/base64.c +322 -0
  441. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/base64_internal.h +45 -0
  442. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/constant_time.c +247 -0
  443. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/constant_time_impl.h +514 -0
  444. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/constant_time_internal.h +540 -0
  445. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/crypto_oid.h +354 -0
  446. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/oid.c +469 -0
  447. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/pem.c +458 -0
  448. package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/pkcs5.c +475 -0
  449. package/cpp/contrib/monero/LICENSE +41 -0
  450. package/cpp/contrib/monero/bsx/common/perf_timer.h +15 -0
  451. package/cpp/contrib/monero/bsx/common/threadpool.h +43 -0
  452. package/cpp/contrib/monero/bsx/hex.h +25 -0
  453. package/cpp/contrib/monero/bsx/misc_log_ex.h +61 -0
  454. package/cpp/contrib/monero/bsx/random.cpp +20 -0
  455. package/cpp/contrib/monero/contrib/epee/include/int-util.h +320 -0
  456. package/cpp/contrib/monero/contrib/epee/include/memwipe.h +81 -0
  457. package/cpp/contrib/monero/contrib/epee/include/misc_language.h +109 -0
  458. package/cpp/contrib/monero/contrib/epee/include/mlocker.h +89 -0
  459. package/cpp/contrib/monero/contrib/epee/include/span.h +189 -0
  460. package/cpp/contrib/monero/contrib/epee/include/warnings.h +31 -0
  461. package/cpp/contrib/monero/contrib/epee/src/memwipe.c +115 -0
  462. package/cpp/contrib/monero/contrib/epee/src/mlocker.cpp +197 -0
  463. package/cpp/contrib/monero/src/common/aligned.c +139 -0
  464. package/cpp/contrib/monero/src/common/aligned.h +42 -0
  465. package/cpp/contrib/monero/src/common/base58.cpp +259 -0
  466. package/cpp/contrib/monero/src/common/base58.h +46 -0
  467. package/cpp/contrib/monero/src/common/pod-class.h +43 -0
  468. package/cpp/contrib/monero/src/common/varint.h +138 -0
  469. package/cpp/contrib/monero/src/crypto/chacha.h +96 -0
  470. package/cpp/contrib/monero/src/crypto/crypto-ops-data.c +881 -0
  471. package/cpp/contrib/monero/src/crypto/crypto-ops.c +3891 -0
  472. package/cpp/contrib/monero/src/crypto/crypto-ops.h +167 -0
  473. package/cpp/contrib/monero/src/crypto/crypto.cpp +792 -0
  474. package/cpp/contrib/monero/src/crypto/crypto.h +359 -0
  475. package/cpp/contrib/monero/src/crypto/generic-ops.h +103 -0
  476. package/cpp/contrib/monero/src/crypto/hash-ops.h +105 -0
  477. package/cpp/contrib/monero/src/crypto/hash.c +57 -0
  478. package/cpp/contrib/monero/src/crypto/hash.h +110 -0
  479. package/cpp/contrib/monero/src/crypto/keccak.c +239 -0
  480. package/cpp/contrib/monero/src/crypto/keccak.h +40 -0
  481. package/cpp/contrib/monero/src/crypto/random.h +46 -0
  482. package/cpp/contrib/monero/src/crypto/tree-hash.c +257 -0
  483. package/cpp/contrib/monero/src/crypto/wallet/crypto.h +57 -0
  484. package/cpp/contrib/monero/src/crypto/wallet/ops.h +32 -0
  485. package/cpp/contrib/monero/src/cryptonote_config.h +365 -0
  486. package/cpp/contrib/monero/src/device/device.cpp +105 -0
  487. package/cpp/contrib/monero/src/device/device.hpp +274 -0
  488. package/cpp/contrib/monero/src/device/device_default.cpp +343 -0
  489. package/cpp/contrib/monero/src/device/device_default.hpp +156 -0
  490. package/cpp/contrib/monero/src/ringct/bulletproofs.cc +1097 -0
  491. package/cpp/contrib/monero/src/ringct/bulletproofs.h +51 -0
  492. package/cpp/contrib/monero/src/ringct/bulletproofs_plus.cc +1120 -0
  493. package/cpp/contrib/monero/src/ringct/bulletproofs_plus.h +49 -0
  494. package/cpp/contrib/monero/src/ringct/multiexp.cc +708 -0
  495. package/cpp/contrib/monero/src/ringct/multiexp.h +72 -0
  496. package/cpp/contrib/monero/src/ringct/rctCryptoOps.c +221 -0
  497. package/cpp/contrib/monero/src/ringct/rctCryptoOps.h +37 -0
  498. package/cpp/contrib/monero/src/ringct/rctOps.cpp +727 -0
  499. package/cpp/contrib/monero/src/ringct/rctOps.h +191 -0
  500. package/cpp/contrib/monero/src/ringct/rctSigs.cpp +1652 -0
  501. package/cpp/contrib/monero/src/ringct/rctSigs.h +143 -0
  502. package/cpp/contrib/monero/src/ringct/rctTypes.cpp +338 -0
  503. package/cpp/contrib/monero/src/ringct/rctTypes.h +842 -0
  504. package/cpp/contrib/monero/src/serialization/binary_archive.h +243 -0
  505. package/cpp/contrib/monero/src/serialization/container.h +146 -0
  506. package/cpp/contrib/monero/src/serialization/containers.h +127 -0
  507. package/cpp/contrib/monero/src/serialization/crypto.h +97 -0
  508. package/cpp/contrib/monero/src/serialization/debug_archive.h +53 -0
  509. package/cpp/contrib/monero/src/serialization/json_archive.h +193 -0
  510. package/cpp/contrib/monero/src/serialization/serialization.h +328 -0
  511. package/cpp/contrib/monero/src/serialization/variant.h +50 -0
  512. package/cpp/contrib/nlohmann/LICENSE.MIT +21 -0
  513. package/cpp/contrib/nlohmann/json.hpp +25526 -0
  514. package/cpp/contrib/nlohmann/json_fwd.hpp +187 -0
  515. package/cpp/contrib/notes.txt +96 -0
  516. package/cpp/contrib/secp256k1/CHANGELOG.md +214 -0
  517. package/cpp/contrib/secp256k1/CMakeLists.txt +392 -0
  518. package/cpp/contrib/secp256k1/CMakePresets.json +18 -0
  519. package/cpp/contrib/secp256k1/CONTRIBUTING.md +111 -0
  520. package/cpp/contrib/secp256k1/COPYING +19 -0
  521. package/cpp/contrib/secp256k1/Makefile.am +332 -0
  522. package/cpp/contrib/secp256k1/README.md +176 -0
  523. package/cpp/contrib/secp256k1/SECURITY.md +15 -0
  524. package/cpp/contrib/secp256k1/autogen.sh +3 -0
  525. package/cpp/contrib/secp256k1/ci/ci.sh +147 -0
  526. package/cpp/contrib/secp256k1/ci/linux-debian.Dockerfile +84 -0
  527. package/cpp/contrib/secp256k1/ci/travis.sh +68 -0
  528. package/cpp/contrib/secp256k1/cmake/CheckArm32Assembly.cmake +6 -0
  529. package/cpp/contrib/secp256k1/cmake/CheckMemorySanitizer.cmake +18 -0
  530. package/cpp/contrib/secp256k1/cmake/CheckStringOptionValue.cmake +10 -0
  531. package/cpp/contrib/secp256k1/cmake/CheckX86_64Assembly.cmake +15 -0
  532. package/cpp/contrib/secp256k1/cmake/DiscoverTests.cmake +71 -0
  533. package/cpp/contrib/secp256k1/cmake/FindValgrind.cmake +41 -0
  534. package/cpp/contrib/secp256k1/cmake/GeneratePkgConfigFile.cmake +8 -0
  535. package/cpp/contrib/secp256k1/cmake/TryAppendCFlags.cmake +24 -0
  536. package/cpp/contrib/secp256k1/cmake/arm-linux-gnueabihf.toolchain.cmake +3 -0
  537. package/cpp/contrib/secp256k1/cmake/config.cmake.in +5 -0
  538. package/cpp/contrib/secp256k1/cmake/source_arm32.s +9 -0
  539. package/cpp/contrib/secp256k1/cmake/x86_64-w64-mingw32.toolchain.cmake +3 -0
  540. package/cpp/contrib/secp256k1/configure.ac +590 -0
  541. package/cpp/contrib/secp256k1/contrib/lax_der_parsing.c +148 -0
  542. package/cpp/contrib/secp256k1/contrib/lax_der_parsing.h +97 -0
  543. package/cpp/contrib/secp256k1/contrib/lax_der_privatekey_parsing.c +112 -0
  544. package/cpp/contrib/secp256k1/contrib/lax_der_privatekey_parsing.h +95 -0
  545. package/cpp/contrib/secp256k1/doc/ellswift.md +483 -0
  546. package/cpp/contrib/secp256k1/doc/musig.md +54 -0
  547. package/cpp/contrib/secp256k1/doc/release-process.md +94 -0
  548. package/cpp/contrib/secp256k1/doc/safegcd_implementation.md +819 -0
  549. package/cpp/contrib/secp256k1/examples/CMakeLists.txt +33 -0
  550. package/cpp/contrib/secp256k1/examples/EXAMPLES_COPYING +121 -0
  551. package/cpp/contrib/secp256k1/examples/ecdh.c +121 -0
  552. package/cpp/contrib/secp256k1/examples/ecdsa.c +138 -0
  553. package/cpp/contrib/secp256k1/examples/ellswift.c +122 -0
  554. package/cpp/contrib/secp256k1/examples/examples_util.h +108 -0
  555. package/cpp/contrib/secp256k1/examples/musig.c +261 -0
  556. package/cpp/contrib/secp256k1/examples/schnorr.c +154 -0
  557. package/cpp/contrib/secp256k1/include/secp256k1.h +877 -0
  558. package/cpp/contrib/secp256k1/include/secp256k1_dleag.h +150 -0
  559. package/cpp/contrib/secp256k1/include/secp256k1_ecdh.h +63 -0
  560. package/cpp/contrib/secp256k1/include/secp256k1_ecdsaotves.h +55 -0
  561. package/cpp/contrib/secp256k1/include/secp256k1_ed25519.h +239 -0
  562. package/cpp/contrib/secp256k1/include/secp256k1_ellswift.h +200 -0
  563. package/cpp/contrib/secp256k1/include/secp256k1_extrakeys.h +250 -0
  564. package/cpp/contrib/secp256k1/include/secp256k1_generator.h +106 -0
  565. package/cpp/contrib/secp256k1/include/secp256k1_hash.h +45 -0
  566. package/cpp/contrib/secp256k1/include/secp256k1_musig.h +588 -0
  567. package/cpp/contrib/secp256k1/include/secp256k1_preallocated.h +134 -0
  568. package/cpp/contrib/secp256k1/include/secp256k1_recovery.h +123 -0
  569. package/cpp/contrib/secp256k1/include/secp256k1_schnorrsig.h +190 -0
  570. package/cpp/contrib/secp256k1/include/visibility.h +58 -0
  571. package/cpp/contrib/secp256k1/libsecp256k1.pc.in +12 -0
  572. package/cpp/contrib/secp256k1/sage/gen_exhaustive_groups.sage +156 -0
  573. package/cpp/contrib/secp256k1/sage/gen_split_lambda_constants.sage +123 -0
  574. package/cpp/contrib/secp256k1/sage/group_prover.sage +353 -0
  575. package/cpp/contrib/secp256k1/sage/prove_group_implementations.sage +285 -0
  576. package/cpp/contrib/secp256k1/sage/secp256k1_params.sage +39 -0
  577. package/cpp/contrib/secp256k1/sage/weierstrass_prover.sage +275 -0
  578. package/cpp/contrib/secp256k1/src/CMakeLists.txt +253 -0
  579. package/cpp/contrib/secp256k1/src/asm/field_10x26_arm.s +916 -0
  580. package/cpp/contrib/secp256k1/src/assumptions.h +87 -0
  581. package/cpp/contrib/secp256k1/src/checkmem.h +117 -0
  582. package/cpp/contrib/secp256k1/src/ecdsa.h +21 -0
  583. package/cpp/contrib/secp256k1/src/ecdsa_impl.h +312 -0
  584. package/cpp/contrib/secp256k1/src/eckey.h +28 -0
  585. package/cpp/contrib/secp256k1/src/eckey_impl.h +94 -0
  586. package/cpp/contrib/secp256k1/src/ecmult.h +64 -0
  587. package/cpp/contrib/secp256k1/src/ecmult_compute_table.h +16 -0
  588. package/cpp/contrib/secp256k1/src/ecmult_compute_table_impl.h +49 -0
  589. package/cpp/contrib/secp256k1/src/ecmult_const.h +38 -0
  590. package/cpp/contrib/secp256k1/src/ecmult_const_impl.h +402 -0
  591. package/cpp/contrib/secp256k1/src/ecmult_gen.h +144 -0
  592. package/cpp/contrib/secp256k1/src/ecmult_gen_compute_table.h +14 -0
  593. package/cpp/contrib/secp256k1/src/ecmult_gen_compute_table_impl.h +108 -0
  594. package/cpp/contrib/secp256k1/src/ecmult_gen_impl.h +341 -0
  595. package/cpp/contrib/secp256k1/src/ecmult_impl.h +869 -0
  596. package/cpp/contrib/secp256k1/src/field.h +354 -0
  597. package/cpp/contrib/secp256k1/src/field_10x26.h +57 -0
  598. package/cpp/contrib/secp256k1/src/field_10x26_impl.h +1234 -0
  599. package/cpp/contrib/secp256k1/src/field_5x52.h +62 -0
  600. package/cpp/contrib/secp256k1/src/field_5x52_impl.h +524 -0
  601. package/cpp/contrib/secp256k1/src/field_5x52_int128_impl.h +274 -0
  602. package/cpp/contrib/secp256k1/src/field_impl.h +462 -0
  603. package/cpp/contrib/secp256k1/src/group.h +224 -0
  604. package/cpp/contrib/secp256k1/src/group_impl.h +1024 -0
  605. package/cpp/contrib/secp256k1/src/hash.h +54 -0
  606. package/cpp/contrib/secp256k1/src/hash_impl.h +360 -0
  607. package/cpp/contrib/secp256k1/src/hsort.h +33 -0
  608. package/cpp/contrib/secp256k1/src/hsort_impl.h +125 -0
  609. package/cpp/contrib/secp256k1/src/int128.h +90 -0
  610. package/cpp/contrib/secp256k1/src/int128_impl.h +18 -0
  611. package/cpp/contrib/secp256k1/src/int128_native.h +19 -0
  612. package/cpp/contrib/secp256k1/src/int128_native_impl.h +94 -0
  613. package/cpp/contrib/secp256k1/src/int128_struct.h +14 -0
  614. package/cpp/contrib/secp256k1/src/int128_struct_impl.h +205 -0
  615. package/cpp/contrib/secp256k1/src/modinv32.h +43 -0
  616. package/cpp/contrib/secp256k1/src/modinv32_impl.h +725 -0
  617. package/cpp/contrib/secp256k1/src/modinv64.h +47 -0
  618. package/cpp/contrib/secp256k1/src/modinv64_impl.h +780 -0
  619. package/cpp/contrib/secp256k1/src/modules/dleag/Makefile.am.include +3 -0
  620. package/cpp/contrib/secp256k1/src/modules/dleag/main_impl.h +1073 -0
  621. package/cpp/contrib/secp256k1/src/modules/dleag/tests_impl.h +68 -0
  622. package/cpp/contrib/secp256k1/src/modules/ecdh/Makefile.am.include +5 -0
  623. package/cpp/contrib/secp256k1/src/modules/ecdh/bench_impl.h +54 -0
  624. package/cpp/contrib/secp256k1/src/modules/ecdh/main_impl.h +79 -0
  625. package/cpp/contrib/secp256k1/src/modules/ecdh/tests_impl.h +218 -0
  626. package/cpp/contrib/secp256k1/src/modules/ecdsaotves/Makefile.am.include +3 -0
  627. package/cpp/contrib/secp256k1/src/modules/ecdsaotves/main_impl.h +365 -0
  628. package/cpp/contrib/secp256k1/src/modules/ecdsaotves/tests_impl.h +49 -0
  629. package/cpp/contrib/secp256k1/src/modules/ed25519/Makefile.am.include +16 -0
  630. package/cpp/contrib/secp256k1/src/modules/ed25519/common.h +68 -0
  631. package/cpp/contrib/secp256k1/src/modules/ed25519/core_ed25519.h +229 -0
  632. package/cpp/contrib/secp256k1/src/modules/ed25519/main_impl.h +98 -0
  633. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/common.h +21 -0
  634. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/ed25519_ref10.h +2698 -0
  635. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/ed25519_ref10_fe_25_5.h +1056 -0
  636. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/ed25519_ref10_fe_51.h +518 -0
  637. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/base.h +1344 -0
  638. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/base2.h +40 -0
  639. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/constants.h +40 -0
  640. package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/fe.h +220 -0
  641. package/cpp/contrib/secp256k1/src/modules/ed25519/scalarmult_ed25519_ref10.h +417 -0
  642. package/cpp/contrib/secp256k1/src/modules/ed25519/sha512/hash_sha512.h +14 -0
  643. package/cpp/contrib/secp256k1/src/modules/ed25519/sha512/hash_sha512_cp.h +287 -0
  644. package/cpp/contrib/secp256k1/src/modules/ed25519/tests_impl.h +109 -0
  645. package/cpp/contrib/secp256k1/src/modules/ed25519/utils.h +97 -0
  646. package/cpp/contrib/secp256k1/src/modules/ellswift/Makefile.am.include +5 -0
  647. package/cpp/contrib/secp256k1/src/modules/ellswift/bench_impl.h +106 -0
  648. package/cpp/contrib/secp256k1/src/modules/ellswift/main_impl.h +581 -0
  649. package/cpp/contrib/secp256k1/src/modules/ellswift/tests_exhaustive_impl.h +39 -0
  650. package/cpp/contrib/secp256k1/src/modules/ellswift/tests_impl.h +544 -0
  651. package/cpp/contrib/secp256k1/src/modules/extrakeys/Makefile.am.include +4 -0
  652. package/cpp/contrib/secp256k1/src/modules/extrakeys/main_impl.h +285 -0
  653. package/cpp/contrib/secp256k1/src/modules/extrakeys/tests_exhaustive_impl.h +68 -0
  654. package/cpp/contrib/secp256k1/src/modules/extrakeys/tests_impl.h +484 -0
  655. package/cpp/contrib/secp256k1/src/modules/generator/Makefile.am.include +9 -0
  656. package/cpp/contrib/secp256k1/src/modules/generator/main_impl.h +271 -0
  657. package/cpp/contrib/secp256k1/src/modules/generator/tests_impl.h +227 -0
  658. package/cpp/contrib/secp256k1/src/modules/musig/Makefile.am.include +8 -0
  659. package/cpp/contrib/secp256k1/src/modules/musig/keyagg.h +32 -0
  660. package/cpp/contrib/secp256k1/src/modules/musig/keyagg_impl.h +275 -0
  661. package/cpp/contrib/secp256k1/src/modules/musig/main_impl.h +12 -0
  662. package/cpp/contrib/secp256k1/src/modules/musig/session.h +24 -0
  663. package/cpp/contrib/secp256k1/src/modules/musig/session_impl.h +795 -0
  664. package/cpp/contrib/secp256k1/src/modules/musig/tests_impl.h +1161 -0
  665. package/cpp/contrib/secp256k1/src/modules/musig/vectors.h +346 -0
  666. package/cpp/contrib/secp256k1/src/modules/recovery/Makefile.am.include +5 -0
  667. package/cpp/contrib/secp256k1/src/modules/recovery/bench_impl.h +62 -0
  668. package/cpp/contrib/secp256k1/src/modules/recovery/main_impl.h +159 -0
  669. package/cpp/contrib/secp256k1/src/modules/recovery/tests_exhaustive_impl.h +148 -0
  670. package/cpp/contrib/secp256k1/src/modules/recovery/tests_impl.h +339 -0
  671. package/cpp/contrib/secp256k1/src/modules/schnorrsig/Makefile.am.include +5 -0
  672. package/cpp/contrib/secp256k1/src/modules/schnorrsig/bench_impl.h +104 -0
  673. package/cpp/contrib/secp256k1/src/modules/schnorrsig/main_impl.h +263 -0
  674. package/cpp/contrib/secp256k1/src/modules/schnorrsig/tests_exhaustive_impl.h +214 -0
  675. package/cpp/contrib/secp256k1/src/modules/schnorrsig/tests_impl.h +1010 -0
  676. package/cpp/contrib/secp256k1/src/precompute_ecmult.c +91 -0
  677. package/cpp/contrib/secp256k1/src/precompute_ecmult_gen.c +101 -0
  678. package/cpp/contrib/secp256k1/src/precomputed_ecmult.c +16456 -0
  679. package/cpp/contrib/secp256k1/src/precomputed_ecmult.h +40 -0
  680. package/cpp/contrib/secp256k1/src/precomputed_ecmult_gen.c +1779 -0
  681. package/cpp/contrib/secp256k1/src/precomputed_ecmult_gen.h +28 -0
  682. package/cpp/contrib/secp256k1/src/scalar.h +108 -0
  683. package/cpp/contrib/secp256k1/src/scalar_4x64.h +19 -0
  684. package/cpp/contrib/secp256k1/src/scalar_4x64_impl.h +1010 -0
  685. package/cpp/contrib/secp256k1/src/scalar_8x32.h +19 -0
  686. package/cpp/contrib/secp256k1/src/scalar_8x32_impl.h +830 -0
  687. package/cpp/contrib/secp256k1/src/scalar_impl.h +321 -0
  688. package/cpp/contrib/secp256k1/src/scalar_low.h +24 -0
  689. package/cpp/contrib/secp256k1/src/scalar_low_impl.h +215 -0
  690. package/cpp/contrib/secp256k1/src/scratch.h +44 -0
  691. package/cpp/contrib/secp256k1/src/scratch_impl.h +99 -0
  692. package/cpp/contrib/secp256k1/src/secp256k1.c +896 -0
  693. package/cpp/contrib/secp256k1/src/selftest.h +35 -0
  694. package/cpp/contrib/secp256k1/src/testrand.h +45 -0
  695. package/cpp/contrib/secp256k1/src/testrand_impl.h +162 -0
  696. package/cpp/contrib/secp256k1/src/testutil.h +161 -0
  697. package/cpp/contrib/secp256k1/src/unit_test.c +479 -0
  698. package/cpp/contrib/secp256k1/src/unit_test.h +147 -0
  699. package/cpp/contrib/secp256k1/src/util.h +469 -0
  700. package/cpp/contrib/secp256k1/src/util_local_visibility.h +12 -0
  701. package/cpp/contrib/secp256k1/tools/check-abi.sh +67 -0
  702. package/cpp/contrib/secp256k1/tools/symbol-check.py +72 -0
  703. package/cpp/contrib/secp256k1/tools/test_vectors_musig2_generate.py +656 -0
  704. package/cpp/contrib/secp256k1/tools/tests_wycheproof_generate_ecdh.py +166 -0
  705. package/cpp/contrib/secp256k1/tools/tests_wycheproof_generate_ecdsa.py +111 -0
  706. package/cpp/contrib/secp256k1/tools/wycheproof_utils.py +12 -0
  707. package/cpp/contrib/secp256k1/wasm/test_module.html +320 -0
  708. package/cpp/contrib/secp256k1/wasm/wrap.cpp +331 -0
  709. package/cpp/contrib/sqlite3.h +14349 -0
  710. package/cpp/contrib/sqlite3mc_amalgamation.c +369890 -0
  711. package/cpp/contrib/sqlite3mc_amalgamation.h +15548 -0
  712. package/cpp/contrib/unilib/uninorms.cpp +393 -0
  713. package/cpp/contrib/unilib/uninorms.h +56 -0
  714. package/cpp/contrib/unilib/utf8.cpp +78 -0
  715. package/cpp/contrib/unilib/utf8.h +260 -0
  716. package/cpp/contrib/update_mbedtls.sh +85 -0
  717. package/cpp/crypto/aes.cpp +141 -0
  718. package/cpp/crypto/aes.h +67 -0
  719. package/cpp/crypto/chacha20.cpp +342 -0
  720. package/cpp/crypto/chacha20.h +82 -0
  721. package/cpp/crypto/chacha20poly1305.cpp +91 -0
  722. package/cpp/crypto/chacha20poly1305.h +46 -0
  723. package/cpp/crypto/common.h +85 -0
  724. package/cpp/crypto/ctaes/COPYING +21 -0
  725. package/cpp/crypto/ctaes/README.md +41 -0
  726. package/cpp/crypto/ctaes/bench.c +170 -0
  727. package/cpp/crypto/ctaes/ctaes.c +556 -0
  728. package/cpp/crypto/ctaes/ctaes.h +41 -0
  729. package/cpp/crypto/ctaes/test.c +110 -0
  730. package/cpp/crypto/extkey.cpp +257 -0
  731. package/cpp/crypto/extkey.h +66 -0
  732. package/cpp/crypto/hmac_sha512.cpp +37 -0
  733. package/cpp/crypto/hmac_sha512.h +32 -0
  734. package/cpp/crypto/merkle.cpp +47 -0
  735. package/cpp/crypto/merkle.h +20 -0
  736. package/cpp/crypto/poly1305.cpp +223 -0
  737. package/cpp/crypto/poly1305.h +59 -0
  738. package/cpp/crypto/ripemd160.cpp +292 -0
  739. package/cpp/crypto/ripemd160.h +28 -0
  740. package/cpp/crypto/scrypt-sse2.cpp +141 -0
  741. package/cpp/crypto/scrypt.cpp +336 -0
  742. package/cpp/crypto/scrypt.h +49 -0
  743. package/cpp/crypto/sealed_key.cpp +62 -0
  744. package/cpp/crypto/sealed_key.h +34 -0
  745. package/cpp/crypto/secure_bytes.h +16 -0
  746. package/cpp/crypto/sha512.cpp +206 -0
  747. package/cpp/crypto/sha512.h +29 -0
  748. package/cpp/crypto/util.cpp +77 -0
  749. package/cpp/crypto/util.h +32 -0
  750. package/cpp/debug_rpc.cpp +703 -0
  751. package/cpp/debug_rpc.h +63 -0
  752. package/cpp/electrum.cpp +931 -0
  753. package/cpp/electrum.h +169 -0
  754. package/cpp/engine/xmr_engine.cpp +463 -0
  755. package/cpp/engine/xmr_engine.h +84 -0
  756. package/cpp/engine/xmr_engine_c.cpp +141 -0
  757. package/cpp/engine/xmr_engine_c.h +35 -0
  758. package/cpp/fees.cpp +270 -0
  759. package/cpp/fees.h +60 -0
  760. package/cpp/height_search.cpp +64 -0
  761. package/cpp/height_search.h +27 -0
  762. package/cpp/main.cpp +146 -0
  763. package/cpp/messages_npb.cpp +701 -0
  764. package/cpp/messages_npb.h +667 -0
  765. package/cpp/mnemonic/mnemonic.cpp +715 -0
  766. package/cpp/mnemonic/mnemonic.h +52 -0
  767. package/cpp/mnemonic/wordlists/english.h +1103 -0
  768. package/cpp/mnemonic/wordlists/japanese.h +2212 -0
  769. package/cpp/network/bridge.cpp +232 -0
  770. package/cpp/network/bridge.h +115 -0
  771. package/cpp/network/ca_roots.cpp +114 -0
  772. package/cpp/network/ca_roots.h +12 -0
  773. package/cpp/network/http_client.cpp +261 -0
  774. package/cpp/network/http_client.h +33 -0
  775. package/cpp/network/pem.cpp +84 -0
  776. package/cpp/network/pem.h +22 -0
  777. package/cpp/network/psa_user_config.h +15 -0
  778. package/cpp/network/socks5.cpp +180 -0
  779. package/cpp/network/socks5.h +26 -0
  780. package/cpp/network/tls_transport.cpp +502 -0
  781. package/cpp/network/tls_transport.h +62 -0
  782. package/cpp/network/transport.cpp +169 -0
  783. package/cpp/network/transport.h +115 -0
  784. package/cpp/network/url.cpp +88 -0
  785. package/cpp/network/url.h +25 -0
  786. package/cpp/network/websocket.cpp +253 -0
  787. package/cpp/network/websocket.h +68 -0
  788. package/cpp/network/ws_transport.cpp +361 -0
  789. package/cpp/network/ws_transport.h +72 -0
  790. package/cpp/node_client.cpp +1196 -0
  791. package/cpp/node_client.h +209 -0
  792. package/cpp/node_scan.h +35 -0
  793. package/cpp/schema.cpp +1249 -0
  794. package/cpp/schema.h +132 -0
  795. package/cpp/smsg.cpp +453 -0
  796. package/cpp/smsg.h +43 -0
  797. package/cpp/support/allocators/secure.h +85 -0
  798. package/cpp/support/cleanse.cpp +35 -0
  799. package/cpp/support/cleanse.h +15 -0
  800. package/cpp/support/coop.cpp +319 -0
  801. package/cpp/support/coop.h +157 -0
  802. package/cpp/support/lockedpool.cpp +406 -0
  803. package/cpp/support/lockedpool.h +240 -0
  804. package/cpp/uint256.cpp +62 -0
  805. package/cpp/uint256.h +121 -0
  806. package/cpp/util/base58.cpp +181 -0
  807. package/cpp/util/base58.h +45 -0
  808. package/cpp/util/bech32.cpp +578 -0
  809. package/cpp/util/bech32.h +96 -0
  810. package/cpp/util/debug.cpp +23 -0
  811. package/cpp/util/debug.h +12 -0
  812. package/cpp/util/int.cpp +118 -0
  813. package/cpp/util/int.h +18 -0
  814. package/cpp/util/json.h +26 -0
  815. package/cpp/util/log.cpp +137 -0
  816. package/cpp/util/log.h +37 -0
  817. package/cpp/util/mutex.h +89 -0
  818. package/cpp/util/platform.cpp +90 -0
  819. package/cpp/util/platform.h +17 -0
  820. package/cpp/util/random.cpp +136 -0
  821. package/cpp/util/random.h +28 -0
  822. package/cpp/util/rpc.cpp +192 -0
  823. package/cpp/util/rpc.h +454 -0
  824. package/cpp/util/str.cpp +254 -0
  825. package/cpp/util/str.h +54 -0
  826. package/cpp/util/thread.cpp +17 -0
  827. package/cpp/util/thread.h +12 -0
  828. package/cpp/util/time.cpp +30 -0
  829. package/cpp/util/time.h +30 -0
  830. package/cpp/util/tinyformat.h +1163 -0
  831. package/cpp/util/vector.h +83 -0
  832. package/cpp/version.h.in +12 -0
  833. package/cpp/view_key_chain.h +283 -0
  834. package/cpp/wallet/account_wallet.cpp +668 -0
  835. package/cpp/wallet/account_wallet.h +136 -0
  836. package/cpp/wallet/base_wallet.cpp +302 -0
  837. package/cpp/wallet/base_wallet.h +129 -0
  838. package/cpp/wallet/debug_wallet.cpp +40 -0
  839. package/cpp/wallet/debug_wallet.h +36 -0
  840. package/cpp/wallet/encrypted_seed.cpp +96 -0
  841. package/cpp/wallet/encrypted_seed.h +41 -0
  842. package/cpp/wallet/host_wallet.cpp +85 -0
  843. package/cpp/wallet/host_wallet.h +51 -0
  844. package/cpp/wallet/native_wallet.cpp +34 -0
  845. package/cpp/wallet/native_wallet.h +28 -0
  846. package/cpp/wallet/xmr/account_wallet.cpp +803 -0
  847. package/cpp/wallet/xmr/account_wallet.h +139 -0
  848. package/cpp/wallet/xmr/builder.cpp +568 -0
  849. package/cpp/wallet/xmr/builder.h +65 -0
  850. package/cpp/wallet/xmr/chain.cpp +1437 -0
  851. package/cpp/wallet/xmr/chain.h +213 -0
  852. package/cpp/wallet/xmr/daemon.cpp +583 -0
  853. package/cpp/wallet/xmr/daemon.h +153 -0
  854. package/cpp/wallet/xmr/decoys.cpp +197 -0
  855. package/cpp/wallet/xmr/decoys.h +64 -0
  856. package/cpp/wallet/xmr/epee.cpp +448 -0
  857. package/cpp/wallet/xmr/epee.h +25 -0
  858. package/cpp/wallet/xmr/fee.cpp +169 -0
  859. package/cpp/wallet/xmr/fee.h +61 -0
  860. package/cpp/wallet/xmr/reserve_proof.cpp +169 -0
  861. package/cpp/wallet/xmr/reserve_proof.h +24 -0
  862. package/cpp/wallet/xmr/scanner.cpp +860 -0
  863. package/cpp/wallet/xmr/scanner.h +239 -0
  864. package/lib/commonjs/NativeNitroBSX.js +128 -0
  865. package/lib/commonjs/NativeNitroBSX.js.map +1 -0
  866. package/lib/commonjs/format.js +21 -0
  867. package/lib/commonjs/format.js.map +1 -0
  868. package/lib/commonjs/index.js +50 -0
  869. package/lib/commonjs/index.js.map +1 -0
  870. package/lib/commonjs/service.js +75 -0
  871. package/lib/commonjs/service.js.map +1 -0
  872. package/lib/commonjs/specs/NitroBSX.nitro.js +6 -0
  873. package/lib/commonjs/specs/NitroBSX.nitro.js.map +1 -0
  874. package/lib/module/NativeNitroBSX.js +124 -0
  875. package/lib/module/NativeNitroBSX.js.map +1 -0
  876. package/lib/module/format.js +15 -0
  877. package/lib/module/format.js.map +1 -0
  878. package/lib/module/index.js +7 -0
  879. package/lib/module/index.js.map +1 -0
  880. package/lib/module/service.js +66 -0
  881. package/lib/module/service.js.map +1 -0
  882. package/lib/module/specs/NitroBSX.nitro.js +4 -0
  883. package/lib/module/specs/NitroBSX.nitro.js.map +1 -0
  884. package/lib/typescript/commonjs/package.json +1 -0
  885. package/lib/typescript/commonjs/src/NativeNitroBSX.d.ts +94 -0
  886. package/lib/typescript/commonjs/src/NativeNitroBSX.d.ts.map +1 -0
  887. package/lib/typescript/commonjs/src/format.d.ts +3 -0
  888. package/lib/typescript/commonjs/src/format.d.ts.map +1 -0
  889. package/lib/typescript/commonjs/src/index.d.ts +5 -0
  890. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  891. package/lib/typescript/commonjs/src/service.d.ts +28 -0
  892. package/lib/typescript/commonjs/src/service.d.ts.map +1 -0
  893. package/lib/typescript/commonjs/src/specs/NitroBSX.nitro.d.ts +251 -0
  894. package/lib/typescript/commonjs/src/specs/NitroBSX.nitro.d.ts.map +1 -0
  895. package/lib/typescript/module/package.json +1 -0
  896. package/lib/typescript/module/src/NativeNitroBSX.d.ts +94 -0
  897. package/lib/typescript/module/src/NativeNitroBSX.d.ts.map +1 -0
  898. package/lib/typescript/module/src/format.d.ts +3 -0
  899. package/lib/typescript/module/src/format.d.ts.map +1 -0
  900. package/lib/typescript/module/src/index.d.ts +5 -0
  901. package/lib/typescript/module/src/index.d.ts.map +1 -0
  902. package/lib/typescript/module/src/service.d.ts +28 -0
  903. package/lib/typescript/module/src/service.d.ts.map +1 -0
  904. package/lib/typescript/module/src/specs/NitroBSX.nitro.d.ts +251 -0
  905. package/lib/typescript/module/src/specs/NitroBSX.nitro.d.ts.map +1 -0
  906. package/nitro.json +19 -0
  907. package/nitrogen/generated/android/NitroBSX+autolinking.cmake +81 -0
  908. package/nitrogen/generated/android/NitroBSX+autolinking.gradle +27 -0
  909. package/nitrogen/generated/android/NitroBSXOnLoad.cpp +49 -0
  910. package/nitrogen/generated/android/NitroBSXOnLoad.hpp +34 -0
  911. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrobsx/NitroBSXOnLoad.kt +35 -0
  912. package/nitrogen/generated/ios/NitroBSX+autolinking.rb +62 -0
  913. package/nitrogen/generated/ios/NitroBSX-Swift-Cxx-Bridge.cpp +17 -0
  914. package/nitrogen/generated/ios/NitroBSX-Swift-Cxx-Bridge.hpp +27 -0
  915. package/nitrogen/generated/ios/NitroBSX-Swift-Cxx-Umbrella.hpp +38 -0
  916. package/nitrogen/generated/ios/NitroBSXAutolinking.mm +35 -0
  917. package/nitrogen/generated/ios/NitroBSXAutolinking.swift +16 -0
  918. package/nitrogen/generated/shared/c++/HybridNitroBSXSpec.cpp +91 -0
  919. package/nitrogen/generated/shared/c++/HybridNitroBSXSpec.hpp +142 -0
  920. package/nitrogen/generated/shared/c++/NotificationPair.hpp +87 -0
  921. package/nitrogen/generated/shared/c++/SignOutcome.hpp +80 -0
  922. package/nitrogen/generated/shared/c++/SignTxResult.hpp +89 -0
  923. package/package.json +172 -4
  924. package/react-native-nitro-bsx.podspec +33 -0
  925. package/react-native.config.js +26 -0
  926. package/scripts/build-ios.sh +49 -0
  927. package/src/NativeNitroBSX.ts +203 -0
  928. package/src/format.ts +14 -0
  929. package/src/index.ts +4 -0
  930. package/src/service.ts +77 -0
  931. package/src/specs/NitroBSX.nitro.ts +300 -0
@@ -0,0 +1,1173 @@
1
+ /**
2
+ * \file cipher.h
3
+ *
4
+ * \brief This file contains an abstraction interface for use with the cipher
5
+ * primitives provided by the library. It provides a common interface to all of
6
+ * the available cipher operations.
7
+ *
8
+ * \author Adriaan de Jong <dejong@fox-it.com>
9
+ */
10
+ /*
11
+ * Copyright The Mbed TLS Contributors
12
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
13
+ */
14
+
15
+ #ifndef TF_PSA_CRYPTO_MBEDTLS_PRIVATE_CIPHER_H
16
+ #define TF_PSA_CRYPTO_MBEDTLS_PRIVATE_CIPHER_H
17
+ #include "mbedtls/private_access.h"
18
+
19
+ #include "tf-psa-crypto/build_info.h"
20
+ #include "psa/crypto_values.h"
21
+
22
+ #include <stddef.h>
23
+ #include "mbedtls/platform_util.h"
24
+
25
+ #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
26
+ #define MBEDTLS_CIPHER_MODE_AEAD
27
+ #endif
28
+
29
+ #if defined(MBEDTLS_CIPHER_MODE_CBC)
30
+ #define MBEDTLS_CIPHER_MODE_WITH_PADDING
31
+ #endif
32
+
33
+ #if defined(MBEDTLS_CHACHA20_C)
34
+ #define MBEDTLS_CIPHER_MODE_STREAM
35
+ #endif
36
+
37
+ /** The selected feature is not available. */
38
+ #define MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE -0x6080
39
+ /** Bad input parameters. */
40
+ #define MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA PSA_ERROR_INVALID_ARGUMENT
41
+ /** Failed to allocate memory. */
42
+ #define MBEDTLS_ERR_CIPHER_ALLOC_FAILED PSA_ERROR_INSUFFICIENT_MEMORY
43
+ /** Input data contains invalid padding and is rejected. */
44
+ #define MBEDTLS_ERR_CIPHER_INVALID_PADDING PSA_ERROR_INVALID_PADDING
45
+ /** Decryption of block requires a full block. */
46
+ #define MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED -0x6280
47
+ /** Authentication failed (for AEAD modes). */
48
+ #define MBEDTLS_ERR_CIPHER_AUTH_FAILED PSA_ERROR_INVALID_SIGNATURE
49
+ /** The context is invalid. For example, because it was freed. */
50
+ #define MBEDTLS_ERR_CIPHER_INVALID_CONTEXT -0x6380
51
+
52
+ #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
53
+ #define MBEDTLS_CIPHER_VARIABLE_IV_LEN 0x01 /**< Cipher accepts IVs of variable length. */
54
+ #define MBEDTLS_CIPHER_VARIABLE_KEY_LEN 0x02 /**< Cipher accepts keys of variable length. */
55
+ #endif
56
+
57
+ #ifdef __cplusplus
58
+ extern "C" {
59
+ #endif
60
+
61
+ /**
62
+ * \brief Supported cipher types.
63
+ */
64
+ typedef enum {
65
+ MBEDTLS_CIPHER_ID_NONE = 0, /**< Placeholder to mark the end of cipher ID lists. */
66
+ MBEDTLS_CIPHER_ID_NULL, /**< The identity cipher, treated as a stream cipher. */
67
+ MBEDTLS_CIPHER_ID_AES, /**< The AES cipher. */
68
+ MBEDTLS_CIPHER_ID_CAMELLIA, /**< The Camellia cipher. */
69
+ MBEDTLS_CIPHER_ID_ARIA, /**< The Aria cipher. */
70
+ MBEDTLS_CIPHER_ID_CHACHA20, /**< The ChaCha20 cipher. */
71
+ } mbedtls_cipher_id_t;
72
+
73
+ /**
74
+ * \brief Supported {cipher type, cipher mode} pairs.
75
+ */
76
+ typedef enum {
77
+ MBEDTLS_CIPHER_NONE = 0, /**< Placeholder to mark the end of cipher-pair lists. */
78
+ MBEDTLS_CIPHER_NULL, /**< The identity stream cipher. */
79
+ MBEDTLS_CIPHER_AES_128_ECB, /**< AES cipher with 128-bit ECB mode. */
80
+ MBEDTLS_CIPHER_AES_192_ECB, /**< AES cipher with 192-bit ECB mode. */
81
+ MBEDTLS_CIPHER_AES_256_ECB, /**< AES cipher with 256-bit ECB mode. */
82
+ MBEDTLS_CIPHER_AES_128_CBC, /**< AES cipher with 128-bit CBC mode. */
83
+ MBEDTLS_CIPHER_AES_192_CBC, /**< AES cipher with 192-bit CBC mode. */
84
+ MBEDTLS_CIPHER_AES_256_CBC, /**< AES cipher with 256-bit CBC mode. */
85
+ MBEDTLS_CIPHER_AES_128_CFB128, /**< AES cipher with 128-bit CFB128 mode. */
86
+ MBEDTLS_CIPHER_AES_192_CFB128, /**< AES cipher with 192-bit CFB128 mode. */
87
+ MBEDTLS_CIPHER_AES_256_CFB128, /**< AES cipher with 256-bit CFB128 mode. */
88
+ MBEDTLS_CIPHER_AES_128_CTR, /**< AES cipher with 128-bit CTR mode. */
89
+ MBEDTLS_CIPHER_AES_192_CTR, /**< AES cipher with 192-bit CTR mode. */
90
+ MBEDTLS_CIPHER_AES_256_CTR, /**< AES cipher with 256-bit CTR mode. */
91
+ MBEDTLS_CIPHER_AES_128_GCM, /**< AES cipher with 128-bit GCM mode. */
92
+ MBEDTLS_CIPHER_AES_192_GCM, /**< AES cipher with 192-bit GCM mode. */
93
+ MBEDTLS_CIPHER_AES_256_GCM, /**< AES cipher with 256-bit GCM mode. */
94
+ MBEDTLS_CIPHER_CAMELLIA_128_ECB, /**< Camellia cipher with 128-bit ECB mode. */
95
+ MBEDTLS_CIPHER_CAMELLIA_192_ECB, /**< Camellia cipher with 192-bit ECB mode. */
96
+ MBEDTLS_CIPHER_CAMELLIA_256_ECB, /**< Camellia cipher with 256-bit ECB mode. */
97
+ MBEDTLS_CIPHER_CAMELLIA_128_CBC, /**< Camellia cipher with 128-bit CBC mode. */
98
+ MBEDTLS_CIPHER_CAMELLIA_192_CBC, /**< Camellia cipher with 192-bit CBC mode. */
99
+ MBEDTLS_CIPHER_CAMELLIA_256_CBC, /**< Camellia cipher with 256-bit CBC mode. */
100
+ MBEDTLS_CIPHER_CAMELLIA_128_CFB128, /**< Camellia cipher with 128-bit CFB128 mode. */
101
+ MBEDTLS_CIPHER_CAMELLIA_192_CFB128, /**< Camellia cipher with 192-bit CFB128 mode. */
102
+ MBEDTLS_CIPHER_CAMELLIA_256_CFB128, /**< Camellia cipher with 256-bit CFB128 mode. */
103
+ MBEDTLS_CIPHER_CAMELLIA_128_CTR, /**< Camellia cipher with 128-bit CTR mode. */
104
+ MBEDTLS_CIPHER_CAMELLIA_192_CTR, /**< Camellia cipher with 192-bit CTR mode. */
105
+ MBEDTLS_CIPHER_CAMELLIA_256_CTR, /**< Camellia cipher with 256-bit CTR mode. */
106
+ MBEDTLS_CIPHER_CAMELLIA_128_GCM, /**< Camellia cipher with 128-bit GCM mode. */
107
+ MBEDTLS_CIPHER_CAMELLIA_192_GCM, /**< Camellia cipher with 192-bit GCM mode. */
108
+ MBEDTLS_CIPHER_CAMELLIA_256_GCM, /**< Camellia cipher with 256-bit GCM mode. */
109
+ MBEDTLS_CIPHER_AES_128_CCM, /**< AES cipher with 128-bit CCM mode. */
110
+ MBEDTLS_CIPHER_AES_192_CCM, /**< AES cipher with 192-bit CCM mode. */
111
+ MBEDTLS_CIPHER_AES_256_CCM, /**< AES cipher with 256-bit CCM mode. */
112
+ MBEDTLS_CIPHER_AES_128_CCM_STAR_NO_TAG, /**< AES cipher with 128-bit CCM_STAR_NO_TAG mode. */
113
+ MBEDTLS_CIPHER_AES_192_CCM_STAR_NO_TAG, /**< AES cipher with 192-bit CCM_STAR_NO_TAG mode. */
114
+ MBEDTLS_CIPHER_AES_256_CCM_STAR_NO_TAG, /**< AES cipher with 256-bit CCM_STAR_NO_TAG mode. */
115
+ MBEDTLS_CIPHER_CAMELLIA_128_CCM, /**< Camellia cipher with 128-bit CCM mode. */
116
+ MBEDTLS_CIPHER_CAMELLIA_192_CCM, /**< Camellia cipher with 192-bit CCM mode. */
117
+ MBEDTLS_CIPHER_CAMELLIA_256_CCM, /**< Camellia cipher with 256-bit CCM mode. */
118
+ MBEDTLS_CIPHER_CAMELLIA_128_CCM_STAR_NO_TAG, /**< Camellia cipher with 128-bit CCM_STAR_NO_TAG mode. */
119
+ MBEDTLS_CIPHER_CAMELLIA_192_CCM_STAR_NO_TAG, /**< Camellia cipher with 192-bit CCM_STAR_NO_TAG mode. */
120
+ MBEDTLS_CIPHER_CAMELLIA_256_CCM_STAR_NO_TAG, /**< Camellia cipher with 256-bit CCM_STAR_NO_TAG mode. */
121
+ MBEDTLS_CIPHER_ARIA_128_ECB, /**< Aria cipher with 128-bit key and ECB mode. */
122
+ MBEDTLS_CIPHER_ARIA_192_ECB, /**< Aria cipher with 192-bit key and ECB mode. */
123
+ MBEDTLS_CIPHER_ARIA_256_ECB, /**< Aria cipher with 256-bit key and ECB mode. */
124
+ MBEDTLS_CIPHER_ARIA_128_CBC, /**< Aria cipher with 128-bit key and CBC mode. */
125
+ MBEDTLS_CIPHER_ARIA_192_CBC, /**< Aria cipher with 192-bit key and CBC mode. */
126
+ MBEDTLS_CIPHER_ARIA_256_CBC, /**< Aria cipher with 256-bit key and CBC mode. */
127
+ MBEDTLS_CIPHER_ARIA_128_CFB128, /**< Aria cipher with 128-bit key and CFB-128 mode. */
128
+ MBEDTLS_CIPHER_ARIA_192_CFB128, /**< Aria cipher with 192-bit key and CFB-128 mode. */
129
+ MBEDTLS_CIPHER_ARIA_256_CFB128, /**< Aria cipher with 256-bit key and CFB-128 mode. */
130
+ MBEDTLS_CIPHER_ARIA_128_CTR, /**< Aria cipher with 128-bit key and CTR mode. */
131
+ MBEDTLS_CIPHER_ARIA_192_CTR, /**< Aria cipher with 192-bit key and CTR mode. */
132
+ MBEDTLS_CIPHER_ARIA_256_CTR, /**< Aria cipher with 256-bit key and CTR mode. */
133
+ MBEDTLS_CIPHER_ARIA_128_GCM, /**< Aria cipher with 128-bit key and GCM mode. */
134
+ MBEDTLS_CIPHER_ARIA_192_GCM, /**< Aria cipher with 192-bit key and GCM mode. */
135
+ MBEDTLS_CIPHER_ARIA_256_GCM, /**< Aria cipher with 256-bit key and GCM mode. */
136
+ MBEDTLS_CIPHER_ARIA_128_CCM, /**< Aria cipher with 128-bit key and CCM mode. */
137
+ MBEDTLS_CIPHER_ARIA_192_CCM, /**< Aria cipher with 192-bit key and CCM mode. */
138
+ MBEDTLS_CIPHER_ARIA_256_CCM, /**< Aria cipher with 256-bit key and CCM mode. */
139
+ MBEDTLS_CIPHER_ARIA_128_CCM_STAR_NO_TAG, /**< Aria cipher with 128-bit key and CCM_STAR_NO_TAG mode. */
140
+ MBEDTLS_CIPHER_ARIA_192_CCM_STAR_NO_TAG, /**< Aria cipher with 192-bit key and CCM_STAR_NO_TAG mode. */
141
+ MBEDTLS_CIPHER_ARIA_256_CCM_STAR_NO_TAG, /**< Aria cipher with 256-bit key and CCM_STAR_NO_TAG mode. */
142
+ MBEDTLS_CIPHER_AES_128_OFB, /**< AES 128-bit cipher in OFB mode. */
143
+ MBEDTLS_CIPHER_AES_192_OFB, /**< AES 192-bit cipher in OFB mode. */
144
+ MBEDTLS_CIPHER_AES_256_OFB, /**< AES 256-bit cipher in OFB mode. */
145
+ MBEDTLS_CIPHER_AES_128_XTS, /**< AES 128-bit cipher in XTS block mode. */
146
+ MBEDTLS_CIPHER_AES_256_XTS, /**< AES 256-bit cipher in XTS block mode. */
147
+ MBEDTLS_CIPHER_CHACHA20, /**< ChaCha20 stream cipher. */
148
+ MBEDTLS_CIPHER_CHACHA20_POLY1305, /**< ChaCha20-Poly1305 AEAD cipher. */
149
+ MBEDTLS_CIPHER_AES_128_KW, /**< AES cipher with 128-bit NIST KW mode. */
150
+ MBEDTLS_CIPHER_AES_192_KW, /**< AES cipher with 192-bit NIST KW mode. */
151
+ MBEDTLS_CIPHER_AES_256_KW, /**< AES cipher with 256-bit NIST KW mode. */
152
+ MBEDTLS_CIPHER_AES_128_KWP, /**< AES cipher with 128-bit NIST KWP mode. */
153
+ MBEDTLS_CIPHER_AES_192_KWP, /**< AES cipher with 192-bit NIST KWP mode. */
154
+ MBEDTLS_CIPHER_AES_256_KWP, /**< AES cipher with 256-bit NIST KWP mode. */
155
+ } mbedtls_cipher_type_t;
156
+
157
+ /** Supported cipher modes. */
158
+ typedef enum {
159
+ MBEDTLS_MODE_NONE = 0, /**< None. */
160
+ MBEDTLS_MODE_ECB, /**< The ECB cipher mode. */
161
+ MBEDTLS_MODE_CBC, /**< The CBC cipher mode. */
162
+ MBEDTLS_MODE_CFB, /**< The CFB cipher mode. */
163
+ MBEDTLS_MODE_OFB, /**< The OFB cipher mode. */
164
+ MBEDTLS_MODE_CTR, /**< The CTR cipher mode. */
165
+ MBEDTLS_MODE_GCM, /**< The GCM cipher mode. */
166
+ MBEDTLS_MODE_STREAM, /**< The stream cipher mode. */
167
+ MBEDTLS_MODE_CCM, /**< The CCM cipher mode. */
168
+ MBEDTLS_MODE_CCM_STAR_NO_TAG, /**< The CCM*-no-tag cipher mode. */
169
+ MBEDTLS_MODE_XTS, /**< The XTS cipher mode. */
170
+ MBEDTLS_MODE_CHACHAPOLY, /**< The ChaCha-Poly cipher mode. */
171
+ MBEDTLS_MODE_KW, /**< The SP800-38F KW mode */
172
+ MBEDTLS_MODE_KWP, /**< The SP800-38F KWP mode */
173
+ } mbedtls_cipher_mode_t;
174
+
175
+ #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
176
+ /** Supported cipher padding types. */
177
+ typedef enum {
178
+ MBEDTLS_PADDING_PKCS7 = 0, /**< PKCS7 padding (default). */
179
+ MBEDTLS_PADDING_NONE, /**< Never pad (full blocks only). */
180
+ } mbedtls_cipher_padding_t;
181
+ #endif /* MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS */
182
+
183
+ /** Type of operation. */
184
+ typedef enum {
185
+ MBEDTLS_OPERATION_NONE = -1,
186
+ MBEDTLS_DECRYPT = 0,
187
+ MBEDTLS_ENCRYPT,
188
+ } mbedtls_operation_t;
189
+
190
+ /** Maximum length of any IV, in Bytes. */
191
+ /* This should ideally be derived automatically from list of ciphers.
192
+ */
193
+ #define MBEDTLS_MAX_IV_LENGTH 16
194
+
195
+ /** Maximum block size of any cipher, in Bytes. */
196
+ /* This should ideally be derived automatically from list of ciphers.
197
+ */
198
+ #define MBEDTLS_MAX_BLOCK_LENGTH 16
199
+
200
+ #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
201
+ /** Maximum key length, in Bytes. */
202
+ /* This should ideally be derived automatically from list of ciphers.
203
+ * For now, only check whether XTS is enabled which uses 64 Byte keys,
204
+ * and use 32 Bytes as an upper bound for the maximum key length otherwise.
205
+ */
206
+ #if defined(MBEDTLS_CIPHER_MODE_XTS)
207
+ #define MBEDTLS_MAX_KEY_LENGTH 64
208
+ #else
209
+ #define MBEDTLS_MAX_KEY_LENGTH 32
210
+ #endif /* MBEDTLS_CIPHER_MODE_XTS */
211
+
212
+ /**
213
+ * Base cipher information (opaque struct).
214
+ */
215
+ typedef struct mbedtls_cipher_base_t mbedtls_cipher_base_t;
216
+ #endif /* MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS */
217
+
218
+ /**
219
+ * CMAC context (opaque struct).
220
+ */
221
+ typedef struct mbedtls_cmac_context_t mbedtls_cmac_context_t;
222
+
223
+ /**
224
+ * Cipher information. Allows calling cipher functions
225
+ * in a generic way.
226
+ *
227
+ * \note The library does not support custom cipher info structures,
228
+ * only built-in structures returned by the functions
229
+ * mbedtls_cipher_info_from_string(),
230
+ * mbedtls_cipher_info_from_type(),
231
+ * mbedtls_cipher_info_from_values(),
232
+ * mbedtls_cipher_info_from_psa().
233
+ *
234
+ * \note Some fields store a value that has been right-shifted to save
235
+ * code-size, so should not be used directly. The accessor
236
+ * functions adjust for this and return the "natural" value.
237
+ */
238
+ typedef struct mbedtls_cipher_info_t {
239
+ /** Name of the cipher. */
240
+ const char *MBEDTLS_PRIVATE(name);
241
+
242
+ /** The block size, in bytes. */
243
+ unsigned int MBEDTLS_PRIVATE(block_size) : 5;
244
+
245
+ /** IV or nonce size, in bytes (right shifted by MBEDTLS_IV_SIZE_SHIFT).
246
+ * For ciphers that accept variable IV sizes,
247
+ * this is the recommended size.
248
+ */
249
+ unsigned int MBEDTLS_PRIVATE(iv_size) : 3;
250
+
251
+ /** The cipher key length, in bits (right shifted by MBEDTLS_KEY_BITLEN_SHIFT).
252
+ * This is the default length for variable sized ciphers.
253
+ */
254
+ unsigned int MBEDTLS_PRIVATE(key_bitlen) : 4;
255
+
256
+ /** The cipher mode (as per mbedtls_cipher_mode_t).
257
+ * For example, MBEDTLS_MODE_CBC.
258
+ */
259
+ unsigned int MBEDTLS_PRIVATE(mode) : 4;
260
+
261
+ /** Full cipher identifier (as per mbedtls_cipher_type_t).
262
+ * For example, MBEDTLS_CIPHER_AES_256_CBC.
263
+ *
264
+ * This could be 7 bits, but 8 bits retains byte alignment for the
265
+ * next field, which reduces code size to access that field.
266
+ */
267
+ unsigned int MBEDTLS_PRIVATE(type) : 8;
268
+
269
+ /** Bitflag comprised of MBEDTLS_CIPHER_VARIABLE_IV_LEN and
270
+ * MBEDTLS_CIPHER_VARIABLE_KEY_LEN indicating whether the
271
+ * cipher supports variable IV or variable key sizes, respectively.
272
+ */
273
+ unsigned int MBEDTLS_PRIVATE(flags) : 2;
274
+
275
+ /** Index to LUT for base cipher information and functions. */
276
+ unsigned int MBEDTLS_PRIVATE(base_idx) : 5;
277
+
278
+ } mbedtls_cipher_info_t;
279
+
280
+ #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
281
+ /* For internal use only.
282
+ * These are used to more compactly represent the fields above. */
283
+ #define MBEDTLS_KEY_BITLEN_SHIFT 6
284
+ #define MBEDTLS_IV_SIZE_SHIFT 2
285
+ #endif
286
+
287
+ /**
288
+ * Generic cipher context.
289
+ */
290
+ typedef struct mbedtls_cipher_context_t {
291
+ /** Information about the associated cipher. */
292
+ const mbedtls_cipher_info_t *MBEDTLS_PRIVATE(cipher_info);
293
+
294
+ /** Key length to use. */
295
+ int MBEDTLS_PRIVATE(key_bitlen);
296
+
297
+ /** Operation that the key of the context has been
298
+ * initialized for.
299
+ */
300
+ mbedtls_operation_t MBEDTLS_PRIVATE(operation);
301
+
302
+ #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
303
+ /** Padding functions to use, if relevant for
304
+ * the specific cipher mode.
305
+ */
306
+ void(*MBEDTLS_PRIVATE(add_padding))(unsigned char *output, size_t olen,
307
+ size_t data_len);
308
+ /* Report invalid-padding condition through the output parameter
309
+ * invalid_padding. To minimize changes in Mbed TLS 3.6, where this
310
+ * declaration is in a public header, use the public type size_t
311
+ * rather than the internal type mbedtls_ct_condition_t. */
312
+ int(*MBEDTLS_PRIVATE(get_padding))(unsigned char *input, size_t ilen,
313
+ size_t *data_len,
314
+ size_t *invalid_padding);
315
+ #endif
316
+
317
+ /** Buffer for input that has not been processed yet. */
318
+ unsigned char MBEDTLS_PRIVATE(unprocessed_data)[MBEDTLS_MAX_BLOCK_LENGTH];
319
+
320
+ /** Number of Bytes that have not been processed yet. */
321
+ size_t MBEDTLS_PRIVATE(unprocessed_len);
322
+
323
+ /** Current IV or NONCE_COUNTER for CTR-mode, data unit (or sector) number
324
+ * for XTS-mode. */
325
+ unsigned char MBEDTLS_PRIVATE(iv)[MBEDTLS_MAX_IV_LENGTH];
326
+
327
+ /** IV size in Bytes, for ciphers with variable-length IVs. */
328
+ size_t MBEDTLS_PRIVATE(iv_size);
329
+
330
+ /** The cipher-specific context. */
331
+ void *MBEDTLS_PRIVATE(cipher_ctx);
332
+
333
+ #if defined(MBEDTLS_CMAC_C)
334
+ /** CMAC-specific context. */
335
+ mbedtls_cmac_context_t *MBEDTLS_PRIVATE(cmac_ctx);
336
+ #endif
337
+
338
+ } mbedtls_cipher_context_t;
339
+
340
+ #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
341
+ /**
342
+ * \brief This function retrieves the list of ciphers supported
343
+ * by the generic cipher module.
344
+ *
345
+ * For any cipher identifier in the returned list, you can
346
+ * obtain the corresponding generic cipher information structure
347
+ * via mbedtls_cipher_info_from_type(), which can then be used
348
+ * to prepare a cipher context via mbedtls_cipher_setup().
349
+ *
350
+ *
351
+ * \return A statically-allocated array of cipher identifiers
352
+ * of type cipher_type_t. The last entry is zero.
353
+ */
354
+ const int *mbedtls_cipher_list(void);
355
+
356
+ /**
357
+ * \brief This function retrieves the cipher-information
358
+ * structure associated with the given cipher name.
359
+ *
360
+ * \param cipher_name Name of the cipher to search for. This must not be
361
+ * \c NULL.
362
+ *
363
+ * \return The cipher information structure associated with the
364
+ * given \p cipher_name.
365
+ * \return \c NULL if the associated cipher information is not found.
366
+ */
367
+ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_string(const char *cipher_name);
368
+
369
+ /**
370
+ * \brief This function retrieves the cipher-information
371
+ * structure associated with the given cipher type.
372
+ *
373
+ * \param cipher_type Type of the cipher to search for.
374
+ *
375
+ * \return The cipher information structure associated with the
376
+ * given \p cipher_type.
377
+ * \return \c NULL if the associated cipher information is not found.
378
+ */
379
+ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_type(const mbedtls_cipher_type_t cipher_type);
380
+
381
+ /**
382
+ * \brief This function retrieves the cipher-information
383
+ * structure associated with the given cipher ID,
384
+ * key size and mode.
385
+ *
386
+ * \param cipher_id The ID of the cipher to search for. For example,
387
+ * #MBEDTLS_CIPHER_ID_AES.
388
+ * \param key_bitlen The length of the key in bits.
389
+ * \param mode The cipher mode. For example, #MBEDTLS_MODE_CBC.
390
+ *
391
+ * \return The cipher information structure associated with the
392
+ * given \p cipher_id.
393
+ * \return \c NULL if the associated cipher information is not found.
394
+ */
395
+ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values(const mbedtls_cipher_id_t cipher_id,
396
+ int key_bitlen,
397
+ const mbedtls_cipher_mode_t mode);
398
+
399
+ /**
400
+ * \brief Retrieve the identifier for a cipher info structure.
401
+ *
402
+ * \param[in] info The cipher info structure to query.
403
+ * This may be \c NULL.
404
+ *
405
+ * \return The full cipher identifier (\c MBEDTLS_CIPHER_xxx).
406
+ * \return #MBEDTLS_CIPHER_NONE if \p info is \c NULL.
407
+ */
408
+ static inline mbedtls_cipher_type_t mbedtls_cipher_info_get_type(
409
+ const mbedtls_cipher_info_t *info)
410
+ {
411
+ if (info == NULL) {
412
+ return MBEDTLS_CIPHER_NONE;
413
+ } else {
414
+ return (mbedtls_cipher_type_t) info->MBEDTLS_PRIVATE(type);
415
+ }
416
+ }
417
+
418
+ /**
419
+ * \brief Retrieve the operation mode for a cipher info structure.
420
+ *
421
+ * \param[in] info The cipher info structure to query.
422
+ * This may be \c NULL.
423
+ *
424
+ * \return The cipher mode (\c MBEDTLS_MODE_xxx).
425
+ * \return #MBEDTLS_MODE_NONE if \p info is \c NULL.
426
+ */
427
+ static inline mbedtls_cipher_mode_t mbedtls_cipher_info_get_mode(
428
+ const mbedtls_cipher_info_t *info)
429
+ {
430
+ if (info == NULL) {
431
+ return MBEDTLS_MODE_NONE;
432
+ } else {
433
+ return (mbedtls_cipher_mode_t) info->MBEDTLS_PRIVATE(mode);
434
+ }
435
+ }
436
+
437
+ /**
438
+ * \brief Retrieve the key size for a cipher info structure.
439
+ *
440
+ * \param[in] info The cipher info structure to query.
441
+ * This may be \c NULL.
442
+ *
443
+ * \return The key length in bits.
444
+ * For variable-sized ciphers, this is the default length.
445
+ * \return \c 0 if \p info is \c NULL.
446
+ */
447
+ static inline size_t mbedtls_cipher_info_get_key_bitlen(
448
+ const mbedtls_cipher_info_t *info)
449
+ {
450
+ if (info == NULL) {
451
+ return 0;
452
+ } else {
453
+ return ((size_t) info->MBEDTLS_PRIVATE(key_bitlen)) << MBEDTLS_KEY_BITLEN_SHIFT;
454
+ }
455
+ }
456
+
457
+ /**
458
+ * \brief Retrieve the human-readable name for a
459
+ * cipher info structure.
460
+ *
461
+ * \param[in] info The cipher info structure to query.
462
+ * This may be \c NULL.
463
+ *
464
+ * \return The cipher name, which is a human readable string,
465
+ * with static storage duration.
466
+ * \return \c NULL if \p info is \c NULL.
467
+ */
468
+ static inline const char *mbedtls_cipher_info_get_name(
469
+ const mbedtls_cipher_info_t *info)
470
+ {
471
+ if (info == NULL) {
472
+ return NULL;
473
+ } else {
474
+ return info->MBEDTLS_PRIVATE(name);
475
+ }
476
+ }
477
+
478
+ /**
479
+ * \brief This function returns the size of the IV or nonce
480
+ * for the cipher info structure, in bytes.
481
+ *
482
+ * \param info The cipher info structure. This may be \c NULL.
483
+ *
484
+ * \return The recommended IV size.
485
+ * \return \c 0 for ciphers not using an IV or a nonce.
486
+ * \return \c 0 if \p info is \c NULL.
487
+ */
488
+ static inline size_t mbedtls_cipher_info_get_iv_size(
489
+ const mbedtls_cipher_info_t *info)
490
+ {
491
+ if (info == NULL) {
492
+ return 0;
493
+ }
494
+
495
+ return ((size_t) info->MBEDTLS_PRIVATE(iv_size)) << MBEDTLS_IV_SIZE_SHIFT;
496
+ }
497
+
498
+ /**
499
+ * \brief This function returns the block size of the given
500
+ * cipher info structure in bytes.
501
+ *
502
+ * \param info The cipher info structure. This may be \c NULL.
503
+ *
504
+ * \return The block size of the cipher.
505
+ * \return \c 1 if the cipher is a stream cipher.
506
+ * \return \c 0 if \p info is \c NULL.
507
+ */
508
+ static inline size_t mbedtls_cipher_info_get_block_size(
509
+ const mbedtls_cipher_info_t *info)
510
+ {
511
+ if (info == NULL) {
512
+ return 0;
513
+ }
514
+
515
+ return (size_t) (info->MBEDTLS_PRIVATE(block_size));
516
+ }
517
+
518
+ /**
519
+ * \brief This function returns a non-zero value if the key length for
520
+ * the given cipher is variable.
521
+ *
522
+ * \param info The cipher info structure. This may be \c NULL.
523
+ *
524
+ * \return Non-zero if the key length is variable, \c 0 otherwise.
525
+ * \return \c 0 if the given pointer is \c NULL.
526
+ */
527
+ static inline int mbedtls_cipher_info_has_variable_key_bitlen(
528
+ const mbedtls_cipher_info_t *info)
529
+ {
530
+ if (info == NULL) {
531
+ return 0;
532
+ }
533
+
534
+ return info->MBEDTLS_PRIVATE(flags) & MBEDTLS_CIPHER_VARIABLE_KEY_LEN;
535
+ }
536
+
537
+ /**
538
+ * \brief This function returns a non-zero value if the IV size for
539
+ * the given cipher is variable.
540
+ *
541
+ * \param info The cipher info structure. This may be \c NULL.
542
+ *
543
+ * \return Non-zero if the IV size is variable, \c 0 otherwise.
544
+ * \return \c 0 if the given pointer is \c NULL.
545
+ */
546
+ static inline int mbedtls_cipher_info_has_variable_iv_size(
547
+ const mbedtls_cipher_info_t *info)
548
+ {
549
+ if (info == NULL) {
550
+ return 0;
551
+ }
552
+
553
+ return info->MBEDTLS_PRIVATE(flags) & MBEDTLS_CIPHER_VARIABLE_IV_LEN;
554
+ }
555
+
556
+ /**
557
+ * \brief This function initializes a \p ctx as NONE.
558
+ *
559
+ * \param ctx The context to be initialized. This must not be \c NULL.
560
+ */
561
+ void mbedtls_cipher_init(mbedtls_cipher_context_t *ctx);
562
+
563
+ /**
564
+ * \brief This function frees and clears the cipher-specific
565
+ * context of \p ctx. Freeing \p ctx itself remains the
566
+ * responsibility of the caller.
567
+ *
568
+ * \param ctx The context to be freed. If this is \c NULL, the
569
+ * function has no effect, otherwise this must point to an
570
+ * initialized context.
571
+ */
572
+ void mbedtls_cipher_free(mbedtls_cipher_context_t *ctx);
573
+
574
+
575
+ /**
576
+ * \brief This function prepares a cipher context for
577
+ * use with the given cipher primitive.
578
+ *
579
+ * \note After calling this function, you should call
580
+ * mbedtls_cipher_setkey() and, if the mode uses padding,
581
+ * mbedtls_cipher_set_padding_mode(), then for each
582
+ * message to encrypt or decrypt with this key, either:
583
+ * - mbedtls_cipher_crypt() for one-shot processing with
584
+ * non-AEAD modes;
585
+ * - mbedtls_cipher_auth_encrypt_ext() or
586
+ * mbedtls_cipher_auth_decrypt_ext() for one-shot
587
+ * processing with AEAD modes;
588
+ * - for multi-part processing, see the documentation of
589
+ * mbedtls_cipher_reset().
590
+ *
591
+ * \param ctx The context to prepare. This must be initialized by
592
+ * a call to mbedtls_cipher_init() first.
593
+ * \param cipher_info The cipher to use.
594
+ *
595
+ * \return \c 0 on success.
596
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
597
+ * parameter-verification failure.
598
+ * \return #MBEDTLS_ERR_CIPHER_ALLOC_FAILED if allocation of the
599
+ * cipher-specific context fails.
600
+ */
601
+ int mbedtls_cipher_setup(mbedtls_cipher_context_t *ctx,
602
+ const mbedtls_cipher_info_t *cipher_info);
603
+
604
+ /**
605
+ * \brief This function returns the block size of the given cipher
606
+ * in bytes.
607
+ *
608
+ * \param ctx The context of the cipher.
609
+ *
610
+ * \return The block size of the underlying cipher.
611
+ * \return \c 1 if the cipher is a stream cipher.
612
+ * \return \c 0 if \p ctx has not been initialized.
613
+ */
614
+ static inline unsigned int mbedtls_cipher_get_block_size(
615
+ const mbedtls_cipher_context_t *ctx)
616
+ {
617
+ if (ctx->MBEDTLS_PRIVATE(cipher_info) == NULL) {
618
+ return 0;
619
+ }
620
+
621
+ return (unsigned int) ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(block_size);
622
+ }
623
+
624
+ /**
625
+ * \brief This function returns the mode of operation for
626
+ * the cipher. For example, MBEDTLS_MODE_CBC.
627
+ *
628
+ * \param ctx The context of the cipher. This must be initialized.
629
+ *
630
+ * \return The mode of operation.
631
+ * \return #MBEDTLS_MODE_NONE if \p ctx has not been initialized.
632
+ */
633
+ static inline mbedtls_cipher_mode_t mbedtls_cipher_get_cipher_mode(
634
+ const mbedtls_cipher_context_t *ctx)
635
+ {
636
+ if (ctx->MBEDTLS_PRIVATE(cipher_info) == NULL) {
637
+ return MBEDTLS_MODE_NONE;
638
+ }
639
+
640
+ return (mbedtls_cipher_mode_t) ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(mode);
641
+ }
642
+
643
+ /**
644
+ * \brief This function returns the size of the IV or nonce
645
+ * of the cipher, in Bytes.
646
+ *
647
+ * \param ctx The context of the cipher. This must be initialized.
648
+ *
649
+ * \return The recommended IV size if no IV has been set.
650
+ * \return \c 0 for ciphers not using an IV or a nonce.
651
+ * \return The actual size if an IV has been set.
652
+ */
653
+ static inline int mbedtls_cipher_get_iv_size(
654
+ const mbedtls_cipher_context_t *ctx)
655
+ {
656
+ if (ctx->MBEDTLS_PRIVATE(cipher_info) == NULL) {
657
+ return 0;
658
+ }
659
+
660
+ if (ctx->MBEDTLS_PRIVATE(iv_size) != 0) {
661
+ return (int) ctx->MBEDTLS_PRIVATE(iv_size);
662
+ }
663
+
664
+ return (int) (((int) ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(iv_size)) <<
665
+ MBEDTLS_IV_SIZE_SHIFT);
666
+ }
667
+
668
+ /**
669
+ * \brief This function returns the type of the given cipher.
670
+ *
671
+ * \param ctx The context of the cipher. This must be initialized.
672
+ *
673
+ * \return The type of the cipher.
674
+ * \return #MBEDTLS_CIPHER_NONE if \p ctx has not been initialized.
675
+ */
676
+ static inline mbedtls_cipher_type_t mbedtls_cipher_get_type(
677
+ const mbedtls_cipher_context_t *ctx)
678
+ {
679
+ if (ctx->MBEDTLS_PRIVATE(cipher_info) == NULL) {
680
+ return MBEDTLS_CIPHER_NONE;
681
+ }
682
+
683
+ return (mbedtls_cipher_type_t) ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(type);
684
+ }
685
+
686
+ /**
687
+ * \brief This function returns the name of the given cipher
688
+ * as a string.
689
+ *
690
+ * \param ctx The context of the cipher. This must be initialized.
691
+ *
692
+ * \return The name of the cipher.
693
+ * \return NULL if \p ctx has not been not initialized.
694
+ */
695
+ static inline const char *mbedtls_cipher_get_name(
696
+ const mbedtls_cipher_context_t *ctx)
697
+ {
698
+ if (ctx->MBEDTLS_PRIVATE(cipher_info) == NULL) {
699
+ return 0;
700
+ }
701
+
702
+ return ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(name);
703
+ }
704
+
705
+ /**
706
+ * \brief This function returns the key length of the cipher.
707
+ *
708
+ * \param ctx The context of the cipher. This must be initialized.
709
+ *
710
+ * \return The key length of the cipher in bits.
711
+ * \return 0 if \p ctx has not been
712
+ * initialized.
713
+ */
714
+ static inline int mbedtls_cipher_get_key_bitlen(
715
+ const mbedtls_cipher_context_t *ctx)
716
+ {
717
+ if (ctx->MBEDTLS_PRIVATE(cipher_info) == NULL) {
718
+ return 0;
719
+ }
720
+
721
+ return (int) ctx->MBEDTLS_PRIVATE(cipher_info)->MBEDTLS_PRIVATE(key_bitlen) <<
722
+ MBEDTLS_KEY_BITLEN_SHIFT;
723
+ }
724
+
725
+ /**
726
+ * \brief This function returns the operation of the given cipher.
727
+ *
728
+ * \param ctx The context of the cipher. This must be initialized.
729
+ *
730
+ * \return The type of operation: #MBEDTLS_ENCRYPT or #MBEDTLS_DECRYPT.
731
+ * \return #MBEDTLS_OPERATION_NONE if \p ctx has not been initialized.
732
+ */
733
+ static inline mbedtls_operation_t mbedtls_cipher_get_operation(
734
+ const mbedtls_cipher_context_t *ctx)
735
+ {
736
+ if (ctx->MBEDTLS_PRIVATE(cipher_info) == NULL) {
737
+ return MBEDTLS_OPERATION_NONE;
738
+ }
739
+
740
+ return ctx->MBEDTLS_PRIVATE(operation);
741
+ }
742
+
743
+ /**
744
+ * \brief This function sets the key to use with the given context.
745
+ *
746
+ * \param ctx The generic cipher context. This must be initialized and
747
+ * bound to a cipher information structure.
748
+ * \param key The key to use. This must be a readable buffer of at
749
+ * least \p key_bitlen Bits.
750
+ * \param key_bitlen The key length to use, in Bits.
751
+ * \param operation The operation that the key will be used for:
752
+ * #MBEDTLS_ENCRYPT or #MBEDTLS_DECRYPT.
753
+ *
754
+ * \return \c 0 on success.
755
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
756
+ * parameter-verification failure.
757
+ * \return A cipher-specific error code on failure.
758
+ */
759
+ int mbedtls_cipher_setkey(mbedtls_cipher_context_t *ctx,
760
+ const unsigned char *key,
761
+ int key_bitlen,
762
+ const mbedtls_operation_t operation);
763
+
764
+ #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
765
+ /**
766
+ * \brief This function sets the padding mode, for cipher modes
767
+ * that use padding.
768
+ *
769
+ *
770
+ * \param ctx The generic cipher context. This must be initialized and
771
+ * bound to a cipher information structure.
772
+ * \param mode The padding mode.
773
+ *
774
+ * \return \c 0 on success.
775
+ * \return #MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE
776
+ * if the selected padding mode is not supported.
777
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA if the cipher mode
778
+ * does not support padding.
779
+ */
780
+ int mbedtls_cipher_set_padding_mode(mbedtls_cipher_context_t *ctx,
781
+ mbedtls_cipher_padding_t mode);
782
+ #endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
783
+
784
+ /**
785
+ * \brief This function sets the initialization vector (IV)
786
+ * or nonce.
787
+ *
788
+ * \note Some ciphers do not use IVs nor nonce. For these
789
+ * ciphers, this function has no effect.
790
+ *
791
+ * \note For #MBEDTLS_CIPHER_CHACHA20, the nonce length must
792
+ * be 12, and the initial counter value is 0.
793
+ *
794
+ * \note For #MBEDTLS_CIPHER_CHACHA20_POLY1305, the nonce length
795
+ * must be 12.
796
+ *
797
+ * \param ctx The generic cipher context. This must be initialized and
798
+ * bound to a cipher information structure.
799
+ * \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers. This
800
+ * must be a readable buffer of at least \p iv_len Bytes.
801
+ * \param iv_len The IV length for ciphers with variable-size IV.
802
+ * This parameter is discarded by ciphers with fixed-size IV.
803
+ *
804
+ * \return \c 0 on success.
805
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
806
+ * parameter-verification failure.
807
+ */
808
+ int mbedtls_cipher_set_iv(mbedtls_cipher_context_t *ctx,
809
+ const unsigned char *iv,
810
+ size_t iv_len);
811
+
812
+ /**
813
+ * \brief This function resets the cipher state.
814
+ *
815
+ * \note With non-AEAD ciphers, the order of calls for each message
816
+ * is as follows:
817
+ * 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce;
818
+ * 2. mbedtls_cipher_reset();
819
+ * 3. mbedtls_cipher_update() zero, one or more times;
820
+ * 4. mbedtls_cipher_finish_padded() (recommended for decryption
821
+ * if the mode uses padding) or mbedtls_cipher_finish().
822
+ * .
823
+ * This sequence can be repeated to encrypt or decrypt multiple
824
+ * messages with the same key.
825
+ *
826
+ * \note With AEAD ciphers, the order of calls for each message
827
+ * is as follows:
828
+ * 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce;
829
+ * 2. mbedtls_cipher_reset();
830
+ * 3. mbedtls_cipher_update_ad();
831
+ * 4. mbedtls_cipher_update() zero, one or more times;
832
+ * 5. mbedtls_cipher_finish() (or mbedtls_cipher_finish_padded());
833
+ * 6. mbedtls_cipher_check_tag() (for decryption) or
834
+ * mbedtls_cipher_write_tag() (for encryption).
835
+ * .
836
+ * This sequence can be repeated to encrypt or decrypt multiple
837
+ * messages with the same key.
838
+ *
839
+ * \param ctx The generic cipher context. This must be bound to a key.
840
+ *
841
+ * \return \c 0 on success.
842
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
843
+ * parameter-verification failure.
844
+ */
845
+ int mbedtls_cipher_reset(mbedtls_cipher_context_t *ctx);
846
+
847
+ #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
848
+ /**
849
+ * \brief This function adds additional data for AEAD ciphers.
850
+ * Currently supported with GCM and ChaCha20+Poly1305.
851
+ *
852
+ * \param ctx The generic cipher context. This must be initialized.
853
+ * \param ad The additional data to use. This must be a readable
854
+ * buffer of at least \p ad_len Bytes.
855
+ * \param ad_len The length of \p ad in Bytes.
856
+ *
857
+ * \return \c 0 on success.
858
+ * \return A specific error code on failure.
859
+ */
860
+ int mbedtls_cipher_update_ad(mbedtls_cipher_context_t *ctx,
861
+ const unsigned char *ad, size_t ad_len);
862
+ #endif /* MBEDTLS_GCM_C || MBEDTLS_CHACHAPOLY_C */
863
+
864
+ /**
865
+ * \brief The generic cipher update function. It encrypts or
866
+ * decrypts using the given cipher context. Writes as
867
+ * many block-sized blocks of data as possible to output.
868
+ * Any data that cannot be written immediately is either
869
+ * added to the next block, or flushed when
870
+ * mbedtls_cipher_finish() or mbedtls_cipher_finish_padded()
871
+ * is called.
872
+ * Exception: For MBEDTLS_MODE_ECB, expects a single block
873
+ * in size. For example, 16 Bytes for AES.
874
+ *
875
+ * \param ctx The generic cipher context. This must be initialized and
876
+ * bound to a key.
877
+ * \param input The buffer holding the input data. This must be a
878
+ * readable buffer of at least \p ilen Bytes.
879
+ * \param ilen The length of the input data.
880
+ * \param output The buffer for the output data. This must be able to
881
+ * hold at least `ilen + block_size`. This must not be the
882
+ * same buffer as \p input.
883
+ * \param olen The length of the output data, to be updated with the
884
+ * actual number of Bytes written. This must not be
885
+ * \c NULL.
886
+ *
887
+ * \return \c 0 on success.
888
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
889
+ * parameter-verification failure.
890
+ * \return #MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE on an
891
+ * unsupported mode for a cipher.
892
+ * \return A cipher-specific error code on failure.
893
+ */
894
+ int mbedtls_cipher_update(mbedtls_cipher_context_t *ctx,
895
+ const unsigned char *input,
896
+ size_t ilen, unsigned char *output,
897
+ size_t *olen);
898
+
899
+ /**
900
+ * \brief The generic cipher finalization function. If data still
901
+ * needs to be flushed from an incomplete block, the data
902
+ * contained in it is padded to the size of
903
+ * the last block, and written to the \p output buffer.
904
+ *
905
+ * \warning This function reports invalid padding through an error
906
+ * code. Adversaries may be able to decrypt encrypted
907
+ * data if they can submit chosen ciphertexts and
908
+ * detect whether it has valid padding or not,
909
+ * either through direct observation or through a side
910
+ * channel such as timing. This is known as a
911
+ * padding oracle attack.
912
+ * Therefore applications that call this function for
913
+ * decryption with a cipher that involves padding
914
+ * should take care around error handling. Preferably,
915
+ * such applications should use
916
+ * mbedtls_cipher_finish_padded() instead of this function.
917
+ *
918
+ * \param ctx The generic cipher context. This must be initialized and
919
+ * bound to a key.
920
+ * \param output The buffer to write data to. This needs to be a writable
921
+ * buffer of at least block_size Bytes.
922
+ * \param olen The length of the data written to the \p output buffer.
923
+ * This may not be \c NULL.
924
+ * Note that when decrypting in a mode with padding,
925
+ * the actual output length is sensitive and may be
926
+ * used to mount a padding oracle attack (see warning
927
+ * above), although less efficiently than through
928
+ * the invalid-padding condition.
929
+ *
930
+ * \return \c 0 on success.
931
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
932
+ * parameter-verification failure.
933
+ * \return #MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED on decryption
934
+ * expecting a full block but not receiving one.
935
+ * \return #MBEDTLS_ERR_CIPHER_INVALID_PADDING on invalid padding
936
+ * while decrypting. Note that invalid-padding errors
937
+ * should be handled carefully; see the warning above.
938
+ * \return A cipher-specific error code on failure.
939
+ */
940
+ int mbedtls_cipher_finish(mbedtls_cipher_context_t *ctx,
941
+ unsigned char *output, size_t *olen);
942
+
943
+ /**
944
+ * \brief The generic cipher finalization function. If data still
945
+ * needs to be flushed from an incomplete block, the data
946
+ * contained in it is padded to the size of
947
+ * the last block, and written to the \p output buffer.
948
+ *
949
+ * \note This function is similar to mbedtls_cipher_finish().
950
+ * The only difference is that it reports invalid padding
951
+ * decryption differently, through the \p invalid_padding
952
+ * parameter rather than an error code.
953
+ * For encryption, and in modes without padding (including
954
+ * all authenticated modes), this function is identical
955
+ * to mbedtls_cipher_finish().
956
+ *
957
+ * \param[in,out] ctx The generic cipher context. This must be initialized and
958
+ * bound to a key.
959
+ * \param[out] output The buffer to write data to. This needs to be a writable
960
+ * buffer of at least block_size Bytes.
961
+ * \param[out] olen The length of the data written to the \p output buffer.
962
+ * This may not be \c NULL.
963
+ * Note that when decrypting in a mode with padding,
964
+ * the actual output length is sensitive and may be
965
+ * used to mount a padding oracle attack (see warning
966
+ * on mbedtls_cipher_finish()).
967
+ * \param[out] invalid_padding
968
+ * If this function returns \c 0 on decryption,
969
+ * \p *invalid_padding is \c 0 if the ciphertext was
970
+ * valid, and all-bits-one if the ciphertext had invalid
971
+ * padding.
972
+ * On encryption, or in a mode without padding (including
973
+ * all authenticated modes), \p *invalid_padding is \c 0
974
+ * on success.
975
+ * The value in \p *invalid_padding is unspecified if
976
+ * this function returns a nonzero status.
977
+ *
978
+ * \return \c 0 on success.
979
+ * Also \c 0 for decryption with invalid padding.
980
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
981
+ * parameter-verification failure.
982
+ * \return #MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED on decryption
983
+ * expecting a full block but not receiving one.
984
+ * \return A cipher-specific error code on failure.
985
+ */
986
+ int mbedtls_cipher_finish_padded(mbedtls_cipher_context_t *ctx,
987
+ unsigned char *output, size_t *olen,
988
+ size_t *invalid_padding);
989
+
990
+ #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
991
+ /**
992
+ * \brief This function writes a tag for AEAD ciphers.
993
+ * Currently supported with GCM and ChaCha20+Poly1305.
994
+ * This must be called after mbedtls_cipher_finish()
995
+ * or mbedtls_cipher_finish_padded().
996
+ *
997
+ * \param ctx The generic cipher context. This must be initialized,
998
+ * bound to a key, and have just completed a cipher
999
+ * operation through mbedtls_cipher_finish() the tag for
1000
+ * which should be written.
1001
+ * \param tag The buffer to write the tag to. This must be a writable
1002
+ * buffer of at least \p tag_len Bytes.
1003
+ * \param tag_len The length of the tag to write.
1004
+ *
1005
+ * \return \c 0 on success.
1006
+ * \return A specific error code on failure.
1007
+ */
1008
+ int mbedtls_cipher_write_tag(mbedtls_cipher_context_t *ctx,
1009
+ unsigned char *tag, size_t tag_len);
1010
+
1011
+ /**
1012
+ * \brief This function checks the tag for AEAD ciphers.
1013
+ * Currently supported with GCM and ChaCha20+Poly1305.
1014
+ * This must be called after mbedtls_cipher_finish()
1015
+ * or mbedtls_cipher_finish_padded().
1016
+ *
1017
+ * \param ctx The generic cipher context. This must be initialized.
1018
+ * \param tag The buffer holding the tag. This must be a readable
1019
+ * buffer of at least \p tag_len Bytes.
1020
+ * \param tag_len The length of the tag to check.
1021
+ *
1022
+ * \return \c 0 on success.
1023
+ * \return A specific error code on failure.
1024
+ */
1025
+ int mbedtls_cipher_check_tag(mbedtls_cipher_context_t *ctx,
1026
+ const unsigned char *tag, size_t tag_len);
1027
+ #endif /* MBEDTLS_GCM_C || MBEDTLS_CHACHAPOLY_C */
1028
+
1029
+ /**
1030
+ * \brief The generic all-in-one encryption/decryption function,
1031
+ * for all ciphers except AEAD constructs.
1032
+ *
1033
+ * \param ctx The generic cipher context. This must be initialized.
1034
+ * \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers.
1035
+ * This must be a readable buffer of at least \p iv_len
1036
+ * Bytes.
1037
+ * \param iv_len The IV length for ciphers with variable-size IV.
1038
+ * This parameter is discarded by ciphers with fixed-size
1039
+ * IV.
1040
+ * \param input The buffer holding the input data. This must be a
1041
+ * readable buffer of at least \p ilen Bytes.
1042
+ * \param ilen The length of the input data in Bytes.
1043
+ * \param output The buffer for the output data. This must be able to
1044
+ * hold at least `ilen + block_size`. This must not be the
1045
+ * same buffer as \p input.
1046
+ * \param olen The length of the output data, to be updated with the
1047
+ * actual number of Bytes written. This must not be
1048
+ * \c NULL.
1049
+ *
1050
+ * \note Some ciphers do not use IVs nor nonce. For these
1051
+ * ciphers, use \p iv = NULL and \p iv_len = 0.
1052
+ *
1053
+ * \return \c 0 on success.
1054
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
1055
+ * parameter-verification failure.
1056
+ * \return #MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED on decryption
1057
+ * expecting a full block but not receiving one.
1058
+ * \return #MBEDTLS_ERR_CIPHER_INVALID_PADDING on invalid padding
1059
+ * while decrypting.
1060
+ * \return A cipher-specific error code on failure.
1061
+ */
1062
+ int mbedtls_cipher_crypt(mbedtls_cipher_context_t *ctx,
1063
+ const unsigned char *iv, size_t iv_len,
1064
+ const unsigned char *input, size_t ilen,
1065
+ unsigned char *output, size_t *olen);
1066
+
1067
+ #if defined(MBEDTLS_CIPHER_MODE_AEAD)
1068
+ /**
1069
+ * \brief The authenticated encryption (AEAD) function.
1070
+ *
1071
+ * \note For AEAD modes, the tag will be appended to the
1072
+ * ciphertext, as recommended by RFC 5116.
1073
+ *
1074
+ * \param ctx The generic cipher context. This must be initialized and
1075
+ * bound to a key, with an AEAD algorithm.
1076
+ * \param iv The nonce to use. This must be a readable buffer of
1077
+ * at least \p iv_len Bytes and may be \c NULL if \p
1078
+ * iv_len is \c 0.
1079
+ * \param iv_len The length of the nonce. For AEAD ciphers, this must
1080
+ * satisfy the constraints imposed by the cipher used.
1081
+ * \param ad The additional data to authenticate. This must be a
1082
+ * readable buffer of at least \p ad_len Bytes, and may
1083
+ * be \c NULL is \p ad_len is \c 0.
1084
+ * \param ad_len The length of \p ad
1085
+ * \param input The buffer holding the input data. This must be a
1086
+ * readable buffer of at least \p ilen Bytes, and may be
1087
+ * \c NULL if \p ilen is \c 0.
1088
+ * \param ilen The length of the input data.
1089
+ * \param output The buffer for the output data. This must be a
1090
+ * writable buffer of at least \p output_len Bytes, and
1091
+ * must not be \c NULL.
1092
+ * \param output_len The length of the \p output buffer in Bytes. For AEAD
1093
+ * ciphers, this must be at least \p ilen + \p tag_len.
1094
+ * (rounded up to a multiple of 8 if KWP is used);
1095
+ * \p ilen + 15 is always a safe value.
1096
+ * \param olen This will be filled with the actual number of Bytes
1097
+ * written to the \p output buffer. This must point to a
1098
+ * writable object of type \c size_t.
1099
+ * \param tag_len The desired length of the authentication tag. For AEAD
1100
+ * ciphers, this must match the constraints imposed by
1101
+ * the cipher used, and in particular must not be \c 0.
1102
+ *
1103
+ * \return \c 0 on success.
1104
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
1105
+ * parameter-verification failure.
1106
+ * \return A cipher-specific error code on failure.
1107
+ */
1108
+ int mbedtls_cipher_auth_encrypt_ext(mbedtls_cipher_context_t *ctx,
1109
+ const unsigned char *iv, size_t iv_len,
1110
+ const unsigned char *ad, size_t ad_len,
1111
+ const unsigned char *input, size_t ilen,
1112
+ unsigned char *output, size_t output_len,
1113
+ size_t *olen, size_t tag_len);
1114
+
1115
+ /**
1116
+ * \brief The authenticated encryption (AEAD) function.
1117
+ *
1118
+ * \note If the data is not authentic, then the output buffer
1119
+ * is zeroed out to prevent the unauthentic plaintext being
1120
+ * used, making this interface safer.
1121
+ *
1122
+ * \note For AEAD modes, the tag must be appended to the
1123
+ * ciphertext, as recommended by RFC 5116.
1124
+ *
1125
+ * \param ctx The generic cipher context. This must be initialized and
1126
+ * bound to a key, with an AEAD algorithm.
1127
+ * \param iv The nonce to use. This must be a readable buffer of
1128
+ * at least \p iv_len Bytes and may be \c NULL if \p
1129
+ * iv_len is \c 0.
1130
+ * \param iv_len The length of the nonce. For AEAD ciphers, this must
1131
+ * satisfy the constraints imposed by the cipher used.
1132
+ * \param ad The additional data to authenticate. This must be a
1133
+ * readable buffer of at least \p ad_len Bytes, and may
1134
+ * be \c NULL is \p ad_len is \c 0.
1135
+ * \param ad_len The length of \p ad.
1136
+ * \param input The buffer holding the input data. This must be a
1137
+ * readable buffer of at least \p ilen Bytes, and may be
1138
+ * \c NULL if \p ilen is \c 0.
1139
+ * \param ilen The length of the input data. For AEAD ciphers this
1140
+ * must be at least \p tag_len.
1141
+ * \param output The buffer for the output data. This must be a
1142
+ * writable buffer of at least \p output_len Bytes, and
1143
+ * may be \c NULL if \p output_len is \c 0.
1144
+ * \param output_len The length of the \p output buffer in Bytes. For AEAD
1145
+ * ciphers, this must be at least \p ilen - \p tag_len.
1146
+ * \param olen This will be filled with the actual number of Bytes
1147
+ * written to the \p output buffer. This must point to a
1148
+ * writable object of type \c size_t.
1149
+ * \param tag_len The actual length of the authentication tag. For AEAD
1150
+ * ciphers, this must match the constraints imposed by
1151
+ * the cipher used, and in particular must not be \c 0.
1152
+ *
1153
+ * \return \c 0 on success.
1154
+ * \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
1155
+ * parameter-verification failure.
1156
+ * \return #MBEDTLS_ERR_CIPHER_AUTH_FAILED if data is not authentic.
1157
+ * \return A cipher-specific error code on failure.
1158
+ */
1159
+ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx,
1160
+ const unsigned char *iv, size_t iv_len,
1161
+ const unsigned char *ad, size_t ad_len,
1162
+ const unsigned char *input, size_t ilen,
1163
+ unsigned char *output, size_t output_len,
1164
+ size_t *olen, size_t tag_len);
1165
+ #endif /* MBEDTLS_CIPHER_MODE_AEAD */
1166
+
1167
+ #endif /* MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS */
1168
+
1169
+ #ifdef __cplusplus
1170
+ }
1171
+ #endif
1172
+
1173
+ #endif /* TF_PSA_CRYPTO_MBEDTLS_PRIVATE_CIPHER_H */