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,2115 @@
1
+ /**
2
+ * \file psa/crypto_extra.h
3
+ *
4
+ * \brief PSA cryptography module: Mbed TLS vendor extensions
5
+ *
6
+ * \note This file may not be included directly. Applications must
7
+ * include psa/crypto.h.
8
+ *
9
+ * This file is reserved for vendor-specific definitions.
10
+ */
11
+ /*
12
+ * Copyright The Mbed TLS Contributors
13
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
14
+ */
15
+
16
+ #ifndef PSA_CRYPTO_EXTRA_H
17
+ #define PSA_CRYPTO_EXTRA_H
18
+ #include "mbedtls/private_access.h"
19
+
20
+ #include "crypto_types.h"
21
+ #include "crypto_compat.h"
22
+ #include "crypto_values.h"
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+
28
+ /* UID for secure storage seed */
29
+ #define PSA_CRYPTO_ITS_RANDOM_SEED_UID 0xFFFFFF52
30
+
31
+ /* See mbedtls_config.h for definition */
32
+ #if !defined(MBEDTLS_PSA_KEY_SLOT_COUNT)
33
+ #define MBEDTLS_PSA_KEY_SLOT_COUNT 32
34
+ #endif
35
+
36
+ /* If the size of static key slots is not explicitly defined by the user, then
37
+ * try to guess it based on some of the most common the key types enabled in the build.
38
+ * See mbedtls_config.h for the definition of MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE. */
39
+ #if !defined(MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE)
40
+
41
+ #define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE 1
42
+
43
+ #if PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE > MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
44
+ #undef MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
45
+ #define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE PSA_EXPORT_ASYMMETRIC_KEY_MAX_SIZE
46
+ #endif
47
+
48
+ /* This covers ciphers, AEADs and CMAC. */
49
+ #if PSA_CIPHER_MAX_KEY_LENGTH > MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
50
+ #undef MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
51
+ #define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE PSA_CIPHER_MAX_KEY_LENGTH
52
+ #endif
53
+
54
+ /* For HMAC, it's typical but not mandatory to use a key size that is equal to
55
+ * the hash size. */
56
+ #if defined(PSA_WANT_ALG_HMAC)
57
+ #if PSA_HASH_MAX_SIZE > MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
58
+ #undef MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
59
+ #define MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE PSA_HASH_MAX_SIZE
60
+ #endif
61
+ #endif /* PSA_WANT_ALG_HMAC */
62
+
63
+ #endif /* !MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE*/
64
+
65
+ /** \addtogroup attributes
66
+ * @{
67
+ */
68
+
69
+ /** \brief Declare the enrollment algorithm for a key.
70
+ *
71
+ * An operation on a key may indifferently use the algorithm set with
72
+ * psa_set_key_algorithm() or with this function.
73
+ *
74
+ * \param[out] attributes The attribute structure to write to.
75
+ * \param alg2 A second algorithm that the key may be used
76
+ * for, in addition to the algorithm set with
77
+ * psa_set_key_algorithm().
78
+ *
79
+ * \warning Setting an enrollment algorithm is not recommended, because
80
+ * using the same key with different algorithms can allow some
81
+ * attacks based on arithmetic relations between different
82
+ * computations made with the same key, or can escalate harmless
83
+ * side channels into exploitable ones. Use this function only
84
+ * if it is necessary to support a protocol for which it has been
85
+ * verified that the usage of the key with multiple algorithms
86
+ * is safe.
87
+ */
88
+ static inline void psa_set_key_enrollment_algorithm(
89
+ psa_key_attributes_t *attributes,
90
+ psa_algorithm_t alg2)
91
+ {
92
+ attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2) = alg2;
93
+ }
94
+
95
+ /** Retrieve the enrollment algorithm policy from key attributes.
96
+ *
97
+ * \param[in] attributes The key attribute structure to query.
98
+ *
99
+ * \return The enrollment algorithm stored in the attribute structure.
100
+ */
101
+ static inline psa_algorithm_t psa_get_key_enrollment_algorithm(
102
+ const psa_key_attributes_t *attributes)
103
+ {
104
+ return attributes->MBEDTLS_PRIVATE(policy).MBEDTLS_PRIVATE(alg2);
105
+ }
106
+
107
+ /**@}*/
108
+
109
+ /**
110
+ * \brief Library deinitialization.
111
+ *
112
+ * This function clears all data associated with the PSA layer,
113
+ * including the whole key store.
114
+ * This function is not thread safe, it wipes every key slot regardless of
115
+ * state and reader count. It should only be called when no slot is in use.
116
+ *
117
+ * This is an Mbed TLS extension.
118
+ */
119
+ void mbedtls_psa_crypto_free(void);
120
+
121
+ /** \brief Statistics about
122
+ * resource consumption related to the PSA keystore.
123
+ *
124
+ * \note The content of this structure is not part of the stable API and ABI
125
+ * of Mbed TLS and may change arbitrarily from version to version.
126
+ */
127
+ typedef struct mbedtls_psa_stats_s {
128
+ /** Number of slots containing key material for a volatile key. */
129
+ size_t MBEDTLS_PRIVATE(volatile_slots);
130
+ /** Number of slots containing key material for a key which is in
131
+ * internal persistent storage. */
132
+ size_t MBEDTLS_PRIVATE(persistent_slots);
133
+ /** Number of slots containing a reference to a key in a
134
+ * secure element. */
135
+ size_t MBEDTLS_PRIVATE(external_slots);
136
+ /** Number of slots which are occupied, but do not contain
137
+ * key material yet. */
138
+ size_t MBEDTLS_PRIVATE(half_filled_slots);
139
+ /** Number of slots that contain cache data. */
140
+ size_t MBEDTLS_PRIVATE(cache_slots);
141
+ /** Number of slots that are not used for anything. */
142
+ size_t MBEDTLS_PRIVATE(empty_slots);
143
+ /** Number of slots that are locked. */
144
+ size_t MBEDTLS_PRIVATE(locked_slots);
145
+ /** Largest key id value among open keys in internal persistent storage. */
146
+ psa_key_id_t MBEDTLS_PRIVATE(max_open_internal_key_id);
147
+ /** Largest key id value among open keys in secure elements. */
148
+ psa_key_id_t MBEDTLS_PRIVATE(max_open_external_key_id);
149
+ } mbedtls_psa_stats_t;
150
+
151
+ /** \brief Get statistics about
152
+ * resource consumption related to the PSA keystore.
153
+ *
154
+ * \note When Mbed TLS is built as part of a service, with isolation
155
+ * between the application and the keystore, the service may or
156
+ * may not expose this function.
157
+ */
158
+ void mbedtls_psa_get_stats(mbedtls_psa_stats_t *stats);
159
+
160
+ /** \addtogroup crypto_types
161
+ * @{
162
+ */
163
+
164
+ /** DSA public key.
165
+ *
166
+ * The import and export format is the
167
+ * representation of the public key `y = g^x mod p` as a big-endian byte
168
+ * string. The length of the byte string is the length of the base prime `p`
169
+ * in bytes.
170
+ */
171
+ #define PSA_KEY_TYPE_DSA_PUBLIC_KEY ((psa_key_type_t) 0x4002)
172
+
173
+ /** DSA key pair (private and public key).
174
+ *
175
+ * The import and export format is the
176
+ * representation of the private key `x` as a big-endian byte string. The
177
+ * length of the byte string is the private key size in bytes (leading zeroes
178
+ * are not stripped).
179
+ *
180
+ * Deterministic DSA key derivation with psa_generate_derived_key follows
181
+ * FIPS 186-4 §B.1.2: interpret the byte string as integer
182
+ * in big-endian order. Discard it if it is not in the range
183
+ * [0, *N* - 2] where *N* is the boundary of the private key domain
184
+ * (the prime *p* for Diffie-Hellman, the subprime *q* for DSA,
185
+ * or the order of the curve's base point for ECC).
186
+ * Add 1 to the resulting integer and use this as the private key *x*.
187
+ *
188
+ */
189
+ #define PSA_KEY_TYPE_DSA_KEY_PAIR ((psa_key_type_t) 0x7002)
190
+
191
+ /** Whether a key type is a DSA key (pair or public-only). */
192
+ #define PSA_KEY_TYPE_IS_DSA(type) \
193
+ (PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) == PSA_KEY_TYPE_DSA_PUBLIC_KEY)
194
+
195
+ #define PSA_ALG_DSA_BASE ((psa_algorithm_t) 0x06000400)
196
+ /** DSA signature with hashing.
197
+ *
198
+ * This is the signature scheme defined by FIPS 186-4,
199
+ * with a random per-message secret number (*k*).
200
+ *
201
+ * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
202
+ * #PSA_ALG_IS_HASH(\p hash_alg) is true).
203
+ * This includes #PSA_ALG_ANY_HASH
204
+ * when specifying the algorithm in a usage policy.
205
+ *
206
+ * \return The corresponding DSA signature algorithm.
207
+ * \return Unspecified if \p hash_alg is not a supported
208
+ * hash algorithm.
209
+ */
210
+ #define PSA_ALG_DSA(hash_alg) \
211
+ (PSA_ALG_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
212
+ #define PSA_ALG_DETERMINISTIC_DSA_BASE ((psa_algorithm_t) 0x06000500)
213
+ #define PSA_ALG_DSA_DETERMINISTIC_FLAG PSA_ALG_ECDSA_DETERMINISTIC_FLAG
214
+ /** Deterministic DSA signature with hashing.
215
+ *
216
+ * This is the deterministic variant defined by RFC 6979 of
217
+ * the signature scheme defined by FIPS 186-4.
218
+ *
219
+ * \param hash_alg A hash algorithm (\c PSA_ALG_XXX value such that
220
+ * #PSA_ALG_IS_HASH(\p hash_alg) is true).
221
+ * This includes #PSA_ALG_ANY_HASH
222
+ * when specifying the algorithm in a usage policy.
223
+ *
224
+ * \return The corresponding DSA signature algorithm.
225
+ * \return Unspecified if \p hash_alg is not a supported
226
+ * hash algorithm.
227
+ */
228
+ #define PSA_ALG_DETERMINISTIC_DSA(hash_alg) \
229
+ (PSA_ALG_DETERMINISTIC_DSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
230
+ #define PSA_ALG_IS_DSA(alg) \
231
+ (((alg) & ~PSA_ALG_HASH_MASK & ~PSA_ALG_DSA_DETERMINISTIC_FLAG) == \
232
+ PSA_ALG_DSA_BASE)
233
+ #define PSA_ALG_DSA_IS_DETERMINISTIC(alg) \
234
+ (((alg) & PSA_ALG_DSA_DETERMINISTIC_FLAG) != 0)
235
+ #define PSA_ALG_IS_DETERMINISTIC_DSA(alg) \
236
+ (PSA_ALG_IS_DSA(alg) && PSA_ALG_DSA_IS_DETERMINISTIC(alg))
237
+ #define PSA_ALG_IS_RANDOMIZED_DSA(alg) \
238
+ (PSA_ALG_IS_DSA(alg) && !PSA_ALG_DSA_IS_DETERMINISTIC(alg))
239
+
240
+
241
+ /* We need to expand the sample definition of this macro from
242
+ * the API definition. */
243
+ #undef PSA_ALG_IS_VENDOR_HASH_AND_SIGN
244
+ #define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) \
245
+ PSA_ALG_IS_DSA(alg)
246
+
247
+ /**@}*/
248
+
249
+ /** \addtogroup attributes
250
+ * @{
251
+ */
252
+
253
+ /** PAKE operation stages. */
254
+ #define PSA_PAKE_OPERATION_STAGE_SETUP 0
255
+ #define PSA_PAKE_OPERATION_STAGE_COLLECT_INPUTS 1
256
+ #define PSA_PAKE_OPERATION_STAGE_COMPUTATION 2
257
+
258
+ /**@}*/
259
+
260
+
261
+ /** \defgroup psa_rng Random generator
262
+ * @{
263
+ */
264
+
265
+ #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
266
+ /** External random generator function, implemented by the platform.
267
+ *
268
+ * When the compile-time option #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled,
269
+ * this function replaces Mbed TLS's entropy and DRBG modules for all
270
+ * random generation triggered via PSA crypto interfaces.
271
+ *
272
+ * \note This random generator must deliver random numbers with cryptographic
273
+ * quality and high performance. It must supply unpredictable numbers
274
+ * with a uniform distribution. The implementation of this function
275
+ * is responsible for ensuring that the random generator is seeded
276
+ * with sufficient entropy. If you have a hardware TRNG which is slow
277
+ * or delivers non-uniform output, declare it as an entropy source
278
+ * with mbedtls_entropy_add_source() instead of enabling this option.
279
+ *
280
+ * \param[in,out] context Pointer to the random generator context.
281
+ * This is all-bits-zero on the first call
282
+ * and preserved between successive calls.
283
+ * \param[out] output Output buffer. On success, this buffer
284
+ * contains random data with a uniform
285
+ * distribution.
286
+ * \param output_size The size of the \p output buffer in bytes.
287
+ * \param[out] output_length On success, set this value to \p output_size.
288
+ *
289
+ * \retval #PSA_SUCCESS
290
+ * Success. The output buffer contains \p output_size bytes of
291
+ * cryptographic-quality random data, and \c *output_length is
292
+ * set to \p output_size.
293
+ * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY
294
+ * The random generator requires extra entropy and there is no
295
+ * way to obtain entropy under current environment conditions.
296
+ * This error should not happen under normal circumstances since
297
+ * this function is responsible for obtaining as much entropy as
298
+ * it needs. However implementations of this function may return
299
+ * #PSA_ERROR_INSUFFICIENT_ENTROPY if there is no way to obtain
300
+ * entropy without blocking indefinitely.
301
+ * \retval #PSA_ERROR_HARDWARE_FAILURE
302
+ * A failure of the random generator hardware that isn't covered
303
+ * by #PSA_ERROR_INSUFFICIENT_ENTROPY.
304
+ */
305
+ psa_status_t mbedtls_psa_external_get_random(
306
+ mbedtls_psa_external_random_context_t *context,
307
+ uint8_t *output, size_t output_size, size_t *output_length);
308
+ #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
309
+
310
+ /** Force an immediate reseed of the PSA random generator.
311
+ *
312
+ * The entropy source(s) are the ones configured at compile time.
313
+ *
314
+ * The random generator is always seeded automatically before use, and
315
+ * it is reseeded as needed based on the configured policy, so most
316
+ * applications do not need to call this function.
317
+ *
318
+ * The main reason to call this function is in scenarios where the process
319
+ * state is cloned (i.e. duplicated) while the random generator is active.
320
+ * In such scenarios, you must call this function in every clone of
321
+ * the original process before performing any cryptographic operation
322
+ * that uses randomness. (Note that any operation that uses a private or
323
+ * secret key may use randomness internally even if the result is not
324
+ * randomized, but hashing and signature verification are ok.) For example:
325
+ *
326
+ * - If the process is part of a live virtual machine that is cloned,
327
+ * call this function after cloning so that the new instance has a
328
+ * distinct random generator state.
329
+ * - If the process is part of a hibernated image that may be resumed
330
+ * multiple times, call this function after resuming so that each
331
+ * resumed instance has a distinct random generator state.
332
+ * - If the process is cloned through the fork() system call, the
333
+ * child process should call this function before using the random
334
+ * generator.
335
+ *
336
+ * An additional consideration applies in configurations where there is no
337
+ * actual entropy source, only a nonvolatile seed (i.e.
338
+ * #MBEDTLS_ENTROPY_NV_SEED and #MBEDTLS_ENTROPY_NO_SOURCES_OK are enabled,
339
+ * and #MBEDTLS_PSA_BUILTIN_GET_ENTROPY and #MBEDTLS_PSA_DRIVER_GET_ENTROPY
340
+ * are disabled).
341
+ * In such configurations, simply calling psa_random_reseed() in multiple
342
+ * cloned processes would result in the same random generator state in
343
+ * all the clones. To avoid this, in such configurations, you must pass
344
+ * a unique \p perso string in every clone.
345
+ *
346
+ * \note This function has no effect when the compilation option
347
+ * #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled.
348
+ *
349
+ * \note In client-server builds, this function may not be available
350
+ * from clients, since the decision to reseed is generally based
351
+ * on the server state.
352
+ *
353
+ * \note If the entropy source fails, the random generator remains usable:
354
+ * subsequent calls to generate random data will succeed until
355
+ * the random generator itself decides to reseed. If you want to
356
+ * force a reseed, either treat the failure as a fatal error,
357
+ * or call psa_random_deplete() instead of this function (or in
358
+ * addition).
359
+ *
360
+ * \param[in] perso A personalization string, i.e. a byte string to
361
+ * inject into the random generator state in addition
362
+ * to entropy obtained from the normal source(s).
363
+ * In most cases, it is fine for \c perso to be
364
+ * empty. The main use case for a personalization
365
+ * string is when the random generator state is cloned,
366
+ * as described above, and there is no actual entropy
367
+ * source.
368
+ * \param perso_size Length of \c perso in bytes.
369
+ *
370
+ * \retval #PSA_SUCCESS
371
+ * The reseed succeeded.
372
+ * \retval #PSA_ERROR_BAD_STATE
373
+ * The PSA random generator is not active.
374
+ * \retval #PSA_ERROR_NOT_SUPPORTED
375
+ * PSA uses an external random generator because the compilation
376
+ * option #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled. This
377
+ * configuration does not support explicit reseeding.
378
+ * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY
379
+ * The entropy source failed.
380
+ */
381
+ psa_status_t psa_random_reseed(const uint8_t *perso, size_t perso_size);
382
+
383
+ /** Force a reseed of the PSA random generator the next time it is used.
384
+ *
385
+ * The entropy source(s) are the ones configured at compile time.
386
+ *
387
+ * The random generator is always seeded automatically before use, and
388
+ * it is reseeded as needed based on the configured policy, so most
389
+ * applications do not need to call this function.
390
+ *
391
+ * This function has a similar purpose as psa_random_reseed(),
392
+ * but the reseed will happen the next time the random generator is used.
393
+ * The advantage of this function is that it does not fail unless the
394
+ * system is in an unintended state, so it can be used in contexts where
395
+ * propagating errors is difficult.
396
+ *
397
+ * \note This function has no effect when #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
398
+ * is enabled.
399
+ *
400
+ * \note If prediction resistance is enabled (either explicitly, or because
401
+ * the reseed interval is set to 1), calling this function is
402
+ * unnecessary since the random generator will always reseed anyway.
403
+ *
404
+ * \retval #PSA_SUCCESS
405
+ * The reseed succeeded.
406
+ * \retval #PSA_ERROR_BAD_STATE
407
+ * The PSA random generator is not active.
408
+ * \retval #PSA_ERROR_NOT_SUPPORTED
409
+ * PSA uses an external random generator because the compilation
410
+ * option #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled. This
411
+ * configuration does not support explicit reseeding.
412
+ */
413
+ psa_status_t psa_random_deplete(void);
414
+
415
+ /** Enable or disable prediction resistance in the PSA random generator.
416
+ *
417
+ * When prediction resistance is enabled, the random generator
418
+ * injects extra entropy before each request regardless of its size.
419
+ * As a consequence, a temporary compromise of the random generator
420
+ * state does not, by itself, compromise future steps.
421
+ * Furthermore, duplicating the random generator state (because the
422
+ * running application instance is cloned) is safe since it will
423
+ * not lead to identical random generator outputs in the clones.
424
+ *
425
+ * When prediction resistance is disabled, the random generator injects
426
+ * extra entropy periodically only as determined by
427
+ * #MBEDTLS_PSA_RNG_RESEED_INTERVAL.
428
+ *
429
+ * Prediction resistance is disabled by default, although setting
430
+ * #MBEDTLS_PSA_RNG_RESEED_INTERVAL to \c 1 satisfies the prediction
431
+ * resistance property even when the specific setting for
432
+ * prediction resistance is disabled.
433
+ *
434
+ * \note This function has no effect when #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
435
+ * is enabled.
436
+ *
437
+ * \note Prediction resistance cannot be enabled when the only entropy source
438
+ * is a nonvolatile seed, since prediction resistance is effectively
439
+ * impossible to achieve without actual entropy.
440
+ *
441
+ * \param enabled \c 1 to enable prediction resistance.
442
+ * \c 0 to disable prediction resistance.
443
+ *
444
+ * \retval #PSA_SUCCESS
445
+ * The PSA random generator is active, and prediction resistance
446
+ * has been changed to the desired option.
447
+ * \retval #PSA_ERROR_BAD_STATE
448
+ * The PSA random generator is not active.
449
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
450
+ * \p enabled is not valid.
451
+ * \retval #PSA_ERROR_NOT_SUPPORTED
452
+ * PSA uses an external random generator because the compilation
453
+ * option #MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG is enabled.
454
+ * Or, the random generator only has a nonvolatile seed but no entropy
455
+ * source, and prediction resistance has been requested.
456
+ */
457
+ psa_status_t psa_random_set_prediction_resistance(unsigned enabled);
458
+
459
+ /**@}*/
460
+
461
+ /** \defgroup psa_builtin_keys Built-in keys
462
+ * @{
463
+ */
464
+
465
+ /** The minimum value for a key identifier that is built into the
466
+ * implementation.
467
+ *
468
+ * The range of key identifiers from #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN
469
+ * to #MBEDTLS_PSA_KEY_ID_BUILTIN_MAX within the range from
470
+ * #PSA_KEY_ID_VENDOR_MIN and #PSA_KEY_ID_VENDOR_MAX and must not intersect
471
+ * with any other set of implementation-chosen key identifiers.
472
+ *
473
+ * This value is part of the library's API since changing it would invalidate
474
+ * the values of built-in key identifiers in applications.
475
+ */
476
+ #define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t) 0x7fff0000)
477
+
478
+ /** The maximum value for a key identifier that is built into the
479
+ * implementation.
480
+ *
481
+ * See #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN for more information.
482
+ */
483
+ #define MBEDTLS_PSA_KEY_ID_BUILTIN_MAX ((psa_key_id_t) 0x7fffefff)
484
+
485
+ /** A slot number identifying a key in a driver.
486
+ *
487
+ * Values of this type are used to identify built-in keys.
488
+ */
489
+ typedef uint64_t psa_drv_slot_number_t;
490
+
491
+ /** Test whether a key identifier belongs to the builtin key range.
492
+ *
493
+ * \param key_id Key identifier to test.
494
+ *
495
+ * \retval 1
496
+ * The key identifier is a builtin key identifier.
497
+ * \retval 0
498
+ * The key identifier is not a builtin key identifier.
499
+ */
500
+ static inline int psa_key_id_is_builtin(psa_key_id_t key_id)
501
+ {
502
+ return (key_id >= MBEDTLS_PSA_KEY_ID_BUILTIN_MIN) &&
503
+ (key_id <= MBEDTLS_PSA_KEY_ID_BUILTIN_MAX);
504
+ }
505
+
506
+ #if defined(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
507
+ /** Platform function to obtain the location and slot number of a built-in key.
508
+ *
509
+ * An application-specific implementation of this function must be provided if
510
+ * #MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS is enabled. This would typically be provided
511
+ * as part of a platform's system image.
512
+ *
513
+ * #MBEDTLS_SVC_KEY_ID_GET_KEY_ID(\p key_id) needs to be in the range from
514
+ * #MBEDTLS_PSA_KEY_ID_BUILTIN_MIN to #MBEDTLS_PSA_KEY_ID_BUILTIN_MAX.
515
+ *
516
+ * In a multi-application configuration
517
+ * (\c MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER is defined),
518
+ * this function should check that #MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(\p key_id)
519
+ * is allowed to use the given key.
520
+ *
521
+ * \param key_id The key ID for which to retrieve the
522
+ * location and slot attributes.
523
+ * \param[out] lifetime On success, the lifetime associated with the key
524
+ * corresponding to \p key_id. Lifetime is a
525
+ * combination of which driver contains the key,
526
+ * and with what persistence level the key is
527
+ * intended to be used. If the platform
528
+ * implementation does not contain specific
529
+ * information about the intended key persistence
530
+ * level, the persistence level may be reported as
531
+ * #PSA_KEY_PERSISTENCE_DEFAULT.
532
+ * \param[out] slot_number On success, the slot number known to the driver
533
+ * registered at the lifetime location reported
534
+ * through \p lifetime which corresponds to the
535
+ * requested built-in key.
536
+ *
537
+ * \retval #PSA_SUCCESS
538
+ * The requested key identifier designates a built-in key.
539
+ * In a multi-application configuration, the requested owner
540
+ * is allowed to access it.
541
+ * \retval #PSA_ERROR_DOES_NOT_EXIST
542
+ * The requested key identifier is not a built-in key which is known
543
+ * to this function. If a key exists in the key storage with this
544
+ * identifier, the data from the storage will be used.
545
+ * \return (any other error)
546
+ * Any other error is propagated to the function that requested the key.
547
+ * Common errors include:
548
+ * - #PSA_ERROR_NOT_PERMITTED: the key exists but the requested owner
549
+ * is not allowed to access it.
550
+ */
551
+ psa_status_t mbedtls_psa_platform_get_builtin_key(
552
+ mbedtls_svc_key_id_t key_id,
553
+ psa_key_lifetime_t *lifetime,
554
+ psa_drv_slot_number_t *slot_number);
555
+ #endif /* MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
556
+
557
+ /** @} */
558
+
559
+ /** \defgroup psa_crypto_client Functions defined by a client provider
560
+ *
561
+ * The functions in this group are meant to be implemented by providers of
562
+ * the PSA Crypto client interface. They are provided by the library when
563
+ * #MBEDTLS_PSA_CRYPTO_C is enabled.
564
+ *
565
+ * \note All functions in this group are experimental, as using
566
+ * alternative client interface providers is experimental.
567
+ *
568
+ * @{
569
+ */
570
+
571
+ /**@}*/
572
+
573
+ /** \addtogroup crypto_types
574
+ * @{
575
+ */
576
+
577
+ #define PSA_ALG_CATEGORY_PAKE ((psa_algorithm_t) 0x0a000000)
578
+
579
+ /** Whether the specified algorithm is a password-authenticated key exchange.
580
+ *
581
+ * \param alg An algorithm identifier (value of type #psa_algorithm_t).
582
+ *
583
+ * \return 1 if \p alg is a password-authenticated key exchange (PAKE)
584
+ * algorithm, 0 otherwise.
585
+ * This macro may return either 0 or 1 if \p alg is not a supported
586
+ * algorithm identifier.
587
+ */
588
+ #define PSA_ALG_IS_PAKE(alg) \
589
+ (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_PAKE)
590
+
591
+ #define PSA_ALG_JPAKE_BASE ((psa_algorithm_t) 0x0a000100)
592
+
593
+ /** The Password-authenticated key exchange by juggling (J-PAKE) algorithm.
594
+ *
595
+ * This is J-PAKE as defined by RFC 8236, instantiated with the following
596
+ * parameters:
597
+ *
598
+ * - The group can be either an elliptic curve or defined over a finite field.
599
+ * - Schnorr NIZK proof as defined by RFC 8235 and using the same group as the
600
+ * J-PAKE algorithm.
601
+ * - A cryptographic hash function.
602
+ *
603
+ * To select these parameters and set up the cipher suite, call these functions
604
+ * in any order:
605
+ *
606
+ * \code
607
+ * psa_pake_cs_set_algorithm(cipher_suite, PSA_ALG_JPAKE);
608
+ * psa_pake_cs_set_primitive(cipher_suite,
609
+ * PSA_PAKE_PRIMITIVE(type, family, bits));
610
+ * \endcode
611
+ *
612
+ * For more information on how to set a specific curve or field, refer to the
613
+ * documentation of the individual \c PSA_PAKE_PRIMITIVE_TYPE_XXX constants.
614
+ *
615
+ * After initializing a J-PAKE operation, call
616
+ *
617
+ * \code
618
+ * psa_pake_setup(operation, cipher_suite);
619
+ * psa_pake_set_user(operation, ...);
620
+ * psa_pake_set_peer(operation, ...);
621
+ * \endcode
622
+ *
623
+ * The password is provided as a key. This can be the password text itself,
624
+ * in an agreed character encoding, or some value derived from the password
625
+ * as required by a higher level protocol.
626
+ *
627
+ * (The implementation converts the key material to a number as described in
628
+ * Section 2.3.8 of _SEC 1: Elliptic Curve Cryptography_
629
+ * (https://www.secg.org/sec1-v2.pdf), before reducing it modulo \c q. Here
630
+ * \c q is order of the group defined by the primitive set in the cipher suite.
631
+ * The \c psa_pake_setup() function returns an error if the result
632
+ * of the reduction is 0.)
633
+ *
634
+ * The key exchange flow for J-PAKE is as follows:
635
+ * -# To get the first round data that needs to be sent to the peer, call
636
+ * \code
637
+ * // Get g1
638
+ * psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...);
639
+ * // Get the ZKP public key for x1
640
+ * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...);
641
+ * // Get the ZKP proof for x1
642
+ * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PROOF, ...);
643
+ * // Get g2
644
+ * psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...);
645
+ * // Get the ZKP public key for x2
646
+ * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...);
647
+ * // Get the ZKP proof for x2
648
+ * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PROOF, ...);
649
+ * \endcode
650
+ * -# To provide the first round data received from the peer to the operation,
651
+ * call
652
+ * \code
653
+ * // Set g3
654
+ * psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...);
655
+ * // Set the ZKP public key for x3
656
+ * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...);
657
+ * // Set the ZKP proof for x3
658
+ * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PROOF, ...);
659
+ * // Set g4
660
+ * psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...);
661
+ * // Set the ZKP public key for x4
662
+ * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...);
663
+ * // Set the ZKP proof for x4
664
+ * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PROOF, ...);
665
+ * \endcode
666
+ * -# To get the second round data that needs to be sent to the peer, call
667
+ * \code
668
+ * // Get A
669
+ * psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...);
670
+ * // Get ZKP public key for x2*s
671
+ * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...);
672
+ * // Get ZKP proof for x2*s
673
+ * psa_pake_output(operation, #PSA_PAKE_STEP_ZK_PROOF, ...);
674
+ * \endcode
675
+ * -# To provide the second round data received from the peer to the operation,
676
+ * call
677
+ * \code
678
+ * // Set B
679
+ * psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...);
680
+ * // Set ZKP public key for x4*s
681
+ * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PUBLIC, ...);
682
+ * // Set ZKP proof for x4*s
683
+ * psa_pake_input(operation, #PSA_PAKE_STEP_ZK_PROOF, ...);
684
+ * \endcode
685
+ * -# To access the shared secret call
686
+ * \code
687
+ * // Get Ka=Kb=K
688
+ * psa_pake_get_shared_key()
689
+ * \endcode
690
+ *
691
+ * For more information consult the documentation of the individual
692
+ * \c PSA_PAKE_STEP_XXX constants.
693
+ *
694
+ * At this point there is a cryptographic guarantee that only the authenticated
695
+ * party who used the same password is able to compute the key. But there is no
696
+ * guarantee that the peer is the party it claims to be and was able to do so.
697
+ *
698
+ * That is, the authentication is only implicit (the peer is not authenticated
699
+ * at this point, and no action should be taken that assume that they are - like
700
+ * for example accessing restricted files).
701
+ *
702
+ * To make the authentication explicit there are various methods, see Section 5
703
+ * of RFC 8236 for two examples.
704
+ *
705
+ * \note As of TF-PSA-Crypto 1.0.0, the JPAKE implementation has the
706
+ * following limitations:
707
+ * - The only supported primitive is ECC on the curve secp256r1, i.e.
708
+ * `PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC,
709
+ * PSA_ECC_FAMILY_SECP_R1, 256)`.
710
+ * - The only supported hash algorithm is SHA-256, i.e.
711
+ * `PSA_ALG_SHA_256`.
712
+ * - When using the built-in implementation, the user ID and the peer ID
713
+ * must be `"client"` (6-byte string) and `"server"` (6-byte string),
714
+ * or the other way round.
715
+ * Third-party drivers may or may not have this limitation.
716
+ *
717
+ */
718
+ #define PSA_ALG_JPAKE(hash_alg) \
719
+ (PSA_ALG_JPAKE_BASE | ((hash_alg) & (PSA_ALG_HASH_MASK)))
720
+
721
+ /** Whether the specified algorithm is a JPAKE algorithm.
722
+ *
723
+ * \param alg An algorithm identifier (value of type #psa_algorithm_t).
724
+ *
725
+ * \return 1 if \p alg is of the form #PSA_ALG_JPAKE(\c hash_alg)
726
+ * for some hash algorithm \c hash_alg, 0 otherwise.
727
+ * This macro may return either 0 or 1 if \p alg is not a supported
728
+ * algorithm identifier.
729
+ */
730
+ #define PSA_ALG_IS_JPAKE(alg) \
731
+ (((alg) & (~(PSA_ALG_HASH_MASK))) == PSA_ALG_JPAKE_BASE)
732
+
733
+ #define PSA_KEY_TYPE_SPAKE2P_PUBLIC_KEY_BASE ((psa_key_type_t) 0x4400)
734
+ #define PSA_KEY_TYPE_SPAKE2P_KEY_PAIR_BASE ((psa_key_type_t) 0x7400)
735
+
736
+ /** SPAKE2+ key pair.
737
+ *
738
+ * Not implemented yet.
739
+ */
740
+ #define PSA_KEY_TYPE_SPAKE2P_KEY_PAIR(curve) \
741
+ (PSA_KEY_TYPE_SPAKE2P_KEY_PAIR_BASE | (curve))
742
+
743
+ /** SPAKE2+ public key.
744
+ *
745
+ * Not implemented yet.
746
+ */
747
+ #define PSA_KEY_TYPE_SPAKE2P_PUBLIC_KEY(curve) \
748
+ (PSA_KEY_TYPE_SPAKE2P_PUBLIC_KEY_BASE | (curve))
749
+
750
+ /** Whether a key type is a SPAKE2+ key pair type. */
751
+ #define PSA_KEY_TYPE_IS_SPAKE2P_KEY_PAIR(type) \
752
+ (((type) & ~PSA_KEY_TYPE_ECC_CURVE_MASK) == \
753
+ PSA_KEY_TYPE_SPAKE2P_KEY_PAIR_BASE)
754
+
755
+ /** Whether a key type is a SPAKE2+ public key type. */
756
+ #define PSA_KEY_TYPE_IS_SPAKE2P_PUBLIC_KEY(type) \
757
+ (((type) & ~PSA_KEY_TYPE_ECC_CURVE_MASK) == \
758
+ PSA_KEY_TYPE_SPAKE2P_PUBLIC_KEY_BASE)
759
+
760
+ /** Whether a key type is a SPAKE2+ key pair or public key type. */
761
+ #define PSA_KEY_TYPE_IS_SPAKE2P(type) \
762
+ ((PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type) & \
763
+ ~PSA_KEY_TYPE_ECC_CURVE_MASK) == PSA_KEY_TYPE_SPAKE2P_PUBLIC_KEY_BASE)
764
+
765
+ #define PSA_ALG_SPAKE2P_HMAC_BASE ((psa_algorithm_t) 0x0a000400)
766
+
767
+ /** SPAKE2+ algorithm using HMAC for key confirmation.
768
+ *
769
+ * Not implemented yet.
770
+ */
771
+ #define PSA_ALG_SPAKE2P_HMAC(hash_alg) \
772
+ (PSA_ALG_SPAKE2P_HMAC_BASE | ((hash_alg) & (PSA_ALG_HASH_MASK)))
773
+ #define PSA_ALG_IS_SPAKE2P_HMAC(alg) \
774
+ (((alg) & (~(PSA_ALG_HASH_MASK))) == PSA_ALG_SPAKE2P_HMAC_BASE)
775
+
776
+ /** SPAKE2+ algorithm using CMAC for key confirmation.
777
+ *
778
+ * Not implemented yet.
779
+ */
780
+ #define PSA_ALG_SPAKE2P_CMAC_BASE ((psa_algorithm_t) 0x0a000500)
781
+ #define PSA_ALG_SPAKE2P_CMAC(hash_alg) \
782
+ (PSA_ALG_SPAKE2P_CMAC_BASE | ((hash_alg) & (PSA_ALG_HASH_MASK)))
783
+ #define PSA_ALG_IS_SPAKE2P_CMAC(alg) \
784
+ (((alg) & (~(PSA_ALG_HASH_MASK))) == PSA_ALG_SPAKE2P_CMAC_BASE)
785
+
786
+ /** SPAKE2+ algorithm variant used by the Matter specification version 1.2.
787
+ *
788
+ * Not implemented yet.
789
+ */
790
+ #define PSA_ALG_SPAKE2P_MATTER ((psa_algorithm_t) 0x0a000609)
791
+
792
+ /** Whether the specified algorithm is any SPAKE2+ algorithm variant.
793
+ *
794
+ * \param alg An algorithm identifier (value of type #psa_algorithm_t).
795
+ *
796
+ * \return 1 if \p alg is of the form #PSA_ALG_SPAKE2P_CMAC(\c hash_alg),
797
+ * #PSA_ALG_SPAKE2P_HMAC(\c hash_alg) or #PSA_ALG_SPAKE2P_MATTER
798
+ * for some hash algorithm \c hash_alg, 0 otherwise.
799
+ * This macro may return either 0 or 1 if \p alg is not a supported
800
+ * algorithm identifier.
801
+ */
802
+ #define PSA_ALG_IS_SPAKE2P(alg) \
803
+ (PSA_ALG_IS_SPAKE2P_HMAC(alg) || \
804
+ PSA_ALG_IS_SPAKE2P_CMAC(alg) || \
805
+ (alg) == PSA_ALG_SPAKE2P_MATTER)
806
+
807
+ /** @} */
808
+
809
+ /** \defgroup pake Password-authenticated key exchange (PAKE)
810
+ *
811
+ * This is a proposed PAKE interface for the PSA Crypto API. It is not part of
812
+ * the official PSA Crypto API yet.
813
+ *
814
+ * \note The content of this section is not part of the stable API and ABI
815
+ * of Mbed TLS and may change arbitrarily from version to version.
816
+ * Same holds for the corresponding macros #PSA_ALG_CATEGORY_PAKE and
817
+ * #PSA_ALG_JPAKE.
818
+ * @{
819
+ */
820
+
821
+ /** \brief Encoding of the application role of PAKE
822
+ *
823
+ * Encodes the application's role in the algorithm is being executed. For more
824
+ * information see the documentation of individual \c PSA_PAKE_ROLE_XXX
825
+ * constants.
826
+ */
827
+ typedef uint8_t psa_pake_role_t;
828
+
829
+ /** Encoding of input and output indicators for PAKE.
830
+ *
831
+ * Some PAKE algorithms need to exchange more data than just a single key share.
832
+ * This type is for encoding additional input and output data for such
833
+ * algorithms.
834
+ */
835
+ typedef uint8_t psa_pake_step_t;
836
+
837
+ /** Encoding of the type of the PAKE's primitive.
838
+ *
839
+ * Values defined by this standard will never be in the range 0x80-0xff.
840
+ * Vendors who define additional types must use an encoding in this range.
841
+ *
842
+ * For more information see the documentation of individual
843
+ * \c PSA_PAKE_PRIMITIVE_TYPE_XXX constants.
844
+ */
845
+ typedef uint8_t psa_pake_primitive_type_t;
846
+
847
+ /** \brief Encoding of the family of the primitive associated with the PAKE.
848
+ *
849
+ * For more information see the documentation of individual
850
+ * \c PSA_PAKE_PRIMITIVE_TYPE_XXX constants.
851
+ */
852
+ typedef uint8_t psa_pake_family_t;
853
+
854
+ /** \brief Encoding of the primitive associated with the PAKE.
855
+ *
856
+ * For more information see the documentation of the #PSA_PAKE_PRIMITIVE macro.
857
+ */
858
+ typedef uint32_t psa_pake_primitive_t;
859
+
860
+ /** A value to indicate no role in a PAKE algorithm.
861
+ * This value can be used in a call to psa_pake_set_role() for symmetric PAKE
862
+ * algorithms which do not assign roles.
863
+ */
864
+ #define PSA_PAKE_ROLE_NONE ((psa_pake_role_t) 0x00)
865
+
866
+ /** The first peer in a balanced PAKE.
867
+ *
868
+ * Although balanced PAKE algorithms are symmetric, some of them needs an
869
+ * ordering of peers for the transcript calculations. If the algorithm does not
870
+ * need this, both #PSA_PAKE_ROLE_FIRST and #PSA_PAKE_ROLE_SECOND are
871
+ * accepted.
872
+ */
873
+ #define PSA_PAKE_ROLE_FIRST ((psa_pake_role_t) 0x01)
874
+
875
+ /** The second peer in a balanced PAKE.
876
+ *
877
+ * Although balanced PAKE algorithms are symmetric, some of them needs an
878
+ * ordering of peers for the transcript calculations. If the algorithm does not
879
+ * need this, either #PSA_PAKE_ROLE_FIRST or #PSA_PAKE_ROLE_SECOND are
880
+ * accepted.
881
+ */
882
+ #define PSA_PAKE_ROLE_SECOND ((psa_pake_role_t) 0x02)
883
+
884
+ /** The client in an augmented PAKE.
885
+ *
886
+ * Augmented PAKE algorithms need to differentiate between client and server.
887
+ */
888
+ #define PSA_PAKE_ROLE_CLIENT ((psa_pake_role_t) 0x11)
889
+
890
+ /** The server in an augmented PAKE.
891
+ *
892
+ * Augmented PAKE algorithms need to differentiate between client and server.
893
+ */
894
+ #define PSA_PAKE_ROLE_SERVER ((psa_pake_role_t) 0x12)
895
+
896
+ /** The PAKE primitive type indicating the use of elliptic curves.
897
+ *
898
+ * The values of the \c family and \c bits fields of the cipher suite identify a
899
+ * specific elliptic curve, using the same mapping that is used for ECC
900
+ * (::psa_ecc_family_t) keys.
901
+ *
902
+ * (Here \c family means the value returned by psa_pake_cs_get_family() and
903
+ * \c bits means the value returned by psa_pake_cs_get_bits().)
904
+ *
905
+ * Input and output during the operation can involve group elements and scalar
906
+ * values:
907
+ * -# The format for group elements is the same as for public keys on the
908
+ * specific curve would be. For more information, consult the documentation of
909
+ * psa_export_public_key().
910
+ * -# The format for scalars is the same as for private keys on the specific
911
+ * curve would be. For more information, consult the documentation of
912
+ * psa_export_key().
913
+ */
914
+ #define PSA_PAKE_PRIMITIVE_TYPE_ECC ((psa_pake_primitive_type_t) 0x01)
915
+
916
+ /** The PAKE primitive type indicating the use of Diffie-Hellman groups.
917
+ *
918
+ * The values of the \c family and \c bits fields of the cipher suite identify
919
+ * a specific Diffie-Hellman group, using the same mapping that is used for
920
+ * Diffie-Hellman (::psa_dh_family_t) keys.
921
+ *
922
+ * (Here \c family means the value returned by psa_pake_cs_get_family() and
923
+ * \c bits means the value returned by psa_pake_cs_get_bits().)
924
+ *
925
+ * Input and output during the operation can involve group elements and scalar
926
+ * values:
927
+ * -# The format for group elements is the same as for public keys on the
928
+ * specific group would be. For more information, consult the documentation of
929
+ * psa_export_public_key().
930
+ * -# The format for scalars is the same as for private keys on the specific
931
+ * group would be. For more information, consult the documentation of
932
+ * psa_export_key().
933
+ */
934
+ #define PSA_PAKE_PRIMITIVE_TYPE_DH ((psa_pake_primitive_type_t) 0x02)
935
+
936
+ /** Construct a PAKE primitive from type, family and bit-size.
937
+ *
938
+ * \param pake_type The type of the primitive
939
+ * (value of type ::psa_pake_primitive_type_t).
940
+ * \param pake_family The family of the primitive
941
+ * (the type and interpretation of this parameter depends
942
+ * on \p pake_type, for more information consult the
943
+ * documentation of individual ::psa_pake_primitive_type_t
944
+ * constants).
945
+ * \param pake_bits The bit-size of the primitive
946
+ * (Value of type \c size_t. The interpretation
947
+ * of this parameter depends on \p pake_family, for more
948
+ * information consult the documentation of individual
949
+ * ::psa_pake_primitive_type_t constants).
950
+ *
951
+ * \return The constructed primitive value of type ::psa_pake_primitive_t.
952
+ * Return 0 if the requested primitive can't be encoded as
953
+ * ::psa_pake_primitive_t.
954
+ */
955
+ #define PSA_PAKE_PRIMITIVE(pake_type, pake_family, pake_bits) \
956
+ (((pake_bits & 0xFFFF) != pake_bits) ? 0 : \
957
+ ((psa_pake_primitive_t) (((pake_type) << 24 | \
958
+ (pake_family) << 16) | (pake_bits))))
959
+
960
+ /** The key share being sent to or received from the peer.
961
+ *
962
+ * The format for both input and output at this step is the same as for public
963
+ * keys on the group determined by the primitive (::psa_pake_primitive_t) would
964
+ * be.
965
+ *
966
+ * For more information on the format, consult the documentation of
967
+ * psa_export_public_key().
968
+ *
969
+ * For information regarding how the group is determined, consult the
970
+ * documentation #PSA_PAKE_PRIMITIVE.
971
+ */
972
+ #define PSA_PAKE_STEP_KEY_SHARE ((psa_pake_step_t) 0x01)
973
+
974
+ /** A Schnorr NIZKP public key.
975
+ *
976
+ * This is the ephemeral public key in the Schnorr Non-Interactive
977
+ * Zero-Knowledge Proof (the value denoted by the letter 'V' in RFC 8235).
978
+ *
979
+ * The format for both input and output at this step is the same as for public
980
+ * keys on the group determined by the primitive (::psa_pake_primitive_t) would
981
+ * be.
982
+ *
983
+ * For more information on the format, consult the documentation of
984
+ * psa_export_public_key().
985
+ *
986
+ * For information regarding how the group is determined, consult the
987
+ * documentation #PSA_PAKE_PRIMITIVE.
988
+ */
989
+ #define PSA_PAKE_STEP_ZK_PUBLIC ((psa_pake_step_t) 0x02)
990
+
991
+ /** A Schnorr NIZKP proof.
992
+ *
993
+ * This is the proof in the Schnorr Non-Interactive Zero-Knowledge Proof (the
994
+ * value denoted by the letter 'r' in RFC 8235).
995
+ *
996
+ * Both for input and output, the value at this step is an integer less than
997
+ * the order of the group selected in the cipher suite. The format depends on
998
+ * the group as well:
999
+ *
1000
+ * - For Montgomery curves, the encoding is little endian.
1001
+ * - For everything else the encoding is big endian (see Section 2.3.8 of
1002
+ * _SEC 1: Elliptic Curve Cryptography_ at https://www.secg.org/sec1-v2.pdf).
1003
+ *
1004
+ * In both cases leading zeroes are allowed as long as the length in bytes does
1005
+ * not exceed the byte length of the group order.
1006
+ *
1007
+ * For information regarding how the group is determined, consult the
1008
+ * documentation #PSA_PAKE_PRIMITIVE.
1009
+ */
1010
+ #define PSA_PAKE_STEP_ZK_PROOF ((psa_pake_step_t) 0x03)
1011
+
1012
+ /** The key confirmation value.
1013
+ *
1014
+ * This is only used with PAKE algorithms with an explicit key confirmation
1015
+ * phase.
1016
+ *
1017
+ * Refer to the documentation of the PAKE algorithm for information about
1018
+ * the input format.
1019
+ */
1020
+ #define PSA_PAKE_STEP_CONFIRM ((psa_pake_step_t) 0x04)
1021
+
1022
+ /**@}*/
1023
+
1024
+ /** A sufficient output buffer size for psa_pake_output().
1025
+ *
1026
+ * If the size of the output buffer is at least this large, it is guaranteed
1027
+ * that psa_pake_output() will not fail due to an insufficient output buffer
1028
+ * size. The actual size of the output might be smaller in any given call.
1029
+ *
1030
+ * See also #PSA_PAKE_OUTPUT_MAX_SIZE
1031
+ *
1032
+ * \param alg A PAKE algorithm (\c PSA_ALG_XXX value such that
1033
+ * #PSA_ALG_IS_PAKE(\p alg) is true).
1034
+ * \param primitive A primitive of type ::psa_pake_primitive_t that is
1035
+ * compatible with algorithm \p alg.
1036
+ * \param output_step A value of type ::psa_pake_step_t that is valid for the
1037
+ * algorithm \p alg.
1038
+ * \return A sufficient output buffer size for the specified
1039
+ * PAKE algorithm, primitive, and output step. If the
1040
+ * PAKE algorithm, primitive, or output step is not
1041
+ * recognized, or the parameters are incompatible,
1042
+ * return 0.
1043
+ */
1044
+ #define PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step) \
1045
+ (PSA_ALG_IS_JPAKE(alg) && \
1046
+ primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1047
+ PSA_ECC_FAMILY_SECP_R1, 256) ? \
1048
+ ( \
1049
+ output_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1050
+ output_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1051
+ 32 \
1052
+ ) : \
1053
+ 0)
1054
+
1055
+ /** A sufficient input buffer size for psa_pake_input().
1056
+ *
1057
+ * The value returned by this macro is guaranteed to be large enough for any
1058
+ * valid input to psa_pake_input() in an operation with the specified
1059
+ * parameters.
1060
+ *
1061
+ * See also #PSA_PAKE_INPUT_MAX_SIZE
1062
+ *
1063
+ * \param alg A PAKE algorithm (\c PSA_ALG_XXX value such that
1064
+ * #PSA_ALG_IS_PAKE(\p alg) is true).
1065
+ * \param primitive A primitive of type ::psa_pake_primitive_t that is
1066
+ * compatible with algorithm \p alg.
1067
+ * \param input_step A value of type ::psa_pake_step_t that is valid for the
1068
+ * algorithm \p alg.
1069
+ * \return A sufficient input buffer size for the specified
1070
+ * input, cipher suite and algorithm. If the cipher suite,
1071
+ * the input type or PAKE algorithm is not recognized, or
1072
+ * the parameters are incompatible, return 0.
1073
+ */
1074
+ #define PSA_PAKE_INPUT_SIZE(alg, primitive, input_step) \
1075
+ (PSA_ALG_IS_JPAKE(alg) && \
1076
+ primitive == PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, \
1077
+ PSA_ECC_FAMILY_SECP_R1, 256) ? \
1078
+ ( \
1079
+ input_step == PSA_PAKE_STEP_KEY_SHARE ? 65 : \
1080
+ input_step == PSA_PAKE_STEP_ZK_PUBLIC ? 65 : \
1081
+ 32 \
1082
+ ) : \
1083
+ 0)
1084
+
1085
+ /** Output buffer size for psa_pake_output() for any of the supported PAKE
1086
+ * algorithm and primitive suites and output step.
1087
+ *
1088
+ * This macro must expand to a compile-time constant integer.
1089
+ *
1090
+ * The value of this macro must be at least as large as the largest value
1091
+ * returned by PSA_PAKE_OUTPUT_SIZE()
1092
+ *
1093
+ * See also #PSA_PAKE_OUTPUT_SIZE(\p alg, \p primitive, \p output_step).
1094
+ */
1095
+ #define PSA_PAKE_OUTPUT_MAX_SIZE 65
1096
+
1097
+ /** Input buffer size for psa_pake_input() for any of the supported PAKE
1098
+ * algorithm and primitive suites and input step.
1099
+ *
1100
+ * This macro must expand to a compile-time constant integer.
1101
+ *
1102
+ * The value of this macro must be at least as large as the largest value
1103
+ * returned by PSA_PAKE_INPUT_SIZE()
1104
+ *
1105
+ * See also #PSA_PAKE_INPUT_SIZE(\p alg, \p primitive, \p output_step).
1106
+ */
1107
+ #define PSA_PAKE_INPUT_MAX_SIZE 65
1108
+
1109
+ /** Returns a suitable initializer for a PAKE cipher suite object of type
1110
+ * psa_pake_cipher_suite_t.
1111
+ */
1112
+ #define PSA_PAKE_CIPHER_SUITE_INIT { PSA_ALG_NONE, 0, 0, 0, 0 }
1113
+
1114
+ /** Returns a suitable initializer for a PAKE operation object of type
1115
+ * psa_pake_operation_t.
1116
+ */
1117
+ #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1118
+ #define PSA_PAKE_OPERATION_INIT { 0 }
1119
+ #else
1120
+ #define PSA_PAKE_OPERATION_INIT { 0, PSA_ALG_NONE, 0, PSA_PAKE_OPERATION_STAGE_SETUP, \
1121
+ { 0 }, { { 0 } } }
1122
+ #endif
1123
+
1124
+ /**
1125
+ * A key confirmation value that indicates an confirmed key in a PAKE cipher suite.
1126
+ *
1127
+ * This key confirmation value will result in the PAKE algorithm exchanging data
1128
+ * to verify that the shared key is identical for both parties. This is the default
1129
+ * key confirmation value in an initialized PAKE cipher suite object.
1130
+ *
1131
+ * Some algorithms do not include confirmation of the shared key.
1132
+ */
1133
+ #define PSA_PAKE_CONFIRMED_KEY 0
1134
+
1135
+ /**
1136
+ * A key confirmation value that indicates an unconfirmed key in a PAKE cipher suite.
1137
+ *
1138
+ * This key confirmation value will result in the PAKE algorithm terminating prior to
1139
+ * confirming that the resulting shared key is identical for both parties.
1140
+ *
1141
+ * Some algorithms do not support returning an unconfirmed shared key.
1142
+ *
1143
+ * \warning When the shared key is not confirmed as part of the PAKE operation, the
1144
+ * application is responsible for mitigating risks that arise from the possible
1145
+ * mismatch in the output keys.
1146
+ */
1147
+ #define PSA_PAKE_UNCONFIRMED_KEY 1
1148
+
1149
+ struct psa_pake_cipher_suite_s {
1150
+ psa_algorithm_t algorithm;
1151
+ psa_pake_primitive_type_t type;
1152
+ psa_pake_family_t family;
1153
+ uint16_t bits;
1154
+ uint32_t key_confirmation;
1155
+ };
1156
+
1157
+ struct psa_crypto_driver_pake_inputs_s {
1158
+ uint8_t *MBEDTLS_PRIVATE(password);
1159
+ size_t MBEDTLS_PRIVATE(password_len);
1160
+ uint8_t *MBEDTLS_PRIVATE(user);
1161
+ size_t MBEDTLS_PRIVATE(user_len);
1162
+ uint8_t *MBEDTLS_PRIVATE(peer);
1163
+ size_t MBEDTLS_PRIVATE(peer_len);
1164
+ psa_key_attributes_t MBEDTLS_PRIVATE(attributes);
1165
+ struct psa_pake_cipher_suite_s MBEDTLS_PRIVATE(cipher_suite);
1166
+ };
1167
+
1168
+ typedef enum psa_crypto_driver_pake_step {
1169
+ PSA_JPAKE_STEP_INVALID = 0, /* Invalid step */
1170
+ PSA_JPAKE_X1_STEP_KEY_SHARE = 1, /* Round 1: input/output key share (for ephemeral private key X1).*/
1171
+ PSA_JPAKE_X1_STEP_ZK_PUBLIC = 2, /* Round 1: input/output Schnorr NIZKP public key for the X1 key */
1172
+ PSA_JPAKE_X1_STEP_ZK_PROOF = 3, /* Round 1: input/output Schnorr NIZKP proof for the X1 key */
1173
+ PSA_JPAKE_X2_STEP_KEY_SHARE = 4, /* Round 1: input/output key share (for ephemeral private key X2).*/
1174
+ PSA_JPAKE_X2_STEP_ZK_PUBLIC = 5, /* Round 1: input/output Schnorr NIZKP public key for the X2 key */
1175
+ PSA_JPAKE_X2_STEP_ZK_PROOF = 6, /* Round 1: input/output Schnorr NIZKP proof for the X2 key */
1176
+ PSA_JPAKE_X2S_STEP_KEY_SHARE = 7, /* Round 2: output X2S key (our key) */
1177
+ PSA_JPAKE_X2S_STEP_ZK_PUBLIC = 8, /* Round 2: output Schnorr NIZKP public key for the X2S key (our key) */
1178
+ PSA_JPAKE_X2S_STEP_ZK_PROOF = 9, /* Round 2: output Schnorr NIZKP proof for the X2S key (our key) */
1179
+ PSA_JPAKE_X4S_STEP_KEY_SHARE = 10, /* Round 2: input X4S key (from peer) */
1180
+ PSA_JPAKE_X4S_STEP_ZK_PUBLIC = 11, /* Round 2: input Schnorr NIZKP public key for the X4S key (from peer) */
1181
+ PSA_JPAKE_X4S_STEP_ZK_PROOF = 12 /* Round 2: input Schnorr NIZKP proof for the X4S key (from peer) */
1182
+ } psa_crypto_driver_pake_step_t;
1183
+
1184
+ typedef enum psa_jpake_round {
1185
+ PSA_JPAKE_FIRST = 0,
1186
+ PSA_JPAKE_SECOND = 1,
1187
+ PSA_JPAKE_FINISHED = 2
1188
+ } psa_jpake_round_t;
1189
+
1190
+ typedef enum psa_jpake_io_mode {
1191
+ PSA_JPAKE_INPUT = 0,
1192
+ PSA_JPAKE_OUTPUT = 1
1193
+ } psa_jpake_io_mode_t;
1194
+
1195
+ struct psa_jpake_computation_stage_s {
1196
+ /* The J-PAKE round we are currently on */
1197
+ psa_jpake_round_t MBEDTLS_PRIVATE(round);
1198
+ /* The 'mode' we are currently in (inputting or outputting) */
1199
+ psa_jpake_io_mode_t MBEDTLS_PRIVATE(io_mode);
1200
+ /* The number of completed inputs so far this round */
1201
+ uint8_t MBEDTLS_PRIVATE(inputs);
1202
+ /* The number of completed outputs so far this round */
1203
+ uint8_t MBEDTLS_PRIVATE(outputs);
1204
+ /* The next expected step (KEY_SHARE, ZK_PUBLIC or ZK_PROOF) */
1205
+ psa_pake_step_t MBEDTLS_PRIVATE(step);
1206
+ };
1207
+
1208
+ #define PSA_JPAKE_EXPECTED_INPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1209
+ ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1210
+ #define PSA_JPAKE_EXPECTED_OUTPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
1211
+ ((round) == PSA_JPAKE_FIRST ? 2 : 1))
1212
+
1213
+ struct psa_pake_operation_s {
1214
+ #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
1215
+ mbedtls_psa_client_handle_t handle;
1216
+ #else
1217
+ /** Unique ID indicating which driver got assigned to do the
1218
+ * operation. Since driver contexts are driver-specific, swapping
1219
+ * drivers halfway through the operation is not supported.
1220
+ * ID values are auto-generated in psa_crypto_driver_wrappers.h
1221
+ * ID value zero means the context is not valid or not assigned to
1222
+ * any driver (i.e. none of the driver contexts are active). */
1223
+ unsigned int MBEDTLS_PRIVATE(id);
1224
+ /* Algorithm of the PAKE operation */
1225
+ psa_algorithm_t MBEDTLS_PRIVATE(alg);
1226
+ /* A primitive of type compatible with algorithm */
1227
+ psa_pake_primitive_t MBEDTLS_PRIVATE(primitive);
1228
+ /* Stage of the PAKE operation: waiting for the setup, collecting inputs
1229
+ * or computing. */
1230
+ uint8_t MBEDTLS_PRIVATE(stage);
1231
+ /* Holds computation stage of the PAKE algorithms. */
1232
+ union {
1233
+ uint8_t MBEDTLS_PRIVATE(dummy);
1234
+ #if defined(PSA_WANT_ALG_JPAKE)
1235
+ struct psa_jpake_computation_stage_s MBEDTLS_PRIVATE(jpake);
1236
+ #endif
1237
+ } MBEDTLS_PRIVATE(computation_stage);
1238
+ union {
1239
+ psa_driver_pake_context_t MBEDTLS_PRIVATE(ctx);
1240
+ struct psa_crypto_driver_pake_inputs_s MBEDTLS_PRIVATE(inputs);
1241
+ } MBEDTLS_PRIVATE(data);
1242
+ #endif
1243
+ };
1244
+
1245
+ /** \addtogroup pake
1246
+ * @{
1247
+ */
1248
+
1249
+ /** The type of the data structure for PAKE cipher suites.
1250
+ *
1251
+ * This is an implementation-defined \c struct. Applications should not
1252
+ * make any assumptions about the content of this structure.
1253
+ * Implementation details can change in future versions without notice.
1254
+ */
1255
+ typedef struct psa_pake_cipher_suite_s psa_pake_cipher_suite_t;
1256
+
1257
+ /** Return an initial value for a PAKE cipher suite object.
1258
+ */
1259
+ static psa_pake_cipher_suite_t psa_pake_cipher_suite_init(void);
1260
+
1261
+ /** Retrieve the PAKE algorithm from a PAKE cipher suite.
1262
+ *
1263
+ * \param[in] cipher_suite The cipher suite structure to query.
1264
+ *
1265
+ * \return The PAKE algorithm stored in the cipher suite structure.
1266
+ */
1267
+ static psa_algorithm_t psa_pake_cs_get_algorithm(
1268
+ const psa_pake_cipher_suite_t *cipher_suite);
1269
+
1270
+ /** Declare the PAKE algorithm for the cipher suite.
1271
+ *
1272
+ * This function overwrites any PAKE algorithm
1273
+ * previously set in \p cipher_suite.
1274
+ *
1275
+ * \note For #PSA_ALG_JPAKE, the only supported hash algorithm is SHA-256.
1276
+ *
1277
+ * \param[out] cipher_suite The cipher suite structure to write to.
1278
+ * \param algorithm The PAKE algorithm to write.
1279
+ * (`PSA_ALG_XXX` values of type ::psa_algorithm_t
1280
+ * such that #PSA_ALG_IS_PAKE(\c alg) is true.)
1281
+ * If this is 0, the PAKE algorithm in
1282
+ * \p cipher_suite becomes unspecified.
1283
+ */
1284
+ static void psa_pake_cs_set_algorithm(psa_pake_cipher_suite_t *cipher_suite,
1285
+ psa_algorithm_t algorithm);
1286
+
1287
+ /** Retrieve the primitive from a PAKE cipher suite.
1288
+ *
1289
+ * \param[in] cipher_suite The cipher suite structure to query.
1290
+ *
1291
+ * \return The primitive stored in the cipher suite structure.
1292
+ */
1293
+ static psa_pake_primitive_t psa_pake_cs_get_primitive(
1294
+ const psa_pake_cipher_suite_t *cipher_suite);
1295
+
1296
+ /** Declare the primitive for a PAKE cipher suite.
1297
+ *
1298
+ * This function overwrites any primitive previously set in \p cipher_suite.
1299
+ *
1300
+ * \note For #PSA_ALG_JPAKE, the only supported primitive is ECC on the curve
1301
+ * secp256r1, i.e. `PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC,
1302
+ * PSA_ECC_FAMILY_SECP_R1, 256)`.
1303
+ *
1304
+ * \param[out] cipher_suite The cipher suite structure to write to.
1305
+ * \param primitive The primitive to write. If this is 0, the
1306
+ * primitive type in \p cipher_suite becomes
1307
+ * unspecified.
1308
+ */
1309
+ static void psa_pake_cs_set_primitive(psa_pake_cipher_suite_t *cipher_suite,
1310
+ psa_pake_primitive_t primitive);
1311
+
1312
+ /** Retrieve the PAKE family from a PAKE cipher suite.
1313
+ *
1314
+ * \param[in] cipher_suite The cipher suite structure to query.
1315
+ *
1316
+ * \return The PAKE family stored in the cipher suite structure.
1317
+ */
1318
+ static psa_pake_family_t psa_pake_cs_get_family(
1319
+ const psa_pake_cipher_suite_t *cipher_suite);
1320
+
1321
+ /** Retrieve the PAKE primitive bit-size from a PAKE cipher suite.
1322
+ *
1323
+ * \param[in] cipher_suite The cipher suite structure to query.
1324
+ *
1325
+ * \return The PAKE primitive bit-size stored in the cipher suite structure.
1326
+ */
1327
+ static uint16_t psa_pake_cs_get_bits(
1328
+ const psa_pake_cipher_suite_t *cipher_suite);
1329
+
1330
+ /** Retrieve the key confirmation from a PAKE cipher suite.
1331
+ *
1332
+ * \param[in] cipher_suite The cipher suite structure to query.
1333
+ *
1334
+ * \return A key confirmation value: either #PSA_PAKE_CONFIRMED_KEY or
1335
+ * #PSA_PAKE_UNCONFIRMED_KEY.
1336
+ */
1337
+ static uint32_t psa_pake_cs_get_key_confirmation(const psa_pake_cipher_suite_t *cipher_suite);
1338
+
1339
+ /** Declare the key confirmation for a PAKE cipher suite.
1340
+ *
1341
+ * This function overwrites any key confirmation previously set in \p cipher_suite.
1342
+ *
1343
+ * The documentation of individual PAKE algorithms specifies which key confirmation values
1344
+ * are valid for the algorithm.
1345
+ *
1346
+ * \param[out] cipher_suite The cipher suite structure to write to.
1347
+ * \param[in] key_confirmation The key confirmation value to write: either
1348
+ * #PSA_PAKE_CONFIRMED_KEY or #PSA_PAKE_UNCONFIRMED_KEY.
1349
+ */
1350
+ static void psa_pake_cs_set_key_confirmation(psa_pake_cipher_suite_t *cipher_suite,
1351
+ uint32_t key_confirmation);
1352
+
1353
+ /** The type of the state data structure for PAKE operations.
1354
+ *
1355
+ * Before calling any function on a PAKE operation object, the application
1356
+ * must initialize it by any of the following means:
1357
+ * - Set the structure to all-bits-zero, for example:
1358
+ * \code
1359
+ * psa_pake_operation_t operation;
1360
+ * memset(&operation, 0, sizeof(operation));
1361
+ * \endcode
1362
+ * - Initialize the structure to logical zero values, for example:
1363
+ * \code
1364
+ * psa_pake_operation_t operation = {0};
1365
+ * \endcode
1366
+ * - Initialize the structure to the initializer #PSA_PAKE_OPERATION_INIT,
1367
+ * for example:
1368
+ * \code
1369
+ * psa_pake_operation_t operation = PSA_PAKE_OPERATION_INIT;
1370
+ * \endcode
1371
+ * - Assign the result of the function psa_pake_operation_init()
1372
+ * to the structure, for example:
1373
+ * \code
1374
+ * psa_pake_operation_t operation;
1375
+ * operation = psa_pake_operation_init();
1376
+ * \endcode
1377
+ *
1378
+ * This is an implementation-defined \c struct. Applications should not
1379
+ * make any assumptions about the content of this structure.
1380
+ * Implementation details can change in future versions without notice. */
1381
+ typedef struct psa_pake_operation_s psa_pake_operation_t;
1382
+
1383
+ /** The type of input values for PAKE operations. */
1384
+ typedef struct psa_crypto_driver_pake_inputs_s psa_crypto_driver_pake_inputs_t;
1385
+
1386
+ /** The type of computation stage for J-PAKE operations. */
1387
+ typedef struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t;
1388
+
1389
+ /** Return an initial value for a PAKE operation object.
1390
+ */
1391
+ static psa_pake_operation_t psa_pake_operation_init(void);
1392
+
1393
+ /** Get the length of the password in bytes from given inputs.
1394
+ *
1395
+ * \param[in] inputs Operation inputs.
1396
+ * \param[out] password_len Password length.
1397
+ *
1398
+ * \retval #PSA_SUCCESS
1399
+ * Success.
1400
+ * \retval #PSA_ERROR_BAD_STATE
1401
+ * Password hasn't been set yet.
1402
+ */
1403
+ psa_status_t psa_crypto_driver_pake_get_password_len(
1404
+ const psa_crypto_driver_pake_inputs_t *inputs,
1405
+ size_t *password_len);
1406
+
1407
+ /** Get the password from given inputs.
1408
+ *
1409
+ * \param[in] inputs Operation inputs.
1410
+ * \param[out] buffer Return buffer for password.
1411
+ * \param buffer_size Size of the return buffer in bytes.
1412
+ * \param[out] buffer_length Actual size of the password in bytes.
1413
+ *
1414
+ * \retval #PSA_SUCCESS
1415
+ * Success.
1416
+ * \retval #PSA_ERROR_BAD_STATE
1417
+ * Password hasn't been set yet.
1418
+ */
1419
+ psa_status_t psa_crypto_driver_pake_get_password(
1420
+ const psa_crypto_driver_pake_inputs_t *inputs,
1421
+ uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
1422
+
1423
+ /** Get the length of the user id in bytes from given inputs.
1424
+ *
1425
+ * \param[in] inputs Operation inputs.
1426
+ * \param[out] user_len User id length.
1427
+ *
1428
+ * \retval #PSA_SUCCESS
1429
+ * Success.
1430
+ * \retval #PSA_ERROR_BAD_STATE
1431
+ * User id hasn't been set yet.
1432
+ */
1433
+ psa_status_t psa_crypto_driver_pake_get_user_len(
1434
+ const psa_crypto_driver_pake_inputs_t *inputs,
1435
+ size_t *user_len);
1436
+
1437
+ /** Get the length of the peer id in bytes from given inputs.
1438
+ *
1439
+ * \param[in] inputs Operation inputs.
1440
+ * \param[out] peer_len Peer id length.
1441
+ *
1442
+ * \retval #PSA_SUCCESS
1443
+ * Success.
1444
+ * \retval #PSA_ERROR_BAD_STATE
1445
+ * Peer id hasn't been set yet.
1446
+ */
1447
+ psa_status_t psa_crypto_driver_pake_get_peer_len(
1448
+ const psa_crypto_driver_pake_inputs_t *inputs,
1449
+ size_t *peer_len);
1450
+
1451
+ /** Get the user id from given inputs.
1452
+ *
1453
+ * \param[in] inputs Operation inputs.
1454
+ * \param[out] user_id User id.
1455
+ * \param user_id_size Size of \p user_id in bytes.
1456
+ * \param[out] user_id_len Size of the user id in bytes.
1457
+ *
1458
+ * \retval #PSA_SUCCESS
1459
+ * Success.
1460
+ * \retval #PSA_ERROR_BAD_STATE
1461
+ * User id hasn't been set yet.
1462
+ * \retval #PSA_ERROR_BUFFER_TOO_SMALL
1463
+ * The size of the \p user_id is too small.
1464
+ */
1465
+ psa_status_t psa_crypto_driver_pake_get_user(
1466
+ const psa_crypto_driver_pake_inputs_t *inputs,
1467
+ uint8_t *user_id, size_t user_id_size, size_t *user_id_len);
1468
+
1469
+ /** Get the peer id from given inputs.
1470
+ *
1471
+ * \param[in] inputs Operation inputs.
1472
+ * \param[out] peer_id Peer id.
1473
+ * \param peer_id_size Size of \p peer_id in bytes.
1474
+ * \param[out] peer_id_length Size of the peer id in bytes.
1475
+ *
1476
+ * \retval #PSA_SUCCESS
1477
+ * Success.
1478
+ * \retval #PSA_ERROR_BAD_STATE
1479
+ * Peer id hasn't been set yet.
1480
+ * \retval #PSA_ERROR_BUFFER_TOO_SMALL
1481
+ * The size of the \p peer_id is too small.
1482
+ */
1483
+ psa_status_t psa_crypto_driver_pake_get_peer(
1484
+ const psa_crypto_driver_pake_inputs_t *inputs,
1485
+ uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length);
1486
+
1487
+ /** Get the cipher suite from given inputs.
1488
+ *
1489
+ * \param[in] inputs Operation inputs.
1490
+ * \param[out] cipher_suite Return buffer for role.
1491
+ *
1492
+ * \retval #PSA_SUCCESS
1493
+ * Success.
1494
+ * \retval #PSA_ERROR_BAD_STATE
1495
+ * Cipher_suite hasn't been set yet.
1496
+ */
1497
+ psa_status_t psa_crypto_driver_pake_get_cipher_suite(
1498
+ const psa_crypto_driver_pake_inputs_t *inputs,
1499
+ psa_pake_cipher_suite_t *cipher_suite);
1500
+
1501
+ /** Setup a password-authenticated key exchange.
1502
+ *
1503
+ * The sequence of operations to set up a password-authenticated key exchange
1504
+ * operation is as follows:
1505
+ * -# Allocate a PAKE operation object which will be passed to all the functions
1506
+ * listed here.
1507
+ * -# Initialize the operation object with one of the methods described in the
1508
+ * documentation for #psa_pake_operation_t. For example, using
1509
+ * #PSA_PAKE_OPERATION_INIT.
1510
+ * -# Call #psa_pake_setup() to specify the cipher suite.
1511
+ * -# Call \c psa_pake_set_xxx() functions on the operation to complete the
1512
+ * setup. The exact sequence of \c psa_pake_set_xxx() functions that needs
1513
+ * to be called depends on the algorithm in use.
1514
+ *
1515
+ * A typical sequence of calls to perform a password-authenticated key
1516
+ * exchange:
1517
+ * -# Call #psa_pake_output(operation, #PSA_PAKE_STEP_KEY_SHARE, ...) to get the
1518
+ * key share that needs to be sent to the peer.
1519
+ * -# Call #psa_pake_input(operation, #PSA_PAKE_STEP_KEY_SHARE, ...) to provide
1520
+ * the key share that was received from the peer.
1521
+ * -# Depending on the algorithm additional calls to #psa_pake_output() and
1522
+ * #psa_pake_input() might be necessary.
1523
+ * -# Call #psa_pake_get_shared_key() to access the shared secret.
1524
+ *
1525
+ * Refer to the documentation of individual PAKE algorithms for details on the
1526
+ * required set up and operation for each algorithm, and for constraints on the
1527
+ * format and content of valid passwords. See PAKE algorithms.
1528
+ *
1529
+ * After a successful call to #psa_pake_setup(), the operation is active, and
1530
+ * the application must eventually terminate the operation. The following events
1531
+ * terminate an operation:
1532
+ * - A successful call to #psa_pake_get_shared_key().
1533
+ * - A call to #psa_pake_abort().
1534
+ *
1535
+ * If #psa_pake_setup() returns an error, the operation object is unchanged. If
1536
+ * a subsequent function call with an active operation returns an error, the operation
1537
+ * enters an error state.
1538
+ *
1539
+ * To abandon an active operation, or reset an operation in an error state, call
1540
+ * #psa_pake_abort().
1541
+ *
1542
+ * \param[in,out] operation The operation object to set up. It must have been
1543
+ * initialized as per the documentation for
1544
+ * #psa_pake_operation_t and not yet in use.
1545
+ * \param[in] password_key Identifier of the key holding the password or a
1546
+ * value derived from the password. It must remain
1547
+ * valid until the operation terminates.
1548
+ *
1549
+ * The valid key types depend on the PAKE algorithm,
1550
+ * and participant role. Refer to the documentation of
1551
+ * individual PAKE algorithms for more information, see
1552
+ * PAKE algorithms.
1553
+ *
1554
+ * The key must permit the usage #PSA_KEY_USAGE_DERIVE.
1555
+ * \param[in] cipher_suite The cipher suite to use. A PAKE cipher suite fully
1556
+ * characterizes a PAKE algorithm, including the PAKE
1557
+ * algorithm.
1558
+ *
1559
+ * The cipher suite must be compatible with the key type
1560
+ * of \p password_key.
1561
+ *
1562
+ * \retval #PSA_SUCCESS
1563
+ * Success. The operation is now active.
1564
+ * \retval #PSA_ERROR_BAD_STATE
1565
+ * The following conditions can result in this error:
1566
+ * - The operation state is not valid: it must be inactive.
1567
+ * - The library requires initializing by a call to #psa_crypto_init().
1568
+ * \retval #PSA_ERROR_INVALID_HANDLE
1569
+ * \p password_key is not a valid key identifier.
1570
+ * \retval #PSA_ERROR_NOT_PERMITTED
1571
+ * \p password_key does not have the #PSA_KEY_USAGE_DERIVE flag, or it does
1572
+ * not permit the algorithm in \p cipher_suite.
1573
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1574
+ * The following conditions can result in this error:
1575
+ * - The algorithm in \p cipher_suite is not a PAKE algorithm, or encodes an
1576
+ * invalid hash algorithm.
1577
+ * - The PAKE primitive in \p cipher_suite is not compatible with the PAKE
1578
+ * algorithm.
1579
+ * - The key confirmation value in \p cipher_suite is not compatible with the
1580
+ * PAKE algorithm and primitive.
1581
+ * - The key type or key size of \p password_key is not compatible with
1582
+ * \p cipher_suite.
1583
+ * \retval #PSA_ERROR_NOT_SUPPORTED
1584
+ * The following conditions can result in this error:
1585
+ * - The algorithm in \p cipher_suite is not a supported PAKE algorithm, or
1586
+ * encodes an unsupported hash algorithm.
1587
+ * - The PAKE primitive in \p cipher_suite is not supported or not compatible
1588
+ * with the PAKE algorithm.
1589
+ * - The key confirmation value in \p cipher_suite is not supported, or not
1590
+ * compatible, with the PAKE algorithm and primitive.
1591
+ * - The key type or key size of \p password_key is not supported with
1592
+ * \p cipher_suite.
1593
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
1594
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
1595
+ * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
1596
+ * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
1597
+ * \retval #PSA_ERROR_DATA_INVALID \emptydescription
1598
+ */
1599
+ psa_status_t psa_pake_setup(psa_pake_operation_t *operation,
1600
+ mbedtls_svc_key_id_t password_key,
1601
+ const psa_pake_cipher_suite_t *cipher_suite);
1602
+
1603
+ /** Set the user ID for a password-authenticated key exchange.
1604
+ *
1605
+ * Call this function to set the user ID. For PAKE algorithms that associate a
1606
+ * user identifier with each side of the session you need to call
1607
+ * psa_pake_set_peer() as well. For PAKE algorithms that associate a single
1608
+ * user identifier with the session, call psa_pake_set_user() only.
1609
+ *
1610
+ * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX`
1611
+ * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true)
1612
+ * for more information.
1613
+ *
1614
+ * \note When using the built-in implementation of #PSA_ALG_JPAKE, the user ID
1615
+ * must be `"client"` (6-byte string) or `"server"` (6-byte string).
1616
+ * Third-party drivers may or may not have this limitation.
1617
+ *
1618
+ * \param[in,out] operation The operation object to set the user ID for. It
1619
+ * must have been set up by psa_pake_setup() and
1620
+ * not yet in use (neither psa_pake_output() nor
1621
+ * psa_pake_input() has been called yet). It must
1622
+ * be on operation for which the user ID hasn't
1623
+ * been set (psa_pake_set_user() hasn't been
1624
+ * called yet).
1625
+ * \param[in] user_id The user ID to authenticate with.
1626
+ * \param user_id_len Size of the \p user_id buffer in bytes.
1627
+ *
1628
+ * \retval #PSA_SUCCESS
1629
+ * Success.
1630
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1631
+ * \p user_id is not valid for the \p operation's algorithm and cipher
1632
+ * suite.
1633
+ * \retval #PSA_ERROR_NOT_SUPPORTED
1634
+ * The value of \p user_id is not supported by the implementation.
1635
+ * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
1636
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
1637
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
1638
+ * \retval #PSA_ERROR_BAD_STATE
1639
+ * The operation state is not valid, or
1640
+ * the library has not been previously initialized by psa_crypto_init().
1641
+ * It is implementation-dependent whether a failure to initialize
1642
+ * results in this error code.
1643
+ */
1644
+ psa_status_t psa_pake_set_user(psa_pake_operation_t *operation,
1645
+ const uint8_t *user_id,
1646
+ size_t user_id_len);
1647
+
1648
+ /** Set the peer ID for a password-authenticated key exchange.
1649
+ *
1650
+ * Call this function in addition to psa_pake_set_user() for PAKE algorithms
1651
+ * that associate a user identifier with each side of the session. For PAKE
1652
+ * algorithms that associate a single user identifier with the session, call
1653
+ * psa_pake_set_user() only.
1654
+ *
1655
+ * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX`
1656
+ * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true)
1657
+ * for more information.
1658
+ *
1659
+ * \note When using the built-in implementation of #PSA_ALG_JPAKE, the peer ID
1660
+ * must be `"client"` (6-byte string) or `"server"` (6-byte string).
1661
+ * Third-party drivers may or may not have this limitation.
1662
+ *
1663
+ * \param[in,out] operation The operation object to set the peer ID for. It
1664
+ * must have been set up by psa_pake_setup() and
1665
+ * not yet in use (neither psa_pake_output() nor
1666
+ * psa_pake_input() has been called yet). It must
1667
+ * be on operation for which the peer ID hasn't
1668
+ * been set (psa_pake_set_peer() hasn't been
1669
+ * called yet).
1670
+ * \param[in] peer_id The peer's ID to authenticate.
1671
+ * \param peer_id_len Size of the \p peer_id buffer in bytes.
1672
+ *
1673
+ * \retval #PSA_SUCCESS
1674
+ * Success.
1675
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1676
+ * \p peer_id is not valid for the \p operation's algorithm and cipher
1677
+ * suite.
1678
+ * \retval #PSA_ERROR_NOT_SUPPORTED
1679
+ * The algorithm doesn't associate a second identity with the session.
1680
+ * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
1681
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
1682
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
1683
+ * \retval #PSA_ERROR_BAD_STATE
1684
+ * Calling psa_pake_set_peer() is invalid with the \p operation's
1685
+ * algorithm, the operation state is not valid, or the library has not
1686
+ * been previously initialized by psa_crypto_init().
1687
+ * It is implementation-dependent whether a failure to initialize
1688
+ * results in this error code.
1689
+ */
1690
+ psa_status_t psa_pake_set_peer(psa_pake_operation_t *operation,
1691
+ const uint8_t *peer_id,
1692
+ size_t peer_id_len);
1693
+
1694
+ /** Set the application role for a password-authenticated key exchange.
1695
+ *
1696
+ * Not all PAKE algorithms need to differentiate the communicating entities.
1697
+ * It is optional to call this function for PAKEs that don't require a role
1698
+ * to be specified. For such PAKEs the application role parameter is ignored,
1699
+ * or #PSA_PAKE_ROLE_NONE can be passed as \c role.
1700
+ *
1701
+ * Refer to the documentation of individual PAKE algorithm types (`PSA_ALG_XXX`
1702
+ * values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true)
1703
+ * for more information.
1704
+ *
1705
+ * \param[in,out] operation The operation object to specify the
1706
+ * application's role for. It must have been set up
1707
+ * by psa_pake_setup() and not yet in use (neither
1708
+ * psa_pake_output() nor psa_pake_input() has been
1709
+ * called yet). It must be on operation for which
1710
+ * the application's role hasn't been specified
1711
+ * (psa_pake_set_role() hasn't been called yet).
1712
+ * \param role A value of type ::psa_pake_role_t indicating the
1713
+ * application's role in the PAKE the algorithm
1714
+ * that is being set up. For more information see
1715
+ * the documentation of \c PSA_PAKE_ROLE_XXX
1716
+ * constants.
1717
+ *
1718
+ * \retval #PSA_SUCCESS
1719
+ * Success.
1720
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1721
+ * The \p role is not a valid PAKE role in the \p operation’s algorithm.
1722
+ * \retval #PSA_ERROR_NOT_SUPPORTED
1723
+ * The \p role for this algorithm is not supported or is not valid.
1724
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
1725
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
1726
+ * \retval #PSA_ERROR_BAD_STATE
1727
+ * The operation state is not valid, or
1728
+ * the library has not been previously initialized by psa_crypto_init().
1729
+ * It is implementation-dependent whether a failure to initialize
1730
+ * results in this error code.
1731
+ */
1732
+ psa_status_t psa_pake_set_role(psa_pake_operation_t *operation,
1733
+ psa_pake_role_t role);
1734
+
1735
+ /** Set the context data for a password-authenticated key exchange.
1736
+ *
1737
+ * Not all PAKE algorithms use context data. Only call this function
1738
+ * for algorithms that need it.
1739
+ *
1740
+ * \param[in,out] operation The operation object to specify the
1741
+ * application's role for. It must have been set up
1742
+ * by psa_pake_setup() and not yet in use (neither
1743
+ * psa_pake_output() nor psa_pake_input() has been
1744
+ * called yet). It must be an operation for which
1745
+ * the context hasn't been specified
1746
+ * (psa_pake_set_context() hasn't been called yet).
1747
+ * \param[in] context The context to set.
1748
+ * \param context_len The length of \p context in bytes.
1749
+ *
1750
+ * \retval #PSA_SUCCESS
1751
+ * Success.
1752
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1753
+ * The algorithm in \p operation does not use a context.
1754
+ * \retval #PSA_ERROR_NOT_SUPPORTED
1755
+ * The library configuration does not support PAKE algorithms with
1756
+ * a context, or this specific context value is not supported for
1757
+ * the given \p operation.
1758
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
1759
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
1760
+ * \retval #PSA_ERROR_BAD_STATE
1761
+ * The operation state is not valid, or
1762
+ * the library has not been previously initialized by psa_crypto_init().
1763
+ * It is implementation-dependent whether a failure to initialize
1764
+ * results in this error code.
1765
+ */
1766
+ psa_status_t psa_pake_set_context(psa_pake_operation_t *operation,
1767
+ const uint8_t *context,
1768
+ size_t context_len);
1769
+
1770
+ /** Get output for a step of a password-authenticated key exchange.
1771
+ *
1772
+ * Depending on the algorithm being executed, you might need to call this
1773
+ * function several times or you might not need to call this at all.
1774
+ *
1775
+ * The exact sequence of calls to perform a password-authenticated key
1776
+ * exchange depends on the algorithm in use. Refer to the documentation of
1777
+ * individual PAKE algorithm types (`PSA_ALG_XXX` values of type
1778
+ * ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) for more
1779
+ * information.
1780
+ *
1781
+ * If this function returns an error status, the operation enters an error
1782
+ * state and must be aborted by calling psa_pake_abort().
1783
+ *
1784
+ * \param[in,out] operation Active PAKE operation.
1785
+ * \param step The step of the algorithm for which the output is
1786
+ * requested.
1787
+ * \param[out] output Buffer where the output is to be written in the
1788
+ * format appropriate for this \p step. Refer to
1789
+ * the documentation of the individual
1790
+ * \c PSA_PAKE_STEP_XXX constants for more
1791
+ * information.
1792
+ * \param output_size Size of the \p output buffer in bytes. This must
1793
+ * be at least #PSA_PAKE_OUTPUT_SIZE(\c alg, \c
1794
+ * primitive, \p output_step) where \c alg and
1795
+ * \p primitive are the PAKE algorithm and primitive
1796
+ * in the operation's cipher suite, and \p step is
1797
+ * the output step.
1798
+ *
1799
+ * \param[out] output_length On success, the number of bytes of the returned
1800
+ * output.
1801
+ *
1802
+ * \retval #PSA_SUCCESS
1803
+ * Success.
1804
+ * \retval #PSA_ERROR_BUFFER_TOO_SMALL
1805
+ * The size of the \p output buffer is too small.
1806
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1807
+ * \p step is not compatible with the operation's algorithm.
1808
+ * \retval #PSA_ERROR_NOT_SUPPORTED
1809
+ * \p step is not supported with the operation's algorithm.
1810
+ * \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription
1811
+ * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
1812
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
1813
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
1814
+ * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
1815
+ * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
1816
+ * \retval #PSA_ERROR_DATA_INVALID \emptydescription
1817
+ * \retval #PSA_ERROR_BAD_STATE
1818
+ * The operation state is not valid (it must be active, and fully set
1819
+ * up, and this call must conform to the algorithm's requirements
1820
+ * for ordering of input and output steps), or
1821
+ * the library has not been previously initialized by psa_crypto_init().
1822
+ * It is implementation-dependent whether a failure to initialize
1823
+ * results in this error code.
1824
+ */
1825
+ psa_status_t psa_pake_output(psa_pake_operation_t *operation,
1826
+ psa_pake_step_t step,
1827
+ uint8_t *output,
1828
+ size_t output_size,
1829
+ size_t *output_length);
1830
+
1831
+ /** Provide input for a step of a password-authenticated key exchange.
1832
+ *
1833
+ * Depending on the algorithm being executed, you might need to call this
1834
+ * function several times or you might not need to call this at all.
1835
+ *
1836
+ * The exact sequence of calls to perform a password-authenticated key
1837
+ * exchange depends on the algorithm in use. Refer to the documentation of
1838
+ * individual PAKE algorithm types (`PSA_ALG_XXX` values of type
1839
+ * ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) for more
1840
+ * information.
1841
+ *
1842
+ * If this function returns an error status, the operation enters an error
1843
+ * state and must be aborted by calling psa_pake_abort().
1844
+ *
1845
+ * \param[in,out] operation Active PAKE operation.
1846
+ * \param step The step for which the input is provided.
1847
+ * \param[in] input Buffer containing the input in the format
1848
+ * appropriate for this \p step. Refer to the
1849
+ * documentation of the individual
1850
+ * \c PSA_PAKE_STEP_XXX constants for more
1851
+ * information.
1852
+ * \param input_length Size of the \p input buffer in bytes.
1853
+ *
1854
+ * \retval #PSA_SUCCESS
1855
+ * Success.
1856
+ * \retval #PSA_ERROR_INVALID_SIGNATURE
1857
+ * The verification fails for a #PSA_PAKE_STEP_ZK_PROOF input step.
1858
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1859
+ * \p input_length is not compatible with the \p operation’s algorithm,
1860
+ * or the \p input is not valid for the \p operation's algorithm,
1861
+ * cipher suite or \p step.
1862
+ * \retval #PSA_ERROR_NOT_SUPPORTED
1863
+ * \p step p is not supported with the \p operation's algorithm, or the
1864
+ * \p input is not supported for the \p operation's algorithm, cipher
1865
+ * suite or \p step.
1866
+ * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
1867
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
1868
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
1869
+ * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
1870
+ * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
1871
+ * \retval #PSA_ERROR_DATA_INVALID \emptydescription
1872
+ * \retval #PSA_ERROR_BAD_STATE
1873
+ * The operation state is not valid (it must be active, and fully set
1874
+ * up, and this call must conform to the algorithm's requirements
1875
+ * for ordering of input and output steps), or
1876
+ * the library has not been previously initialized by psa_crypto_init().
1877
+ * It is implementation-dependent whether a failure to initialize
1878
+ * results in this error code.
1879
+ */
1880
+ psa_status_t psa_pake_input(psa_pake_operation_t *operation,
1881
+ psa_pake_step_t step,
1882
+ const uint8_t *input,
1883
+ size_t input_length);
1884
+
1885
+ /** Extract the shared secret from the PAKE as a key.
1886
+ *
1887
+ * This is the final call in a PAKE operation, which retrieves the shared
1888
+ * secret as a key. It is recommended that this key is used as an input to
1889
+ * a key derivation operation to produce additional cryptographic keys. For
1890
+ * some PAKE algorithms, the shared secret is also suitable for use as a key
1891
+ * in cryptographic operations such as encryption. Refer to the documentation
1892
+ * of individual PAKE algorithms for more information, see PAKE algorithms.
1893
+ *
1894
+ * Depending on the key confirmation requested in the cipher suite,
1895
+ * #psa_pake_get_shared_key() must be called either before or after the
1896
+ * key-confirmation output and input steps for the PAKE algorithm. The key
1897
+ * confirmation affects the guarantees that can be made about the shared key:
1898
+ *
1899
+ * Unconfirmed key:
1900
+ *
1901
+ * If the cipher suite used to set up the operation requested an unconfirmed
1902
+ * key, the application must call #psa_pake_get_shared_key() after the
1903
+ * key-exchange output and input steps are completed. The PAKE algorithm
1904
+ * provides a cryptographic guarantee that only a peer who used the same
1905
+ * password and identity inputs is able to compute the same key. However,
1906
+ * there is no guarantee that the peer is the participant it claims to be
1907
+ * and was able to compute the same key.
1908
+ *
1909
+ * Since the peer is not authenticated, no action should be taken that assumes
1910
+ * that the peer is who it claims to be. For example, do not access restricted
1911
+ * resources on the peer’s behalf until an explicit authentication has succeeded.
1912
+ *
1913
+ * \note Some PAKE algorithms do not enable the output of the shared secret
1914
+ * until it has been confirmed.
1915
+ *
1916
+ * Confirmed key:
1917
+ *
1918
+ * If the cipher suite used to set up the operation requested a confirmed key,
1919
+ * the application must call #psa_pake_get_shared_key() after the key-exchange
1920
+ * and key-confirmation output and input steps are completed.
1921
+ *
1922
+ * Following key confirmation, the PAKE algorithm provides a cryptographic
1923
+ * guarantee that the peer used the same password and identity inputs, and
1924
+ * has computed the identical shared secret key.
1925
+ *
1926
+ * Since the peer is not authenticated, no action should be taken that assumes
1927
+ * that the peer is who it claims to be. For example, do not access restricted
1928
+ * resources on the peer’s behalf until an explicit authentication has succeeded.
1929
+ *
1930
+ * \note Some PAKE algorithms do not include any key-confirmation steps.
1931
+ *
1932
+ * The exact sequence of calls to perform a password-authenticated key exchange
1933
+ * depends on the algorithm in use. Refer to the documentation of individual PAKE
1934
+ * algorithms for more information. See PAKE algorithms.
1935
+ *
1936
+ * When this function returns successfully, the operation becomes inactive. If this
1937
+ * function returns an error status, the operation enters an error state and must
1938
+ * be aborted by calling #psa_pake_abort().
1939
+ *
1940
+ * \param[in,out] operation Active PAKE operation.
1941
+ * \param[in] attributes The attributes for the new key. This function uses
1942
+ * the attributes as follows:
1943
+ * The key type is required. All PAKE algorithms can
1944
+ * output a key of type #PSA_KEY_TYPE_DERIVE or
1945
+ * #PSA_KEY_TYPE_HMAC. PAKE algorithms that produce a
1946
+ * pseudo-random shared secret, can also output
1947
+ * block-cipher key types, for example
1948
+ * #PSA_KEY_TYPE_AES. Refer to the documentation of
1949
+ * individual PAKE algorithms for more information.
1950
+ * See PAKE algorithms.
1951
+ *
1952
+ * The key size in attributes must be zero. The
1953
+ * returned key size is always determined from the
1954
+ * PAKE shared secret.
1955
+ *
1956
+ * The key permitted-algorithm policy is required for
1957
+ * keys that will be used for a cryptographic operation.
1958
+ *
1959
+ * The key usage flags define what operations are permitted
1960
+ * with the key.
1961
+ *
1962
+ * The key lifetime and identifier are required for a
1963
+ * persistent key.
1964
+ *
1965
+ * \note This is an input parameter: It is not updated
1966
+ * with the final key attributes. The final attributes
1967
+ * of the new key can be queried by calling
1968
+ * #psa_get_key_attributes() with the key’s identifier.
1969
+ * \param[out] key On success, an identifier for the newly created key.
1970
+ * #PSA_KEY_ID_NULL on failure.
1971
+ *
1972
+ * \retval #PSA_SUCCESS
1973
+ * Success. If the key is persistent, the key material and the key’s metadata have
1974
+ * been saved to persistent storage.
1975
+ * \retval #PSA_ERROR_BAD_STATE
1976
+ * The following conditions can result in this error:
1977
+ * The state of PAKE operation \p operation is not valid: It must be ready to return
1978
+ * the shared secret.
1979
+ * For an unconfirmed key, this will be when the key-exchange output and input
1980
+ * steps are complete, but prior to any key-confirmation output and input steps.
1981
+ * For a confirmed key, this will be when all key-exchange and key-confirmation
1982
+ * output and input steps are complete.
1983
+ * The library requires initializing by a call to #psa_crypto_init().
1984
+ * \retval #PSA_ERROR_NOT_PERMITTED
1985
+ * The implementation does not permit creating a key with the specified attributes
1986
+ * due to some implementation-specific policy.
1987
+ * \retval #PSA_ERROR_ALREADY_EXISTS
1988
+ * This is an attempt to create a persistent key, and there is already a persistent
1989
+ * key with the given identifier.
1990
+ *
1991
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
1992
+ * The following conditions can result in this error:
1993
+ * The \p key type is not valid for output from this \p operation’s algorithm.
1994
+ * The \p key size is nonzero.
1995
+ * The \p key lifetime is invalid.
1996
+ * The \p key identifier is not valid for the key lifetime.
1997
+ * The \p key usage flags include invalid values.
1998
+ * The \p key’s permitted-usage algorithm is invalid.
1999
+ * The \p key attributes, as a whole, are invalid.
2000
+ * \retval #PSA_ERROR_NOT_SUPPORTED
2001
+ * The \p key attributes, as a whole, are not supported for creation from a PAKE secret,
2002
+ * either by the implementation in general or in the specified storage location.
2003
+ * \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription
2004
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
2005
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
2006
+ * \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription
2007
+ * \retval #PSA_ERROR_DATA_CORRUPT \emptydescription
2008
+ * \retval #PSA_ERROR_DATA_INVALID \emptydescription
2009
+ */
2010
+ psa_status_t psa_pake_get_shared_key(psa_pake_operation_t *operation,
2011
+ const psa_key_attributes_t *attributes,
2012
+ mbedtls_svc_key_id_t *key);
2013
+
2014
+ /** Abort a PAKE operation.
2015
+ *
2016
+ * Aborting an operation frees all associated resources except for the \c
2017
+ * operation structure itself. Once aborted, the operation object can be reused
2018
+ * for another operation by calling psa_pake_setup() again.
2019
+ *
2020
+ * This function may be called at any time after the operation
2021
+ * object has been initialized as described in #psa_pake_operation_t.
2022
+ *
2023
+ * In particular, calling psa_pake_abort() after the operation has been
2024
+ * terminated by a call to #psa_pake_abort() or #psa_pake_get_shared_key()
2025
+ * is safe and has no effect.
2026
+ *
2027
+ * \param[in,out] operation The operation to abort.
2028
+ *
2029
+ * \retval #PSA_SUCCESS
2030
+ * Success.
2031
+ * \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription
2032
+ * \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription
2033
+ * \retval #PSA_ERROR_BAD_STATE
2034
+ * The library has not been previously initialized by psa_crypto_init().
2035
+ * It is implementation-dependent whether a failure to initialize
2036
+ * results in this error code.
2037
+ */
2038
+ psa_status_t psa_pake_abort(psa_pake_operation_t *operation);
2039
+
2040
+ /**@}*/
2041
+
2042
+ static inline psa_algorithm_t psa_pake_cs_get_algorithm(
2043
+ const psa_pake_cipher_suite_t *cipher_suite)
2044
+ {
2045
+ return cipher_suite->algorithm;
2046
+ }
2047
+
2048
+ static inline void psa_pake_cs_set_algorithm(
2049
+ psa_pake_cipher_suite_t *cipher_suite,
2050
+ psa_algorithm_t algorithm)
2051
+ {
2052
+ if (!PSA_ALG_IS_PAKE(algorithm)) {
2053
+ cipher_suite->algorithm = 0;
2054
+ } else {
2055
+ cipher_suite->algorithm = algorithm;
2056
+ }
2057
+ }
2058
+
2059
+ static inline psa_pake_primitive_t psa_pake_cs_get_primitive(
2060
+ const psa_pake_cipher_suite_t *cipher_suite)
2061
+ {
2062
+ return PSA_PAKE_PRIMITIVE(cipher_suite->type, cipher_suite->family,
2063
+ cipher_suite->bits);
2064
+ }
2065
+
2066
+ static inline void psa_pake_cs_set_primitive(
2067
+ psa_pake_cipher_suite_t *cipher_suite,
2068
+ psa_pake_primitive_t primitive)
2069
+ {
2070
+ cipher_suite->type = (psa_pake_primitive_type_t) (primitive >> 24);
2071
+ cipher_suite->family = (psa_pake_family_t) (0xFF & (primitive >> 16));
2072
+ cipher_suite->bits = (uint16_t) (0xFFFF & primitive);
2073
+ }
2074
+
2075
+ static inline psa_pake_family_t psa_pake_cs_get_family(
2076
+ const psa_pake_cipher_suite_t *cipher_suite)
2077
+ {
2078
+ return cipher_suite->family;
2079
+ }
2080
+
2081
+ static inline uint16_t psa_pake_cs_get_bits(
2082
+ const psa_pake_cipher_suite_t *cipher_suite)
2083
+ {
2084
+ return cipher_suite->bits;
2085
+ }
2086
+
2087
+
2088
+ static inline uint32_t psa_pake_cs_get_key_confirmation(const psa_pake_cipher_suite_t *cipher_suite)
2089
+ {
2090
+ return cipher_suite->key_confirmation;
2091
+ }
2092
+
2093
+ static inline void psa_pake_cs_set_key_confirmation(psa_pake_cipher_suite_t *cipher_suite,
2094
+ uint32_t key_confirmation)
2095
+ {
2096
+ cipher_suite->key_confirmation = key_confirmation;
2097
+ }
2098
+
2099
+ static inline struct psa_pake_cipher_suite_s psa_pake_cipher_suite_init(void)
2100
+ {
2101
+ const struct psa_pake_cipher_suite_s v = PSA_PAKE_CIPHER_SUITE_INIT;
2102
+ return v;
2103
+ }
2104
+
2105
+ static inline struct psa_pake_operation_s psa_pake_operation_init(void)
2106
+ {
2107
+ const struct psa_pake_operation_s v = PSA_PAKE_OPERATION_INIT;
2108
+ return v;
2109
+ }
2110
+
2111
+ #ifdef __cplusplus
2112
+ }
2113
+ #endif
2114
+
2115
+ #endif /* PSA_CRYPTO_EXTRA_H */