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,1174 @@
1
+ /**
2
+ * \file x509_crt.h
3
+ *
4
+ * \brief X.509 certificate parsing and writing
5
+ */
6
+ /*
7
+ * Copyright The Mbed TLS Contributors
8
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9
+ */
10
+ #ifndef MBEDTLS_X509_CRT_H
11
+ #define MBEDTLS_X509_CRT_H
12
+ #include "mbedtls/private_access.h"
13
+
14
+ #include "mbedtls/build_info.h"
15
+
16
+ #include "mbedtls/x509.h"
17
+ #include "mbedtls/x509_crl.h"
18
+
19
+ /**
20
+ * \addtogroup x509_module
21
+ * \{
22
+ */
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+
28
+ /**
29
+ * \name Structures and functions for parsing and writing X.509 certificates
30
+ * \{
31
+ */
32
+
33
+ /**
34
+ * Container for an X.509 certificate. The certificate may be chained.
35
+ *
36
+ * Some fields of this structure are publicly readable. Do not modify
37
+ * them except via Mbed TLS library functions: the effect of modifying
38
+ * those fields or the data that those fields points to is unspecified.
39
+ */
40
+ typedef struct mbedtls_x509_crt {
41
+ int MBEDTLS_PRIVATE(own_buffer); /**< Indicates if \c raw is owned
42
+ * by the structure or not. */
43
+ mbedtls_x509_buf raw; /**< The raw certificate data (DER). */
44
+ mbedtls_x509_buf tbs; /**< The raw certificate body (DER). The part that is To Be Signed. */
45
+
46
+ int version; /**< The X.509 version. (1=v1, 2=v2, 3=v3) */
47
+ mbedtls_x509_buf serial; /**< Unique id for certificate issued by a specific CA. */
48
+ mbedtls_x509_buf sig_oid; /**< Signature algorithm, e.g. sha1RSA */
49
+
50
+ mbedtls_x509_buf issuer_raw; /**< The raw issuer data (DER). Used for quick comparison. */
51
+ mbedtls_x509_buf subject_raw; /**< The raw subject data (DER). Used for quick comparison. */
52
+
53
+ mbedtls_x509_name issuer; /**< The parsed issuer data (named information object). */
54
+ mbedtls_x509_name subject; /**< The parsed subject data (named information object). */
55
+
56
+ mbedtls_x509_time valid_from; /**< Start time of certificate validity. */
57
+ mbedtls_x509_time valid_to; /**< End time of certificate validity. */
58
+
59
+ mbedtls_x509_buf pk_raw;
60
+ mbedtls_pk_context pk; /**< Container for the public key context. */
61
+
62
+ mbedtls_x509_buf issuer_id; /**< Optional X.509 v2/v3 issuer unique identifier. */
63
+ mbedtls_x509_buf subject_id; /**< Optional X.509 v2/v3 subject unique identifier. */
64
+ mbedtls_x509_buf v3_ext; /**< Optional X.509 v3 extensions. */
65
+ mbedtls_x509_sequence subject_alt_names; /**< Optional list of raw entries of Subject Alternative Names extension. These can be later parsed by mbedtls_x509_parse_subject_alt_name. */
66
+ mbedtls_x509_buf subject_key_id; /**< Optional X.509 v3 extension subject key identifier. */
67
+ mbedtls_x509_authority authority_key_id; /**< Optional X.509 v3 extension authority key identifier. */
68
+
69
+ mbedtls_x509_sequence certificate_policies; /**< Optional list of certificate policies (Only anyPolicy is printed and enforced, however the rest of the policies are still listed). */
70
+
71
+ int MBEDTLS_PRIVATE(ext_types); /**< Bit string containing detected and parsed extensions */
72
+ int MBEDTLS_PRIVATE(ca_istrue); /**< Optional Basic Constraint extension value: 1 if this certificate belongs to a CA, 0 otherwise. */
73
+ int MBEDTLS_PRIVATE(max_pathlen); /**< Optional Basic Constraint extension value: The maximum path length to the root certificate. Path length is 1 higher than RFC 5280 'meaning', so 1+ */
74
+
75
+ unsigned int MBEDTLS_PRIVATE(key_usage); /**< Optional key usage extension value: See the values in x509.h */
76
+
77
+ mbedtls_x509_sequence ext_key_usage; /**< Optional list of extended key usage OIDs. */
78
+
79
+ unsigned char MBEDTLS_PRIVATE(ns_cert_type); /**< Optional Netscape certificate type extension value: See the values in x509.h */
80
+
81
+ mbedtls_x509_buf MBEDTLS_PRIVATE(sig); /**< Signature: hash of the tbs part signed with the private key. */
82
+ mbedtls_md_type_t MBEDTLS_PRIVATE(sig_md); /**< Internal representation of the MD algorithm of the signature algorithm, e.g. MBEDTLS_MD_SHA256 */
83
+ mbedtls_pk_sigalg_t MBEDTLS_PRIVATE(sig_pk); /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. MBEDTLS_PK_RSA */
84
+
85
+ /* Unused field reserved for future use */
86
+ union {
87
+ size_t number;
88
+ void *ptr;
89
+ } MBEDTLS_PRIVATE(unused);
90
+
91
+ /** Next certificate in the linked list that constitutes the CA chain.
92
+ * \p NULL indicates the end of the list.
93
+ * Do not modify this field directly. */
94
+ struct mbedtls_x509_crt *next;
95
+ }
96
+ mbedtls_x509_crt;
97
+
98
+ /**
99
+ * Build flag from an algorithm/curve identifier (pk, md, ecp)
100
+ * Since 0 is always XXX_NONE, ignore it.
101
+ */
102
+ #define MBEDTLS_X509_ID_FLAG(id) (1 << ((id) - 1))
103
+
104
+ /**
105
+ * Security profile for certificate verification.
106
+ *
107
+ * All lists are bitfields, built by ORing flags from MBEDTLS_X509_ID_FLAG().
108
+ *
109
+ * The fields of this structure are part of the public API and can be
110
+ * manipulated directly by applications. Future versions of the library may
111
+ * add extra fields or reorder existing fields.
112
+ *
113
+ * You can create custom profiles by starting from a copy of
114
+ * an existing profile, such as mbedtls_x509_crt_profile_default or
115
+ * mbedtls_x509_ctr_profile_none and then tune it to your needs.
116
+ *
117
+ * For example to allow SHA-224 in addition to the default:
118
+ *
119
+ * mbedtls_x509_crt_profile my_profile = mbedtls_x509_crt_profile_default;
120
+ * my_profile.allowed_mds |= MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA224 );
121
+ *
122
+ * Or to allow only RSA-3072+ with SHA-256:
123
+ *
124
+ * mbedtls_x509_crt_profile my_profile = mbedtls_x509_crt_profile_none;
125
+ * my_profile.allowed_mds = MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 );
126
+ * my_profile.allowed_pks = MBEDTLS_X509_ID_FLAG( MBEDTLS_PK_RSA );
127
+ * my_profile.rsa_min_bitlen = 3072;
128
+ */
129
+ typedef struct mbedtls_x509_crt_profile {
130
+ uint32_t allowed_mds; /**< MDs for signatures */
131
+ uint32_t allowed_pks; /**< PK algs for public keys;
132
+ * this applies to all certificates
133
+ * in the provided chain. */
134
+ uint32_t allowed_curves; /**< Elliptic curves for ECDSA */
135
+ uint32_t rsa_min_bitlen; /**< Minimum size for RSA keys */
136
+ }
137
+ mbedtls_x509_crt_profile;
138
+
139
+ #define MBEDTLS_X509_CRT_VERSION_1 0
140
+ #define MBEDTLS_X509_CRT_VERSION_2 1
141
+ #define MBEDTLS_X509_CRT_VERSION_3 2
142
+
143
+ #define MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN 20
144
+ #define MBEDTLS_X509_RFC5280_UTC_TIME_LEN 15
145
+
146
+ #if !defined(MBEDTLS_X509_MAX_FILE_PATH_LEN)
147
+ #define MBEDTLS_X509_MAX_FILE_PATH_LEN 512
148
+ #endif
149
+
150
+ /* This macro unfolds to the concatenation of macro invocations
151
+ * X509_CRT_ERROR_INFO( error code,
152
+ * error code as string,
153
+ * human readable description )
154
+ * where X509_CRT_ERROR_INFO is defined by the user.
155
+ * See x509_crt.c for an example of how to use this. */
156
+ #define MBEDTLS_X509_CRT_ERROR_INFO_LIST \
157
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_EXPIRED, \
158
+ "MBEDTLS_X509_BADCERT_EXPIRED", \
159
+ "The certificate validity has expired") \
160
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_REVOKED, \
161
+ "MBEDTLS_X509_BADCERT_REVOKED", \
162
+ "The certificate has been revoked (is on a CRL)") \
163
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_CN_MISMATCH, \
164
+ "MBEDTLS_X509_BADCERT_CN_MISMATCH", \
165
+ "The certificate Common Name (CN) does not match with the expected CN") \
166
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_NOT_TRUSTED, \
167
+ "MBEDTLS_X509_BADCERT_NOT_TRUSTED", \
168
+ "The certificate is not correctly signed by the trusted CA") \
169
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCRL_NOT_TRUSTED, \
170
+ "MBEDTLS_X509_BADCRL_NOT_TRUSTED", \
171
+ "The CRL is not correctly signed by the trusted CA") \
172
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCRL_EXPIRED, \
173
+ "MBEDTLS_X509_BADCRL_EXPIRED", \
174
+ "The CRL is expired") \
175
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_MISSING, \
176
+ "MBEDTLS_X509_BADCERT_MISSING", \
177
+ "Certificate was missing") \
178
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_SKIP_VERIFY, \
179
+ "MBEDTLS_X509_BADCERT_SKIP_VERIFY", \
180
+ "Certificate verification was skipped") \
181
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_OTHER, \
182
+ "MBEDTLS_X509_BADCERT_OTHER", \
183
+ "Other reason (can be used by verify callback)") \
184
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_FUTURE, \
185
+ "MBEDTLS_X509_BADCERT_FUTURE", \
186
+ "The certificate validity starts in the future") \
187
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCRL_FUTURE, \
188
+ "MBEDTLS_X509_BADCRL_FUTURE", \
189
+ "The CRL is from the future") \
190
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_KEY_USAGE, \
191
+ "MBEDTLS_X509_BADCERT_KEY_USAGE", \
192
+ "Usage does not match the keyUsage extension") \
193
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_EXT_KEY_USAGE, \
194
+ "MBEDTLS_X509_BADCERT_EXT_KEY_USAGE", \
195
+ "Usage does not match the extendedKeyUsage extension") \
196
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_NS_CERT_TYPE, \
197
+ "MBEDTLS_X509_BADCERT_NS_CERT_TYPE", \
198
+ "Usage does not match the nsCertType extension") \
199
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_BAD_MD, \
200
+ "MBEDTLS_X509_BADCERT_BAD_MD", \
201
+ "The certificate is signed with an unacceptable hash.") \
202
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_BAD_PK, \
203
+ "MBEDTLS_X509_BADCERT_BAD_PK", \
204
+ "The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA).") \
205
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCERT_BAD_KEY, \
206
+ "MBEDTLS_X509_BADCERT_BAD_KEY", \
207
+ "The certificate is signed with an unacceptable key (eg bad curve, RSA too short).") \
208
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCRL_BAD_MD, \
209
+ "MBEDTLS_X509_BADCRL_BAD_MD", \
210
+ "The CRL is signed with an unacceptable hash.") \
211
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCRL_BAD_PK, \
212
+ "MBEDTLS_X509_BADCRL_BAD_PK", \
213
+ "The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA).") \
214
+ X509_CRT_ERROR_INFO(MBEDTLS_X509_BADCRL_BAD_KEY, \
215
+ "MBEDTLS_X509_BADCRL_BAD_KEY", \
216
+ "The CRL is signed with an unacceptable key (eg bad curve, RSA too short).")
217
+
218
+ /**
219
+ * Container for writing a certificate (CRT)
220
+ */
221
+ typedef struct mbedtls_x509write_cert {
222
+ int MBEDTLS_PRIVATE(version);
223
+ unsigned char MBEDTLS_PRIVATE(serial)[MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN];
224
+ size_t MBEDTLS_PRIVATE(serial_len);
225
+ mbedtls_pk_context *MBEDTLS_PRIVATE(subject_key);
226
+ mbedtls_pk_context *MBEDTLS_PRIVATE(issuer_key);
227
+ mbedtls_asn1_named_data *MBEDTLS_PRIVATE(subject);
228
+ mbedtls_asn1_named_data *MBEDTLS_PRIVATE(issuer);
229
+ mbedtls_md_type_t MBEDTLS_PRIVATE(md_alg);
230
+ char MBEDTLS_PRIVATE(not_before)[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];
231
+ char MBEDTLS_PRIVATE(not_after)[MBEDTLS_X509_RFC5280_UTC_TIME_LEN + 1];
232
+ mbedtls_asn1_named_data *MBEDTLS_PRIVATE(extensions);
233
+ }
234
+ mbedtls_x509write_cert;
235
+
236
+ /**
237
+ * \brief Set Subject Alternative Name
238
+ *
239
+ * \param ctx Certificate context to use
240
+ * \param san_list List of SAN values
241
+ *
242
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
243
+ *
244
+ * \note "dnsName", "uniformResourceIdentifier", "IP address",
245
+ * "otherName", and "DirectoryName", as defined in RFC 5280,
246
+ * are supported.
247
+ */
248
+ int mbedtls_x509write_crt_set_subject_alternative_name(mbedtls_x509write_cert *ctx,
249
+ const mbedtls_x509_san_list *san_list);
250
+
251
+ /**
252
+ * Item in a verification chain: cert and flags for it
253
+ */
254
+ typedef struct {
255
+ mbedtls_x509_crt *MBEDTLS_PRIVATE(crt);
256
+ uint32_t MBEDTLS_PRIVATE(flags);
257
+ } mbedtls_x509_crt_verify_chain_item;
258
+
259
+ /**
260
+ * Max size of verification chain: end-entity + intermediates + trusted root
261
+ */
262
+ #define MBEDTLS_X509_MAX_VERIFY_CHAIN_SIZE (MBEDTLS_X509_MAX_INTERMEDIATE_CA + 2)
263
+
264
+ /**
265
+ * Verification chain as built by \c mbedtls_crt_verify_chain()
266
+ */
267
+ typedef struct {
268
+ mbedtls_x509_crt_verify_chain_item MBEDTLS_PRIVATE(items)[MBEDTLS_X509_MAX_VERIFY_CHAIN_SIZE];
269
+ unsigned MBEDTLS_PRIVATE(len);
270
+
271
+ #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
272
+ /* This stores the list of potential trusted signers obtained from
273
+ * the CA callback used for the CRT verification, if configured.
274
+ * We must track it somewhere because the callback passes its
275
+ * ownership to the caller. */
276
+ mbedtls_x509_crt *MBEDTLS_PRIVATE(trust_ca_cb_result);
277
+ #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
278
+ } mbedtls_x509_crt_verify_chain;
279
+
280
+ #if defined(MBEDTLS_ECP_RESTARTABLE)
281
+
282
+ /**
283
+ * \brief Context for resuming X.509 verify operations
284
+ */
285
+ typedef struct {
286
+ /* for check_signature() */
287
+ mbedtls_pk_restart_ctx MBEDTLS_PRIVATE(pk);
288
+
289
+ /* for find_parent_in() */
290
+ mbedtls_x509_crt *MBEDTLS_PRIVATE(parent); /* non-null iff parent_in in progress */
291
+ mbedtls_x509_crt *MBEDTLS_PRIVATE(fallback_parent);
292
+ int MBEDTLS_PRIVATE(fallback_signature_is_good);
293
+
294
+ /* for find_parent() */
295
+ int MBEDTLS_PRIVATE(parent_is_trusted); /* -1 if find_parent is not in progress */
296
+
297
+ /* for verify_chain() */
298
+ enum {
299
+ x509_crt_rs_none,
300
+ x509_crt_rs_find_parent,
301
+ } MBEDTLS_PRIVATE(in_progress); /* none if no operation is in progress */
302
+ int MBEDTLS_PRIVATE(self_cnt);
303
+ mbedtls_x509_crt_verify_chain MBEDTLS_PRIVATE(ver_chain);
304
+
305
+ } mbedtls_x509_crt_restart_ctx;
306
+
307
+ #else /* MBEDTLS_ECP_RESTARTABLE */
308
+
309
+ /* Now we can declare functions that take a pointer to that */
310
+ typedef void mbedtls_x509_crt_restart_ctx;
311
+
312
+ #endif /* MBEDTLS_ECP_RESTARTABLE */
313
+
314
+ #if defined(MBEDTLS_X509_CRT_PARSE_C)
315
+ /**
316
+ * Default security profile. Should provide a good balance between security
317
+ * and compatibility with current deployments.
318
+ *
319
+ * This profile permits:
320
+ * - SHA2 hashes with at least 256 bits: SHA-256, SHA-384, SHA-512.
321
+ * - Elliptic curves with 255 bits and above except secp256k1.
322
+ * - RSA with 2048 bits and above.
323
+ *
324
+ * New minor versions of Mbed TLS may extend this profile, for example if
325
+ * new algorithms are added to the library. New minor versions of Mbed TLS will
326
+ * not reduce this profile unless serious security concerns require it.
327
+ */
328
+ extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default;
329
+
330
+ /**
331
+ * Expected next default profile. Recommended for new deployments.
332
+ * Currently targets a 128-bit security level, except for allowing RSA-2048.
333
+ * This profile may change at any time.
334
+ */
335
+ extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next;
336
+
337
+ /**
338
+ * NSA Suite B profile.
339
+ */
340
+ extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb;
341
+
342
+ /**
343
+ * Empty profile that allows nothing. Useful as a basis for constructing
344
+ * custom profiles.
345
+ */
346
+ extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_none;
347
+
348
+ /**
349
+ * \brief Parse a single DER formatted certificate and add it
350
+ * to the end of the provided chained list.
351
+ *
352
+ * \note The PSA crypto subsystem must have been initialized by
353
+ * calling psa_crypto_init() before calling this function.
354
+ *
355
+ * \param chain The pointer to the start of the CRT chain to attach to.
356
+ * When parsing the first CRT in a chain, this should point
357
+ * to an instance of ::mbedtls_x509_crt initialized through
358
+ * mbedtls_x509_crt_init().
359
+ * \param buf The buffer holding the DER encoded certificate.
360
+ * \param buflen The size in Bytes of \p buf.
361
+ *
362
+ * \note This function makes an internal copy of the CRT buffer
363
+ * \p buf. In particular, \p buf may be destroyed or reused
364
+ * after this call returns. To avoid duplicating the CRT
365
+ * buffer (at the cost of stricter lifetime constraints),
366
+ * use mbedtls_x509_crt_parse_der_nocopy() instead.
367
+ *
368
+ * \return \c 0 if successful.
369
+ * \return A negative error code on failure.
370
+ */
371
+ int mbedtls_x509_crt_parse_der(mbedtls_x509_crt *chain,
372
+ const unsigned char *buf,
373
+ size_t buflen);
374
+
375
+ /**
376
+ * \brief The type of certificate extension callbacks.
377
+ *
378
+ * Callbacks of this type are passed to and used by the
379
+ * mbedtls_x509_crt_parse_der_with_ext_cb() routine when
380
+ * it encounters either an unsupported extension or a
381
+ * "certificate policies" extension containing any
382
+ * unsupported certificate policies.
383
+ * Future versions of the library may invoke the callback
384
+ * in other cases, if and when the need arises.
385
+ *
386
+ * \param p_ctx An opaque context passed to the callback.
387
+ * \param crt The certificate being parsed.
388
+ * \param oid The OID of the extension.
389
+ * \param critical Whether the extension is critical.
390
+ * \param p Pointer to the start of the extension value
391
+ * (the content of the OCTET STRING).
392
+ * \param end End of extension value.
393
+ *
394
+ * \note The callback must fail and return a negative error code
395
+ * if it can not parse or does not support the extension.
396
+ * When the callback fails to parse a critical extension
397
+ * mbedtls_x509_crt_parse_der_with_ext_cb() also fails.
398
+ * When the callback fails to parse a non critical extension
399
+ * mbedtls_x509_crt_parse_der_with_ext_cb() simply skips
400
+ * the extension and continues parsing.
401
+ *
402
+ * \return \c 0 on success.
403
+ * \return A negative error code on failure.
404
+ */
405
+ typedef int (*mbedtls_x509_crt_ext_cb_t)(void *p_ctx,
406
+ mbedtls_x509_crt const *crt,
407
+ mbedtls_x509_buf const *oid,
408
+ int critical,
409
+ const unsigned char *p,
410
+ const unsigned char *end);
411
+
412
+ /**
413
+ * \brief Parse a single DER formatted certificate and add it
414
+ * to the end of the provided chained list.
415
+ *
416
+ * \note The PSA crypto subsystem must have been initialized by
417
+ * calling psa_crypto_init() before calling this function.
418
+ *
419
+ * \param chain The pointer to the start of the CRT chain to attach to.
420
+ * When parsing the first CRT in a chain, this should point
421
+ * to an instance of ::mbedtls_x509_crt initialized through
422
+ * mbedtls_x509_crt_init().
423
+ * \param buf The buffer holding the DER encoded certificate.
424
+ * \param buflen The size in Bytes of \p buf.
425
+ * \param make_copy When not zero this function makes an internal copy of the
426
+ * CRT buffer \p buf. In particular, \p buf may be destroyed
427
+ * or reused after this call returns.
428
+ * When zero this function avoids duplicating the CRT buffer
429
+ * by taking temporary ownership thereof until the CRT
430
+ * is destroyed (like mbedtls_x509_crt_parse_der_nocopy())
431
+ * \param cb A callback invoked for every unsupported certificate
432
+ * extension.
433
+ * \param p_ctx An opaque context passed to the callback.
434
+ *
435
+ * \note This call is functionally equivalent to
436
+ * mbedtls_x509_crt_parse_der(), and/or
437
+ * mbedtls_x509_crt_parse_der_nocopy()
438
+ * but it calls the callback with every unsupported
439
+ * certificate extension and additionally the
440
+ * "certificate policies" extension if it contains any
441
+ * unsupported certificate policies.
442
+ * The callback must return a negative error code if it
443
+ * does not know how to handle such an extension.
444
+ * When the callback fails to parse a critical extension
445
+ * mbedtls_x509_crt_parse_der_with_ext_cb() also fails.
446
+ * When the callback fails to parse a non critical extension
447
+ * mbedtls_x509_crt_parse_der_with_ext_cb() simply skips
448
+ * the extension and continues parsing.
449
+ * Future versions of the library may invoke the callback
450
+ * in other cases, if and when the need arises.
451
+ *
452
+ * \return \c 0 if successful.
453
+ * \return A negative error code on failure.
454
+ */
455
+ int mbedtls_x509_crt_parse_der_with_ext_cb(mbedtls_x509_crt *chain,
456
+ const unsigned char *buf,
457
+ size_t buflen,
458
+ int make_copy,
459
+ mbedtls_x509_crt_ext_cb_t cb,
460
+ void *p_ctx);
461
+
462
+ /**
463
+ * \brief Parse a single DER formatted certificate and add it
464
+ * to the end of the provided chained list. This is a
465
+ * variant of mbedtls_x509_crt_parse_der() which takes
466
+ * temporary ownership of the CRT buffer until the CRT
467
+ * is destroyed.
468
+ *
469
+ * \note The PSA crypto subsystem must have been initialized by
470
+ * calling psa_crypto_init() before calling this function.
471
+ *
472
+ * \param chain The pointer to the start of the CRT chain to attach to.
473
+ * When parsing the first CRT in a chain, this should point
474
+ * to an instance of ::mbedtls_x509_crt initialized through
475
+ * mbedtls_x509_crt_init().
476
+ * \param buf The address of the readable buffer holding the DER encoded
477
+ * certificate to use. On success, this buffer must be
478
+ * retained and not be changed for the lifetime of the
479
+ * CRT chain \p chain, that is, until \p chain is destroyed
480
+ * through a call to mbedtls_x509_crt_free().
481
+ * \param buflen The size in Bytes of \p buf.
482
+ *
483
+ * \note This call is functionally equivalent to
484
+ * mbedtls_x509_crt_parse_der(), but it avoids creating a
485
+ * copy of the input buffer at the cost of stronger lifetime
486
+ * constraints. This is useful in constrained environments
487
+ * where duplication of the CRT cannot be tolerated.
488
+ *
489
+ * \return \c 0 if successful.
490
+ * \return A negative error code on failure.
491
+ */
492
+ int mbedtls_x509_crt_parse_der_nocopy(mbedtls_x509_crt *chain,
493
+ const unsigned char *buf,
494
+ size_t buflen);
495
+
496
+ /**
497
+ * \brief Parse one DER-encoded or one or more concatenated PEM-encoded
498
+ * certificates and add them to the chained list.
499
+ *
500
+ * For CRTs in PEM encoding, the function parses permissively:
501
+ * if at least one certificate can be parsed, the function
502
+ * returns the number of certificates for which parsing failed
503
+ * (hence \c 0 if all certificates were parsed successfully).
504
+ * If no certificate could be parsed, the function returns
505
+ * the first (negative) error encountered during parsing.
506
+ *
507
+ * PEM encoded certificates may be interleaved by other data
508
+ * such as human readable descriptions of their content, as
509
+ * long as the certificates are enclosed in the PEM specific
510
+ * '-----{BEGIN/END} CERTIFICATE-----' delimiters.
511
+ *
512
+ * \note The PSA crypto subsystem must have been initialized by
513
+ * calling psa_crypto_init() before calling this function.
514
+ *
515
+ * \param chain The chain to which to add the parsed certificates.
516
+ * \param buf The buffer holding the certificate data in PEM or DER format.
517
+ * For certificates in PEM encoding, this may be a concatenation
518
+ * of multiple certificates; for DER encoding, the buffer must
519
+ * comprise exactly one certificate.
520
+ * \param buflen The size of \p buf, including the terminating \c NULL byte
521
+ * in case of PEM encoded data.
522
+ *
523
+ * \return \c 0 if all certificates were parsed successfully.
524
+ * \return The (positive) number of certificates that couldn't
525
+ * be parsed if parsing was partly successful (see above).
526
+ * \return A negative X509 or PEM error code otherwise.
527
+ *
528
+ */
529
+ int mbedtls_x509_crt_parse(mbedtls_x509_crt *chain, const unsigned char *buf, size_t buflen);
530
+
531
+ #if defined(MBEDTLS_FS_IO)
532
+ /**
533
+ * \brief Load one or more certificates and add them
534
+ * to the chained list. Parses permissively. If some
535
+ * certificates can be parsed, the result is the number
536
+ * of failed certificates it encountered. If none complete
537
+ * correctly, the first error is returned.
538
+ *
539
+ * \note The PSA crypto subsystem must have been initialized by
540
+ * calling psa_crypto_init() before calling this function.
541
+ *
542
+ * \param chain points to the start of the chain
543
+ * \param path filename to read the certificates from
544
+ *
545
+ * \return 0 if all certificates parsed successfully, a positive number
546
+ * if partly successful or a specific X509 or PEM error code
547
+ */
548
+ int mbedtls_x509_crt_parse_file(mbedtls_x509_crt *chain, const char *path);
549
+
550
+ /**
551
+ * \brief Load one or more certificate files from a path and add them
552
+ * to the chained list. Parses permissively. If some
553
+ * certificates can be parsed, the result is the number
554
+ * of failed certificates it encountered. If none complete
555
+ * correctly, the first error is returned.
556
+ *
557
+ * \param chain points to the start of the chain
558
+ * \param path directory / folder to read the certificate files from
559
+ *
560
+ * \return 0 if all certificates parsed successfully, a positive number
561
+ * if partly successful or a specific X509 or PEM error code
562
+ */
563
+ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path);
564
+
565
+ #endif /* MBEDTLS_FS_IO */
566
+
567
+ #if !defined(MBEDTLS_X509_REMOVE_INFO)
568
+ /**
569
+ * \brief Returns an informational string about the
570
+ * certificate.
571
+ *
572
+ * \param buf Buffer to write to
573
+ * \param size Maximum size of buffer
574
+ * \param prefix A line prefix
575
+ * \param crt The X509 certificate to represent
576
+ *
577
+ * \return The length of the string written (not including the
578
+ * terminated nul byte), or a negative error code.
579
+ */
580
+ int mbedtls_x509_crt_info(char *buf, size_t size, const char *prefix,
581
+ const mbedtls_x509_crt *crt);
582
+
583
+ /**
584
+ * \brief Returns an informational string about the
585
+ * verification status of a certificate.
586
+ *
587
+ * \param buf Buffer to write to
588
+ * \param size Maximum size of buffer
589
+ * \param prefix A line prefix
590
+ * \param flags Verification flags created by mbedtls_x509_crt_verify()
591
+ *
592
+ * \return The length of the string written (not including the
593
+ * terminated nul byte), or a negative error code.
594
+ */
595
+ int mbedtls_x509_crt_verify_info(char *buf, size_t size, const char *prefix,
596
+ uint32_t flags);
597
+ #endif /* !MBEDTLS_X509_REMOVE_INFO */
598
+
599
+ /**
600
+ * \brief Verify a chain of certificates.
601
+ *
602
+ * The verify callback is a user-supplied callback that
603
+ * can clear / modify / add flags for a certificate. If set,
604
+ * the verification callback is called for each
605
+ * certificate in the chain (from the trust-ca down to the
606
+ * presented crt). The parameters for the callback are:
607
+ * (void *parameter, mbedtls_x509_crt *crt, int certificate_depth,
608
+ * int *flags). With the flags representing current flags for
609
+ * that specific certificate and the certificate depth from
610
+ * the bottom (Peer cert depth = 0).
611
+ *
612
+ * All flags left after returning from the callback
613
+ * are also returned to the application. The function should
614
+ * return 0 for anything (including invalid certificates)
615
+ * other than fatal error, as a non-zero return code
616
+ * immediately aborts the verification process. For fatal
617
+ * errors, a specific error code should be used (different
618
+ * from #MBEDTLS_ERR_X509_CERT_VERIFY_FAILED which should not
619
+ * be returned at this point), or MBEDTLS_ERR_X509_FATAL_ERROR
620
+ * can be used if no better code is available.
621
+ *
622
+ * \note In case verification failed, the results can be displayed
623
+ * using \c mbedtls_x509_crt_verify_info()
624
+ *
625
+ * \note Same as \c mbedtls_x509_crt_verify_with_profile() with the
626
+ * default security profile.
627
+ *
628
+ * \note It is your responsibility to provide up-to-date CRLs for
629
+ * all trusted CAs. If no CRL is provided for the CA that was
630
+ * used to sign the certificate, CRL verification is skipped
631
+ * silently, that is *without* setting any flag.
632
+ *
633
+ * \note The \c trust_ca list can contain two types of certificates:
634
+ * (1) those of trusted root CAs, so that certificates
635
+ * chaining up to those CAs will be trusted, and (2)
636
+ * self-signed end-entity certificates to be trusted (for
637
+ * specific peers you know) - in that case, the self-signed
638
+ * certificate doesn't need to have the CA bit set.
639
+ *
640
+ * \param crt The certificate chain to be verified.
641
+ * \param trust_ca The list of trusted CAs.
642
+ * \param ca_crl The list of CRLs for trusted CAs.
643
+ * \param cn The expected Common Name. This will be checked to be
644
+ * present in the certificate's subjectAltNames extension or,
645
+ * if this extension is absent, as a CN component in its
646
+ * Subject name. DNS names and IP addresses are fully
647
+ * supported, while the URI subtype is partially supported:
648
+ * only exact matching, without any normalization procedures
649
+ * described in 7.4 of RFC5280, will result in a positive
650
+ * URI verification.
651
+ * This may be \c NULL if the CN need not be verified.
652
+ * \param flags The address at which to store the result of the verification.
653
+ * If the verification couldn't be completed, the flag value is
654
+ * set to (uint32_t) -1.
655
+ * \param f_vrfy The verification callback to use. See the documentation
656
+ * of mbedtls_x509_crt_verify() for more information.
657
+ * \param p_vrfy The context to be passed to \p f_vrfy.
658
+ *
659
+ * \return \c 0 if the chain is valid with respect to the
660
+ * passed CN, CAs, CRLs and security profile.
661
+ * \return #MBEDTLS_ERR_X509_CERT_VERIFY_FAILED in case the
662
+ * certificate chain verification failed. In this case,
663
+ * \c *flags will have one or more
664
+ * \c MBEDTLS_X509_BADCERT_XXX or \c MBEDTLS_X509_BADCRL_XXX
665
+ * flags set.
666
+ * \return Another negative error code in case of a fatal error
667
+ * encountered during the verification process.
668
+ */
669
+ int mbedtls_x509_crt_verify(mbedtls_x509_crt *crt,
670
+ mbedtls_x509_crt *trust_ca,
671
+ mbedtls_x509_crl *ca_crl,
672
+ const char *cn, uint32_t *flags,
673
+ int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
674
+ void *p_vrfy);
675
+
676
+ /**
677
+ * \brief Verify a chain of certificates with respect to
678
+ * a configurable security profile.
679
+ *
680
+ * \note Same as \c mbedtls_x509_crt_verify(), but with explicit
681
+ * security profile.
682
+ *
683
+ * \note The restrictions on keys (RSA minimum size, allowed curves
684
+ * for ECDSA) apply to all certificates: trusted root,
685
+ * intermediate CAs if any, and end entity certificate.
686
+ *
687
+ * \param crt The certificate chain to be verified.
688
+ * \param trust_ca The list of trusted CAs.
689
+ * \param ca_crl The list of CRLs for trusted CAs.
690
+ * \param profile The security profile to use for the verification.
691
+ * \param cn The expected Common Name. This may be \c NULL if the
692
+ * CN need not be verified.
693
+ * \param flags The address at which to store the result of the verification.
694
+ * If the verification couldn't be completed, the flag value is
695
+ * set to (uint32_t) -1.
696
+ * \param f_vrfy The verification callback to use. See the documentation
697
+ * of mbedtls_x509_crt_verify() for more information.
698
+ * \param p_vrfy The context to be passed to \p f_vrfy.
699
+ *
700
+ * \return \c 0 if the chain is valid with respect to the
701
+ * passed CN, CAs, CRLs and security profile.
702
+ * \return #MBEDTLS_ERR_X509_CERT_VERIFY_FAILED in case the
703
+ * certificate chain verification failed. In this case,
704
+ * \c *flags will have one or more
705
+ * \c MBEDTLS_X509_BADCERT_XXX or \c MBEDTLS_X509_BADCRL_XXX
706
+ * flags set.
707
+ * \return Another negative error code in case of a fatal error
708
+ * encountered during the verification process.
709
+ */
710
+ int mbedtls_x509_crt_verify_with_profile(mbedtls_x509_crt *crt,
711
+ mbedtls_x509_crt *trust_ca,
712
+ mbedtls_x509_crl *ca_crl,
713
+ const mbedtls_x509_crt_profile *profile,
714
+ const char *cn, uint32_t *flags,
715
+ int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
716
+ void *p_vrfy);
717
+
718
+ /**
719
+ * \brief Restartable version of \c mbedtls_crt_verify_with_profile()
720
+ *
721
+ * \note Performs the same job as \c mbedtls_crt_verify_with_profile()
722
+ * but can return early and restart according to the limit
723
+ * set with \c psa_interruptible_set_max_ops() to reduce blocking.
724
+ *
725
+ * \param crt The certificate chain to be verified.
726
+ * \param trust_ca The list of trusted CAs.
727
+ * \param ca_crl The list of CRLs for trusted CAs.
728
+ * \param profile The security profile to use for the verification.
729
+ * \param cn The expected Common Name. This may be \c NULL if the
730
+ * CN need not be verified.
731
+ * \param flags The address at which to store the result of the verification.
732
+ * If the verification couldn't be completed, the flag value is
733
+ * set to (uint32_t) -1.
734
+ * \param f_vrfy The verification callback to use. See the documentation
735
+ * of mbedtls_x509_crt_verify() for more information.
736
+ * \param p_vrfy The context to be passed to \p f_vrfy.
737
+ * \param rs_ctx The restart context to use. This may be set to \c NULL
738
+ * to disable restartable ECC.
739
+ *
740
+ * \return See \c mbedtls_crt_verify_with_profile(), or
741
+ * \return #PSA_OPERATION_INCOMPLETE if maximum number of
742
+ * operations was reached: see \c psa_interruptible_set_max_ops().
743
+ */
744
+ int mbedtls_x509_crt_verify_restartable(mbedtls_x509_crt *crt,
745
+ mbedtls_x509_crt *trust_ca,
746
+ mbedtls_x509_crl *ca_crl,
747
+ const mbedtls_x509_crt_profile *profile,
748
+ const char *cn, uint32_t *flags,
749
+ int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
750
+ void *p_vrfy,
751
+ mbedtls_x509_crt_restart_ctx *rs_ctx);
752
+
753
+ /**
754
+ * \brief The type of trusted certificate callbacks.
755
+ *
756
+ * Callbacks of this type are passed to and used by the CRT
757
+ * verification routine mbedtls_x509_crt_verify_with_ca_cb()
758
+ * when looking for trusted signers of a given certificate.
759
+ *
760
+ * On success, the callback returns a list of trusted
761
+ * certificates to be considered as potential signers
762
+ * for the input certificate.
763
+ *
764
+ * \param p_ctx An opaque context passed to the callback.
765
+ * \param child The certificate for which to search a potential signer.
766
+ * This will point to a readable certificate.
767
+ * \param candidate_cas The address at which to store the address of the first
768
+ * entry in the generated linked list of candidate signers.
769
+ * This will not be \c NULL.
770
+ *
771
+ * \note The callback must only return a non-zero value on a
772
+ * fatal error. If, in contrast, the search for a potential
773
+ * signer completes without a single candidate, the
774
+ * callback must return \c 0 and set \c *candidate_cas
775
+ * to \c NULL.
776
+ *
777
+ * \return \c 0 on success. In this case, \c *candidate_cas points
778
+ * to a heap-allocated linked list of instances of
779
+ * ::mbedtls_x509_crt, and ownership of this list is passed
780
+ * to the caller.
781
+ * \return A negative error code on failure.
782
+ */
783
+ typedef int (*mbedtls_x509_crt_ca_cb_t)(void *p_ctx,
784
+ mbedtls_x509_crt const *child,
785
+ mbedtls_x509_crt **candidate_cas);
786
+
787
+ #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
788
+ /**
789
+ * \brief Version of \c mbedtls_x509_crt_verify_with_profile() which
790
+ * uses a callback to acquire the list of trusted CA
791
+ * certificates.
792
+ *
793
+ * \param crt The certificate chain to be verified.
794
+ * \param f_ca_cb The callback to be used to query for potential signers
795
+ * of a given child certificate. See the documentation of
796
+ * ::mbedtls_x509_crt_ca_cb_t for more information.
797
+ * \param p_ca_cb The opaque context to be passed to \p f_ca_cb.
798
+ * \param profile The security profile for the verification.
799
+ * \param cn The expected Common Name. This may be \c NULL if the
800
+ * CN need not be verified.
801
+ * \param flags The address at which to store the result of the verification.
802
+ * If the verification couldn't be completed, the flag value is
803
+ * set to (uint32_t) -1.
804
+ * \param f_vrfy The verification callback to use. See the documentation
805
+ * of mbedtls_x509_crt_verify() for more information.
806
+ * \param p_vrfy The context to be passed to \p f_vrfy.
807
+ *
808
+ * \return See \c mbedtls_crt_verify_with_profile().
809
+ */
810
+ int mbedtls_x509_crt_verify_with_ca_cb(mbedtls_x509_crt *crt,
811
+ mbedtls_x509_crt_ca_cb_t f_ca_cb,
812
+ void *p_ca_cb,
813
+ const mbedtls_x509_crt_profile *profile,
814
+ const char *cn, uint32_t *flags,
815
+ int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
816
+ void *p_vrfy);
817
+
818
+ #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
819
+
820
+ /**
821
+ * \brief Check usage of certificate against keyUsage extension.
822
+ *
823
+ * \param crt Leaf certificate used.
824
+ * \param usage Intended usage(s) (eg MBEDTLS_X509_KU_KEY_ENCIPHERMENT
825
+ * before using the certificate to perform an RSA key
826
+ * exchange).
827
+ *
828
+ * \note Except for decipherOnly and encipherOnly, a bit set in the
829
+ * usage argument means this bit MUST be set in the
830
+ * certificate. For decipherOnly and encipherOnly, it means
831
+ * that bit MAY be set.
832
+ *
833
+ * \return 0 is these uses of the certificate are allowed,
834
+ * #MBEDTLS_ERR_X509_BAD_INPUT_DATA if the keyUsage extension
835
+ * is present but does not match the usage argument.
836
+ *
837
+ * \note You should only call this function on leaf certificates, on
838
+ * (intermediate) CAs the keyUsage extension is automatically
839
+ * checked by \c mbedtls_x509_crt_verify().
840
+ */
841
+ int mbedtls_x509_crt_check_key_usage(const mbedtls_x509_crt *crt,
842
+ unsigned int usage);
843
+
844
+ /**
845
+ * \brief Check usage of certificate against extendedKeyUsage.
846
+ *
847
+ * \param crt Leaf certificate used.
848
+ * \param usage_oid Intended usage (eg MBEDTLS_OID_SERVER_AUTH or
849
+ * MBEDTLS_OID_CLIENT_AUTH).
850
+ * \param usage_len Length of usage_oid (eg given by MBEDTLS_OID_SIZE()).
851
+ *
852
+ * \return 0 if this use of the certificate is allowed,
853
+ * #MBEDTLS_ERR_X509_BAD_INPUT_DATA if not.
854
+ *
855
+ * \note Usually only makes sense on leaf certificates.
856
+ */
857
+ int mbedtls_x509_crt_check_extended_key_usage(const mbedtls_x509_crt *crt,
858
+ const char *usage_oid,
859
+ size_t usage_len);
860
+
861
+ #if defined(MBEDTLS_X509_CRL_PARSE_C)
862
+ /**
863
+ * \brief Verify the certificate revocation status
864
+ *
865
+ * \param crt a certificate to be verified
866
+ * \param crl the CRL to verify against
867
+ *
868
+ * \return 1 if the certificate is revoked, 0 otherwise
869
+ *
870
+ */
871
+ int mbedtls_x509_crt_is_revoked(const mbedtls_x509_crt *crt, const mbedtls_x509_crl *crl);
872
+ #endif /* MBEDTLS_X509_CRL_PARSE_C */
873
+
874
+ /**
875
+ * \brief Initialize a certificate (chain)
876
+ *
877
+ * \param crt Certificate chain to initialize
878
+ */
879
+ void mbedtls_x509_crt_init(mbedtls_x509_crt *crt);
880
+
881
+ /**
882
+ * \brief Unallocate all certificate data
883
+ *
884
+ * \param crt Certificate chain to free
885
+ */
886
+ void mbedtls_x509_crt_free(mbedtls_x509_crt *crt);
887
+
888
+ #if defined(MBEDTLS_ECP_RESTARTABLE)
889
+ /**
890
+ * \brief Initialize a restart context
891
+ */
892
+ void mbedtls_x509_crt_restart_init(mbedtls_x509_crt_restart_ctx *ctx);
893
+
894
+ /**
895
+ * \brief Free the components of a restart context
896
+ */
897
+ void mbedtls_x509_crt_restart_free(mbedtls_x509_crt_restart_ctx *ctx);
898
+ #endif /* MBEDTLS_ECP_RESTARTABLE */
899
+ #endif /* MBEDTLS_X509_CRT_PARSE_C */
900
+
901
+ /**
902
+ * \brief Query certificate for given extension type
903
+ *
904
+ * \param[in] ctx Certificate context to be queried, must not be \c NULL
905
+ * \param ext_type Extension type being queried for, must be a valid
906
+ * extension type. Must be one of the MBEDTLS_X509_EXT_XXX
907
+ * values
908
+ *
909
+ * \return 0 if the given extension type is not present,
910
+ * non-zero otherwise
911
+ */
912
+ static inline int mbedtls_x509_crt_has_ext_type(const mbedtls_x509_crt *ctx,
913
+ int ext_type)
914
+ {
915
+ return ctx->MBEDTLS_PRIVATE(ext_types) & ext_type;
916
+ }
917
+
918
+ /**
919
+ * \brief Access the ca_istrue field
920
+ *
921
+ * \param[in] crt Certificate to be queried, must not be \c NULL
922
+ *
923
+ * \return \c 1 if this a CA certificate \c 0 otherwise.
924
+ * \return MBEDTLS_ERR_X509_INVALID_EXTENSIONS if the certificate does not contain
925
+ * the Optional Basic Constraint extension.
926
+ *
927
+ */
928
+ int mbedtls_x509_crt_get_ca_istrue(const mbedtls_x509_crt *crt);
929
+
930
+ /** \} name Structures and functions for parsing and writing X.509 certificates */
931
+
932
+ #if defined(MBEDTLS_X509_CRT_WRITE_C)
933
+ /**
934
+ * \brief Initialize a CRT writing context
935
+ *
936
+ * \param ctx CRT context to initialize
937
+ */
938
+ void mbedtls_x509write_crt_init(mbedtls_x509write_cert *ctx);
939
+
940
+ /**
941
+ * \brief Set the version for a Certificate
942
+ * Default: MBEDTLS_X509_CRT_VERSION_3
943
+ *
944
+ * \param ctx CRT context to use
945
+ * \param version version to set (MBEDTLS_X509_CRT_VERSION_1, MBEDTLS_X509_CRT_VERSION_2 or
946
+ * MBEDTLS_X509_CRT_VERSION_3)
947
+ */
948
+ void mbedtls_x509write_crt_set_version(mbedtls_x509write_cert *ctx, int version);
949
+
950
+ /**
951
+ * \brief Set the serial number for a Certificate.
952
+ *
953
+ * \param ctx CRT context to use
954
+ * \param serial A raw array of bytes containing the serial number in big
955
+ * endian format
956
+ * \param serial_len Length of valid bytes (expressed in bytes) in \p serial
957
+ * input buffer
958
+ *
959
+ * \return 0 if successful, or
960
+ * #MBEDTLS_ERR_X509_BAD_INPUT_DATA if the provided input buffer
961
+ * is too big (longer than MBEDTLS_X509_RFC5280_MAX_SERIAL_LEN)
962
+ */
963
+ int mbedtls_x509write_crt_set_serial_raw(mbedtls_x509write_cert *ctx,
964
+ const unsigned char *serial, size_t serial_len);
965
+
966
+ /**
967
+ * \brief Set the validity period for a Certificate
968
+ * Timestamps should be in string format for UTC timezone
969
+ * i.e. "YYYYMMDDhhmmss"
970
+ * e.g. "20131231235959" for December 31st 2013
971
+ * at 23:59:59
972
+ *
973
+ * \param ctx CRT context to use
974
+ * \param not_before not_before timestamp
975
+ * \param not_after not_after timestamp
976
+ *
977
+ * \return 0 if timestamp was parsed successfully, or
978
+ * a specific error code
979
+ */
980
+ int mbedtls_x509write_crt_set_validity(mbedtls_x509write_cert *ctx, const char *not_before,
981
+ const char *not_after);
982
+
983
+ /**
984
+ * \brief Set the issuer name for a Certificate
985
+ * Issuer names should contain a comma-separated list
986
+ * of OID types and values:
987
+ * e.g. "C=UK,O=ARM,CN=Mbed TLS CA"
988
+ *
989
+ * \param ctx CRT context to use
990
+ * \param issuer_name issuer name to set
991
+ *
992
+ * \return 0 if issuer name was parsed successfully, or
993
+ * a specific error code
994
+ */
995
+ int mbedtls_x509write_crt_set_issuer_name(mbedtls_x509write_cert *ctx,
996
+ const char *issuer_name);
997
+
998
+ /**
999
+ * \brief Set the subject name for a Certificate
1000
+ * Subject names should contain a comma-separated list
1001
+ * of OID types and values:
1002
+ * e.g. "C=UK,O=ARM,CN=Mbed TLS Server 1"
1003
+ *
1004
+ * \param ctx CRT context to use
1005
+ * \param subject_name subject name to set
1006
+ *
1007
+ * \return 0 if subject name was parsed successfully, or
1008
+ * a specific error code
1009
+ */
1010
+ int mbedtls_x509write_crt_set_subject_name(mbedtls_x509write_cert *ctx,
1011
+ const char *subject_name);
1012
+
1013
+ /**
1014
+ * \brief Set the subject public key for the certificate
1015
+ *
1016
+ * \param ctx CRT context to use
1017
+ * \param key public key to include
1018
+ */
1019
+ void mbedtls_x509write_crt_set_subject_key(mbedtls_x509write_cert *ctx, mbedtls_pk_context *key);
1020
+
1021
+ /**
1022
+ * \brief Set the issuer key used for signing the certificate
1023
+ *
1024
+ * \param ctx CRT context to use
1025
+ * \param key private key to sign with
1026
+ */
1027
+ void mbedtls_x509write_crt_set_issuer_key(mbedtls_x509write_cert *ctx, mbedtls_pk_context *key);
1028
+
1029
+ /**
1030
+ * \brief Set the MD algorithm to use for the signature
1031
+ * (e.g. MBEDTLS_MD_SHA1)
1032
+ *
1033
+ * \param ctx CRT context to use
1034
+ * \param md_alg MD algorithm to use
1035
+ */
1036
+ void mbedtls_x509write_crt_set_md_alg(mbedtls_x509write_cert *ctx, mbedtls_md_type_t md_alg);
1037
+
1038
+ /**
1039
+ * \brief Generic function to add to or replace an extension in the
1040
+ * CRT
1041
+ *
1042
+ * \param ctx CRT context to use
1043
+ * \param oid OID of the extension
1044
+ * \param oid_len length of the OID
1045
+ * \param critical if the extension is critical (per the RFC's definition)
1046
+ * \param val value of the extension OCTET STRING
1047
+ * \param val_len length of the value data
1048
+ *
1049
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
1050
+ */
1051
+ int mbedtls_x509write_crt_set_extension(mbedtls_x509write_cert *ctx,
1052
+ const char *oid, size_t oid_len,
1053
+ int critical,
1054
+ const unsigned char *val, size_t val_len);
1055
+
1056
+ /**
1057
+ * \brief Set the basicConstraints extension for a CRT
1058
+ *
1059
+ * \param ctx CRT context to use
1060
+ * \param is_ca is this a CA certificate
1061
+ * \param max_pathlen maximum length of certificate chains below this
1062
+ * certificate (only for CA certificates, -1 is
1063
+ * unlimited)
1064
+ *
1065
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
1066
+ */
1067
+ int mbedtls_x509write_crt_set_basic_constraints(mbedtls_x509write_cert *ctx,
1068
+ int is_ca, int max_pathlen);
1069
+
1070
+ #if defined(PSA_WANT_ALG_SHA_1)
1071
+ /**
1072
+ * \brief Set the subjectKeyIdentifier extension for a CRT
1073
+ * Requires that mbedtls_x509write_crt_set_subject_key() has been
1074
+ * called before
1075
+ *
1076
+ * \param ctx CRT context to use
1077
+ *
1078
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
1079
+ */
1080
+ int mbedtls_x509write_crt_set_subject_key_identifier(mbedtls_x509write_cert *ctx);
1081
+
1082
+ /**
1083
+ * \brief Set the authorityKeyIdentifier extension for a CRT
1084
+ * Requires that mbedtls_x509write_crt_set_issuer_key() has been
1085
+ * called before
1086
+ *
1087
+ * \param ctx CRT context to use
1088
+ *
1089
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
1090
+ */
1091
+ int mbedtls_x509write_crt_set_authority_key_identifier(mbedtls_x509write_cert *ctx);
1092
+ #endif /* PSA_WANT_ALG_SHA_1 */
1093
+
1094
+ /**
1095
+ * \brief Set the Key Usage Extension flags
1096
+ * (e.g. MBEDTLS_X509_KU_DIGITAL_SIGNATURE | MBEDTLS_X509_KU_KEY_CERT_SIGN)
1097
+ *
1098
+ * \param ctx CRT context to use
1099
+ * \param key_usage key usage flags to set
1100
+ *
1101
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
1102
+ */
1103
+ int mbedtls_x509write_crt_set_key_usage(mbedtls_x509write_cert *ctx,
1104
+ unsigned int key_usage);
1105
+
1106
+ /**
1107
+ * \brief Set the Extended Key Usage Extension
1108
+ * (e.g. MBEDTLS_OID_SERVER_AUTH)
1109
+ *
1110
+ * \param ctx CRT context to use
1111
+ * \param exts extended key usage extensions to set, a sequence of
1112
+ * MBEDTLS_ASN1_OID objects
1113
+ *
1114
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
1115
+ */
1116
+ int mbedtls_x509write_crt_set_ext_key_usage(mbedtls_x509write_cert *ctx,
1117
+ const mbedtls_asn1_sequence *exts);
1118
+
1119
+ /**
1120
+ * \brief Set the Netscape Cert Type flags
1121
+ * (e.g. MBEDTLS_X509_NS_CERT_TYPE_SSL_CLIENT | MBEDTLS_X509_NS_CERT_TYPE_EMAIL)
1122
+ *
1123
+ * \param ctx CRT context to use
1124
+ * \param ns_cert_type Netscape Cert Type flags to set
1125
+ *
1126
+ * \return 0 if successful, or #PSA_ERROR_INSUFFICIENT_MEMORY
1127
+ */
1128
+ int mbedtls_x509write_crt_set_ns_cert_type(mbedtls_x509write_cert *ctx,
1129
+ unsigned char ns_cert_type);
1130
+
1131
+ /**
1132
+ * \brief Free the contents of a CRT write context
1133
+ *
1134
+ * \param ctx CRT context to free
1135
+ */
1136
+ void mbedtls_x509write_crt_free(mbedtls_x509write_cert *ctx);
1137
+
1138
+ /**
1139
+ * \brief Write a built up certificate to a X509 DER structure
1140
+ * Note: data is written at the end of the buffer! Use the
1141
+ * return value to determine where you should start
1142
+ * using the buffer
1143
+ *
1144
+ * \param ctx certificate to write away
1145
+ * \param buf buffer to write to
1146
+ * \param size size of the buffer
1147
+ *
1148
+ * \return length of data written if successful, or a specific
1149
+ * error code
1150
+ */
1151
+ int mbedtls_x509write_crt_der(mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size);
1152
+
1153
+ #if defined(MBEDTLS_PEM_WRITE_C)
1154
+ /**
1155
+ * \brief Write a built up certificate to a X509 PEM string
1156
+ *
1157
+ * \param ctx certificate to write away
1158
+ * \param buf buffer to write to
1159
+ * \param size size of the buffer
1160
+ *
1161
+ * \return 0 if successful, or a specific error code
1162
+ *
1163
+ */
1164
+ int mbedtls_x509write_crt_pem(mbedtls_x509write_cert *ctx, unsigned char *buf, size_t size);
1165
+ #endif /* MBEDTLS_PEM_WRITE_C */
1166
+ #endif /* MBEDTLS_X509_CRT_WRITE_C */
1167
+
1168
+ /** \} addtogroup x509_module */
1169
+
1170
+ #ifdef __cplusplus
1171
+ }
1172
+ #endif
1173
+
1174
+ #endif /* mbedtls_x509_crt.h */