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.
- package/LICENSE +20 -0
- package/README.md +7 -2
- package/android/CMakeLists.txt +28 -0
- package/android/build.gradle +99 -0
- package/android/src/main/AndroidManifest.xml +35 -0
- package/android/src/main/cpp/cpp-adapter.cpp +12 -0
- package/android/src/main/java/com/nitrobsx/BSXAlarmReceiver.kt +29 -0
- package/android/src/main/java/com/nitrobsx/BSXAlarmScheduler.kt +112 -0
- package/android/src/main/java/com/nitrobsx/BSXForegroundService.kt +78 -0
- package/android/src/main/java/com/nitrobsx/BSXNotifications.kt +47 -0
- package/android/src/main/java/com/nitrobsx/BSXServiceController.kt +90 -0
- package/android/src/main/java/com/nitrobsx/BSXWakeWorker.kt +136 -0
- package/android/src/main/java/com/nitrobsx/HeadlessJsTaskSupportShim.kt +41 -0
- package/android/src/main/java/com/nitrobsx/NitroBSXPackage.kt +28 -0
- package/android/src/main/res/drawable/bsx_ic_stat_swap.xml +9 -0
- package/cpp/BSXContext.cpp +263 -0
- package/cpp/BSXContext.h +49 -0
- package/cpp/BSXModule.cpp +21191 -0
- package/cpp/BSXModule.h +1523 -0
- package/cpp/CMakeLists.txt +463 -0
- package/cpp/HybridNitroBSX.cpp +1483 -0
- package/cpp/HybridNitroBSX.hpp +173 -0
- package/cpp/arith_uint256.cpp +232 -0
- package/cpp/arith_uint256.h +277 -0
- package/cpp/bsx/event.cpp +48 -0
- package/cpp/bsx/event.h +29 -0
- package/cpp/bsx/swap.h +293 -0
- package/cpp/bsx/types.cpp +486 -0
- package/cpp/bsx/types.h +308 -0
- package/cpp/bsx_db.cpp +4951 -0
- package/cpp/bsx_db.h +465 -0
- package/cpp/chain_client.h +143 -0
- package/cpp/cmake/GenVersion.cmake +52 -0
- package/cpp/coin_config.h.in +12 -0
- package/cpp/coins/block_index.cpp +33 -0
- package/cpp/coins/block_index.h +35 -0
- package/cpp/coins/btc/chainparams.cpp +70 -0
- package/cpp/coins/btc/chainparams.h +23 -0
- package/cpp/coins/btc/interface.h +30 -0
- package/cpp/coins/btc_base/interface.cpp +2200 -0
- package/cpp/coins/btc_base/interface.h +225 -0
- package/cpp/coins/btc_base/primitives.cpp +560 -0
- package/cpp/coins/btc_base/primitives.h +157 -0
- package/cpp/coins/btc_base/psbt.cpp +150 -0
- package/cpp/coins/btc_base/psbt.h +52 -0
- package/cpp/coins/btc_base/script.cpp +304 -0
- package/cpp/coins/btc_base/script.h +181 -0
- package/cpp/coins/chainparams.cpp +47 -0
- package/cpp/coins/chainparams.h +58 -0
- package/cpp/coins/firo/chainparams.cpp +52 -0
- package/cpp/coins/firo/chainparams.h +24 -0
- package/cpp/coins/firo/firo.cpp +118 -0
- package/cpp/coins/firo/firo.h +79 -0
- package/cpp/coins/firo/primitives.cpp +109 -0
- package/cpp/coins/firo/primitives.h +47 -0
- package/cpp/coins/interface.cpp +1815 -0
- package/cpp/coins/interface.h +554 -0
- package/cpp/coins/ltc/chainparams.cpp +70 -0
- package/cpp/coins/ltc/chainparams.h +22 -0
- package/cpp/coins/ltc/ltc.cpp +69 -0
- package/cpp/coins/ltc/ltc.h +82 -0
- package/cpp/coins/ltc/primitives.cpp +20 -0
- package/cpp/coins/ltc/primitives.h +18 -0
- package/cpp/coins/part/chainparams.cpp +89 -0
- package/cpp/coins/part/chainparams.h +47 -0
- package/cpp/coins/part/part.cpp +905 -0
- package/cpp/coins/part/part.h +164 -0
- package/cpp/coins/part/primitives.cpp +548 -0
- package/cpp/coins/part/primitives.h +187 -0
- package/cpp/coins/part/stake.cpp +330 -0
- package/cpp/coins/part/stake.h +92 -0
- package/cpp/coins/primitives.h +125 -0
- package/cpp/coins/registry.cpp +99 -0
- package/cpp/coins/registry.h +32 -0
- package/cpp/coins/script.h +18 -0
- package/cpp/coins/types.cpp +60 -0
- package/cpp/coins/types.h +41 -0
- package/cpp/coins/xmr/chainparams.cpp +28 -0
- package/cpp/coins/xmr/chainparams.h +24 -0
- package/cpp/coins/xmr/tx.cpp +670 -0
- package/cpp/coins/xmr/tx.h +77 -0
- package/cpp/coins/xmr/xmr.cpp +639 -0
- package/cpp/coins/xmr/xmr.h +223 -0
- package/cpp/compat/byteswap.h +74 -0
- package/cpp/compat/endian.h +98 -0
- package/cpp/compat/mbedtls/threading_alt.h +20 -0
- package/cpp/compat/sockets.h +160 -0
- package/cpp/contrib/mbedtls/CMakeLists.txt +566 -0
- package/cpp/contrib/mbedtls/LICENSE +553 -0
- package/cpp/contrib/mbedtls/cmake/MbedTLSConfig.cmake.in +3 -0
- package/cpp/contrib/mbedtls/doxygen/input/doc_encdec.h +52 -0
- package/cpp/contrib/mbedtls/doxygen/input/doc_hashing.h +30 -0
- package/cpp/contrib/mbedtls/doxygen/input/doc_mainpage.h +52 -0
- package/cpp/contrib/mbedtls/doxygen/input/doc_rng.h +27 -0
- package/cpp/contrib/mbedtls/doxygen/input/doc_ssltls.h +37 -0
- package/cpp/contrib/mbedtls/doxygen/input/doc_tcpip.h +32 -0
- package/cpp/contrib/mbedtls/doxygen/input/doc_x509.h +31 -0
- package/cpp/contrib/mbedtls/doxygen/mbedtls.doxyfile +56 -0
- package/cpp/contrib/mbedtls/framework/CMakeLists.txt +1 -0
- package/cpp/contrib/mbedtls/framework/LICENSE +553 -0
- package/cpp/contrib/mbedtls/include/CMakeLists.txt +21 -0
- package/cpp/contrib/mbedtls/include/mbedtls/build_info.h +93 -0
- package/cpp/contrib/mbedtls/include/mbedtls/debug.h +120 -0
- package/cpp/contrib/mbedtls/include/mbedtls/error.h +39 -0
- package/cpp/contrib/mbedtls/include/mbedtls/mbedtls_config.h +1189 -0
- package/cpp/contrib/mbedtls/include/mbedtls/net_sockets.h +299 -0
- package/cpp/contrib/mbedtls/include/mbedtls/oid.h +304 -0
- package/cpp/contrib/mbedtls/include/mbedtls/pkcs7.h +250 -0
- package/cpp/contrib/mbedtls/include/mbedtls/private/config_adjust_ssl.h +84 -0
- package/cpp/contrib/mbedtls/include/mbedtls/private/config_adjust_x509.h +35 -0
- package/cpp/contrib/mbedtls/include/mbedtls/ssl.h +5622 -0
- package/cpp/contrib/mbedtls/include/mbedtls/ssl_cache.h +187 -0
- package/cpp/contrib/mbedtls/include/mbedtls/ssl_ciphersuites.h +303 -0
- package/cpp/contrib/mbedtls/include/mbedtls/ssl_cookie.h +90 -0
- package/cpp/contrib/mbedtls/include/mbedtls/ssl_ticket.h +186 -0
- package/cpp/contrib/mbedtls/include/mbedtls/timing.h +105 -0
- package/cpp/contrib/mbedtls/include/mbedtls/version.h +69 -0
- package/cpp/contrib/mbedtls/include/mbedtls/x509.h +503 -0
- package/cpp/contrib/mbedtls/include/mbedtls/x509_crl.h +180 -0
- package/cpp/contrib/mbedtls/include/mbedtls/x509_crt.h +1174 -0
- package/cpp/contrib/mbedtls/include/mbedtls/x509_csr.h +368 -0
- package/cpp/contrib/mbedtls/library/CMakeLists.txt +375 -0
- package/cpp/contrib/mbedtls/library/Makefile +334 -0
- package/cpp/contrib/mbedtls/library/debug.c +285 -0
- package/cpp/contrib/mbedtls/library/debug_internal.h +108 -0
- package/cpp/contrib/mbedtls/library/error.c +505 -0
- package/cpp/contrib/mbedtls/library/mbedtls_check_config.h +376 -0
- package/cpp/contrib/mbedtls/library/mbedtls_common.h +51 -0
- package/cpp/contrib/mbedtls/library/mbedtls_config.c +40 -0
- package/cpp/contrib/mbedtls/library/mbedtls_config_check_before.h +1769 -0
- package/cpp/contrib/mbedtls/library/mbedtls_config_check_final.h +12 -0
- package/cpp/contrib/mbedtls/library/mbedtls_config_check_user.h +2436 -0
- package/cpp/contrib/mbedtls/library/mbedtls_platform_requirements.h +55 -0
- package/cpp/contrib/mbedtls/library/mbedtls_utils.h +23 -0
- package/cpp/contrib/mbedtls/library/mps_common.h +181 -0
- package/cpp/contrib/mbedtls/library/mps_error.h +89 -0
- package/cpp/contrib/mbedtls/library/mps_reader.c +538 -0
- package/cpp/contrib/mbedtls/library/mps_reader.h +366 -0
- package/cpp/contrib/mbedtls/library/mps_trace.c +112 -0
- package/cpp/contrib/mbedtls/library/mps_trace.h +154 -0
- package/cpp/contrib/mbedtls/library/net_sockets.c +684 -0
- package/cpp/contrib/mbedtls/library/pkcs7.c +784 -0
- package/cpp/contrib/mbedtls/library/ssl_cache.c +409 -0
- package/cpp/contrib/mbedtls/library/ssl_ciphersuites.c +996 -0
- package/cpp/contrib/mbedtls/library/ssl_ciphersuites_internal.h +108 -0
- package/cpp/contrib/mbedtls/library/ssl_client.c +1019 -0
- package/cpp/contrib/mbedtls/library/ssl_client.h +18 -0
- package/cpp/contrib/mbedtls/library/ssl_cookie.c +251 -0
- package/cpp/contrib/mbedtls/library/ssl_debug_helpers.h +83 -0
- package/cpp/contrib/mbedtls/library/ssl_debug_helpers_generated.c +243 -0
- package/cpp/contrib/mbedtls/library/ssl_misc.h +2851 -0
- package/cpp/contrib/mbedtls/library/ssl_msg.c +6275 -0
- package/cpp/contrib/mbedtls/library/ssl_ticket.c +453 -0
- package/cpp/contrib/mbedtls/library/ssl_tls.c +9048 -0
- package/cpp/contrib/mbedtls/library/ssl_tls12_client.c +3054 -0
- package/cpp/contrib/mbedtls/library/ssl_tls12_server.c +3546 -0
- package/cpp/contrib/mbedtls/library/ssl_tls13_client.c +3202 -0
- package/cpp/contrib/mbedtls/library/ssl_tls13_generic.c +1773 -0
- package/cpp/contrib/mbedtls/library/ssl_tls13_invasive.h +23 -0
- package/cpp/contrib/mbedtls/library/ssl_tls13_keys.c +1860 -0
- package/cpp/contrib/mbedtls/library/ssl_tls13_keys.h +668 -0
- package/cpp/contrib/mbedtls/library/ssl_tls13_server.c +3602 -0
- package/cpp/contrib/mbedtls/library/timing.c +76 -0
- package/cpp/contrib/mbedtls/library/version.c +30 -0
- package/cpp/contrib/mbedtls/library/version_features.c +244 -0
- package/cpp/contrib/mbedtls/library/x509.c +1848 -0
- package/cpp/contrib/mbedtls/library/x509_create.c +747 -0
- package/cpp/contrib/mbedtls/library/x509_crl.c +701 -0
- package/cpp/contrib/mbedtls/library/x509_crt.c +3278 -0
- package/cpp/contrib/mbedtls/library/x509_csr.c +642 -0
- package/cpp/contrib/mbedtls/library/x509_internal.h +97 -0
- package/cpp/contrib/mbedtls/library/x509_oid.c +603 -0
- package/cpp/contrib/mbedtls/library/x509_oid.h +150 -0
- package/cpp/contrib/mbedtls/library/x509write.c +171 -0
- package/cpp/contrib/mbedtls/library/x509write_crt.c +637 -0
- package/cpp/contrib/mbedtls/library/x509write_csr.c +317 -0
- package/cpp/contrib/mbedtls/pkgconfig/CMakeLists.txt +25 -0
- package/cpp/contrib/mbedtls/pkgconfig/JoinPaths.cmake +27 -0
- package/cpp/contrib/mbedtls/pkgconfig/mbedcrypto.pc.in +10 -0
- package/cpp/contrib/mbedtls/pkgconfig/mbedtls.pc.in +11 -0
- package/cpp/contrib/mbedtls/pkgconfig/mbedx509.pc.in +11 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/CMakeLists.txt +584 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/LICENSE +552 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/cmake/TF-PSA-CryptoConfig.cmake.in +3 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/CMakeLists.txt +193 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/alignment.h +700 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/check_crypto_config.h +111 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/crypto-library.make +57 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto.c +9820 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_client.c +22 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_core.h +972 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_core_common.h +52 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_driver_wrappers.h +3395 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_driver_wrappers_no_static.c +247 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_invasive.h +85 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_its.h +131 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_random.c +168 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_random.h +72 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_random_impl.h +215 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_slot_management.c +998 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_slot_management.h +330 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_storage.c +400 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_crypto_storage.h +201 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_its_file.c +254 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/psa_util.c +295 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_check_config.h +598 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_common.h +628 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config.c +72 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config_check_before.h +12 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config_check_final.h +12 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_config_check_user.h +1220 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_platform_requirements.h +62 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/core/tf_psa_crypto_version.c +28 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/dispatch/psa_crypto_driver_wrappers_no_static.h +31 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/doxygen/input/doc_mainpage.h.in +51 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/doxygen/tfpsacrypto.doxyfile.in +54 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/CMakeLists.txt +142 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/CMakeLists.txt +3 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/aes.h +607 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/aria.h +342 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/bignum.h +1137 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/block_cipher.h +76 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/camellia.h +302 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ccm.h +523 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/chacha20.h +230 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/chachapoly.h +339 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/cipher.h +1173 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/cmac.h +209 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/config_adjust_test_accelerators.h +111 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_adjust_config_enable_builtins.h +820 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_adjust_config_tweak_builtins.h +203 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_builtin_composites.h +278 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_builtin_key_derivation.h +120 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/crypto_builtin_primitives.h +136 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ctr_drbg.h +554 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ecdsa.h +667 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ecjpake.h +296 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ecp.h +1452 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/entropy.h +253 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/error_common.h +79 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/gcm.h +382 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/hmac_drbg.h +426 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/md5.h +169 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/pkcs5.h +123 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/poly1305.h +165 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/ripemd160.h +120 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/rsa.h +821 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha1.h +196 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha256.h +180 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha3.h +189 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private/sha512.h +188 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/include/mbedtls/private_access.h +53 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aes.c +2236 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesce.c +624 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesce.h +135 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesni.c +846 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aesni.h +162 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/aria.c +966 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum.c +2635 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core.c +1242 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core.h +885 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_core_invasive.h +38 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_internal.h +164 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod.c +394 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod.h +452 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod_raw.c +276 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod_raw.h +416 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bignum_mod_raw_invasive.h +34 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/block_cipher.c +207 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/block_cipher_internal.h +99 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/bn_mul.h +1094 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/camellia.c +1055 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ccm.c +773 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chacha20.c +576 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chacha20_neon.c +294 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chacha20_neon.h +62 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/chachapoly.c +479 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher.c +1126 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_invasive.h +28 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_wrap.c +1937 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cipher_wrap.h +173 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/cmac.c +911 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ctr.h +35 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ctr_drbg.c +1017 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecdsa.c +826 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecjpake.c +1206 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp.c +3478 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp_curves.c +4798 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ecp_invasive.h +220 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy.c +677 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy_poll.c +89 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/entropy_poll.h +44 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/gcm.c +1314 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/hmac_drbg.c +639 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/md5.c +419 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/md_psa.h +26 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/poly1305.c +488 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_aead.c +648 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_aead.h +499 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_cipher.c +752 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_cipher.h +314 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.c +921 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ecp.h +516 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ffdh.c +781 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_ffdh.h +131 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_hash.c +458 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_hash.h +211 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_mac.c +495 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_mac.h +264 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_pake.c +568 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_pake.h +159 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_rsa.c +698 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_rsa.h +321 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_xof.c +149 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_crypto_xof.h +155 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_util_internal.c +282 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/psa_util_internal.h +132 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/ripemd160.c +482 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa.c +2720 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_alt_helpers.c +294 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_alt_helpers.h +185 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_internal.h +172 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/rsa_invasive.h +57 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha1.c +473 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha256.c +956 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha3.c +951 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/builtin/src/sha512.c +1089 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/driver.cmake +54 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/CMakeLists.txt +45 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/Makefile.inc +5 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/README.md +5 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/Hacl_Curve25519.h +25 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib/FStar_UInt128.h +124 -0
- 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
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlib.h +29 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/c_endianness.h +206 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/builtin.h +16 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/callconv.h +48 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/compat.h +34 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/debug.h +57 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/target.h +102 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/types.h +61 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/kremlin/internal/wasmsupport.h +5 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/vs2013/Hacl_Curve25519.h +21 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/include/tf-psa-crypto/private/everest/x25519.h +48 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/Hacl_Curve25519.c +760 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/Hacl_Curve25519_joined.c +50 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/kremlib/FStar_UInt128_extracted.c +413 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/kremlib/FStar_UInt64_FStar_UInt32_FStar_UInt16_FStar_UInt8.c +100 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/legacy/Hacl_Curve25519.c +805 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/everest/library/x25519.c +52 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/CMakeLists.txt +36 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/Makefile.inc +5 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/README.md +4 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m/README.md +544 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m/p256-m.c +1514 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m/p256-m.h +135 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m_driver_entrypoints.c +312 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/p256-m/p256-m_driver_entrypoints.h +219 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/CMakeLists.txt +14 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/Makefile.inc +6 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/include/tf-psa-crypto/private/crypto_struct_pqcp.h +52 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/fips202_psa.h +117 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/pqcp-config.h +68 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/psa_crypto_mldsa.c +528 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/psa_crypto_mldsa.h +301 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/wrap_mldsa_native.c +66 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/drivers/pqcp/src/wrap_mldsa_native.h +37 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/CMakeLists.txt +3 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/lmots.c +768 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/lmots.h +272 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/lms.c +772 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/md.c +1182 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/md_wrap.h +46 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/nist_kw.c +458 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk.c +1464 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_ecc.c +175 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_internal.h +188 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_rsa.c +106 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_wrap.c +667 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pk_wrap.h +101 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pkparse.c +1351 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pkwrite.c +574 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/extras/pkwrite.h +101 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/framework/CMakeLists.txt +1 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/framework/LICENSE +553 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/CMakeLists.txt +41 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/asn1.h +623 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/asn1write.h +397 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/base64.h +81 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/compat-3-crypto.h +43 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/constant_time.h +36 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/lms.h +431 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/md.h +538 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/memory_buffer_alloc.h +142 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/nist_kw.h +106 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/pem.h +157 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/pk.h +888 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/platform.h +513 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/platform_time.h +79 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/platform_util.h +197 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/private/pk_private.h +150 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/psa_util.h +199 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/mbedtls/threading.h +412 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto.h +6082 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_compat.h +74 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_config.h +2073 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_common.h +42 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_contexts_composites.h +182 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_contexts_key_derivation.h +54 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_contexts_primitives.h +135 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_driver_random.h +49 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_extra.h +2115 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_platform.h +94 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_sizes.h +1301 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_struct.h +682 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_types.h +466 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/psa/crypto_values.h +2827 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/build_info.h +193 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_auto_enabled.h +23 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_dependencies.h +58 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_derived.h +135 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_key_pair_types.h +93 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_support.h +211 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/private/crypto_adjust_config_synonyms.h +41 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/include/tf-psa-crypto/version.h +44 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/objlib.cmake +71 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/pkgconfig/CMakeLists.txt +15 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/pkgconfig/JoinPaths.cmake +27 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/pkgconfig/tfpsacrypto.pc.in +10 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/platform/CMakeLists.txt +3 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/platform/memory_buffer_alloc.c +751 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/platform/platform.c +362 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/platform/platform_util.c +428 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/platform/threading.c +311 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/platform/threading_internal.h +75 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/CMakeLists.txt +3 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/asn1parse.c +483 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/asn1write.c +465 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/base64.c +322 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/base64_internal.h +45 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/constant_time.c +247 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/constant_time_impl.h +514 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/constant_time_internal.h +540 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/crypto_oid.h +354 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/oid.c +469 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/pem.c +458 -0
- package/cpp/contrib/mbedtls/tf-psa-crypto/utilities/pkcs5.c +475 -0
- package/cpp/contrib/monero/LICENSE +41 -0
- package/cpp/contrib/monero/bsx/common/perf_timer.h +15 -0
- package/cpp/contrib/monero/bsx/common/threadpool.h +43 -0
- package/cpp/contrib/monero/bsx/hex.h +25 -0
- package/cpp/contrib/monero/bsx/misc_log_ex.h +61 -0
- package/cpp/contrib/monero/bsx/random.cpp +20 -0
- package/cpp/contrib/monero/contrib/epee/include/int-util.h +320 -0
- package/cpp/contrib/monero/contrib/epee/include/memwipe.h +81 -0
- package/cpp/contrib/monero/contrib/epee/include/misc_language.h +109 -0
- package/cpp/contrib/monero/contrib/epee/include/mlocker.h +89 -0
- package/cpp/contrib/monero/contrib/epee/include/span.h +189 -0
- package/cpp/contrib/monero/contrib/epee/include/warnings.h +31 -0
- package/cpp/contrib/monero/contrib/epee/src/memwipe.c +115 -0
- package/cpp/contrib/monero/contrib/epee/src/mlocker.cpp +197 -0
- package/cpp/contrib/monero/src/common/aligned.c +139 -0
- package/cpp/contrib/monero/src/common/aligned.h +42 -0
- package/cpp/contrib/monero/src/common/base58.cpp +259 -0
- package/cpp/contrib/monero/src/common/base58.h +46 -0
- package/cpp/contrib/monero/src/common/pod-class.h +43 -0
- package/cpp/contrib/monero/src/common/varint.h +138 -0
- package/cpp/contrib/monero/src/crypto/chacha.h +96 -0
- package/cpp/contrib/monero/src/crypto/crypto-ops-data.c +881 -0
- package/cpp/contrib/monero/src/crypto/crypto-ops.c +3891 -0
- package/cpp/contrib/monero/src/crypto/crypto-ops.h +167 -0
- package/cpp/contrib/monero/src/crypto/crypto.cpp +792 -0
- package/cpp/contrib/monero/src/crypto/crypto.h +359 -0
- package/cpp/contrib/monero/src/crypto/generic-ops.h +103 -0
- package/cpp/contrib/monero/src/crypto/hash-ops.h +105 -0
- package/cpp/contrib/monero/src/crypto/hash.c +57 -0
- package/cpp/contrib/monero/src/crypto/hash.h +110 -0
- package/cpp/contrib/monero/src/crypto/keccak.c +239 -0
- package/cpp/contrib/monero/src/crypto/keccak.h +40 -0
- package/cpp/contrib/monero/src/crypto/random.h +46 -0
- package/cpp/contrib/monero/src/crypto/tree-hash.c +257 -0
- package/cpp/contrib/monero/src/crypto/wallet/crypto.h +57 -0
- package/cpp/contrib/monero/src/crypto/wallet/ops.h +32 -0
- package/cpp/contrib/monero/src/cryptonote_config.h +365 -0
- package/cpp/contrib/monero/src/device/device.cpp +105 -0
- package/cpp/contrib/monero/src/device/device.hpp +274 -0
- package/cpp/contrib/monero/src/device/device_default.cpp +343 -0
- package/cpp/contrib/monero/src/device/device_default.hpp +156 -0
- package/cpp/contrib/monero/src/ringct/bulletproofs.cc +1097 -0
- package/cpp/contrib/monero/src/ringct/bulletproofs.h +51 -0
- package/cpp/contrib/monero/src/ringct/bulletproofs_plus.cc +1120 -0
- package/cpp/contrib/monero/src/ringct/bulletproofs_plus.h +49 -0
- package/cpp/contrib/monero/src/ringct/multiexp.cc +708 -0
- package/cpp/contrib/monero/src/ringct/multiexp.h +72 -0
- package/cpp/contrib/monero/src/ringct/rctCryptoOps.c +221 -0
- package/cpp/contrib/monero/src/ringct/rctCryptoOps.h +37 -0
- package/cpp/contrib/monero/src/ringct/rctOps.cpp +727 -0
- package/cpp/contrib/monero/src/ringct/rctOps.h +191 -0
- package/cpp/contrib/monero/src/ringct/rctSigs.cpp +1652 -0
- package/cpp/contrib/monero/src/ringct/rctSigs.h +143 -0
- package/cpp/contrib/monero/src/ringct/rctTypes.cpp +338 -0
- package/cpp/contrib/monero/src/ringct/rctTypes.h +842 -0
- package/cpp/contrib/monero/src/serialization/binary_archive.h +243 -0
- package/cpp/contrib/monero/src/serialization/container.h +146 -0
- package/cpp/contrib/monero/src/serialization/containers.h +127 -0
- package/cpp/contrib/monero/src/serialization/crypto.h +97 -0
- package/cpp/contrib/monero/src/serialization/debug_archive.h +53 -0
- package/cpp/contrib/monero/src/serialization/json_archive.h +193 -0
- package/cpp/contrib/monero/src/serialization/serialization.h +328 -0
- package/cpp/contrib/monero/src/serialization/variant.h +50 -0
- package/cpp/contrib/nlohmann/LICENSE.MIT +21 -0
- package/cpp/contrib/nlohmann/json.hpp +25526 -0
- package/cpp/contrib/nlohmann/json_fwd.hpp +187 -0
- package/cpp/contrib/notes.txt +96 -0
- package/cpp/contrib/secp256k1/CHANGELOG.md +214 -0
- package/cpp/contrib/secp256k1/CMakeLists.txt +392 -0
- package/cpp/contrib/secp256k1/CMakePresets.json +18 -0
- package/cpp/contrib/secp256k1/CONTRIBUTING.md +111 -0
- package/cpp/contrib/secp256k1/COPYING +19 -0
- package/cpp/contrib/secp256k1/Makefile.am +332 -0
- package/cpp/contrib/secp256k1/README.md +176 -0
- package/cpp/contrib/secp256k1/SECURITY.md +15 -0
- package/cpp/contrib/secp256k1/autogen.sh +3 -0
- package/cpp/contrib/secp256k1/ci/ci.sh +147 -0
- package/cpp/contrib/secp256k1/ci/linux-debian.Dockerfile +84 -0
- package/cpp/contrib/secp256k1/ci/travis.sh +68 -0
- package/cpp/contrib/secp256k1/cmake/CheckArm32Assembly.cmake +6 -0
- package/cpp/contrib/secp256k1/cmake/CheckMemorySanitizer.cmake +18 -0
- package/cpp/contrib/secp256k1/cmake/CheckStringOptionValue.cmake +10 -0
- package/cpp/contrib/secp256k1/cmake/CheckX86_64Assembly.cmake +15 -0
- package/cpp/contrib/secp256k1/cmake/DiscoverTests.cmake +71 -0
- package/cpp/contrib/secp256k1/cmake/FindValgrind.cmake +41 -0
- package/cpp/contrib/secp256k1/cmake/GeneratePkgConfigFile.cmake +8 -0
- package/cpp/contrib/secp256k1/cmake/TryAppendCFlags.cmake +24 -0
- package/cpp/contrib/secp256k1/cmake/arm-linux-gnueabihf.toolchain.cmake +3 -0
- package/cpp/contrib/secp256k1/cmake/config.cmake.in +5 -0
- package/cpp/contrib/secp256k1/cmake/source_arm32.s +9 -0
- package/cpp/contrib/secp256k1/cmake/x86_64-w64-mingw32.toolchain.cmake +3 -0
- package/cpp/contrib/secp256k1/configure.ac +590 -0
- package/cpp/contrib/secp256k1/contrib/lax_der_parsing.c +148 -0
- package/cpp/contrib/secp256k1/contrib/lax_der_parsing.h +97 -0
- package/cpp/contrib/secp256k1/contrib/lax_der_privatekey_parsing.c +112 -0
- package/cpp/contrib/secp256k1/contrib/lax_der_privatekey_parsing.h +95 -0
- package/cpp/contrib/secp256k1/doc/ellswift.md +483 -0
- package/cpp/contrib/secp256k1/doc/musig.md +54 -0
- package/cpp/contrib/secp256k1/doc/release-process.md +94 -0
- package/cpp/contrib/secp256k1/doc/safegcd_implementation.md +819 -0
- package/cpp/contrib/secp256k1/examples/CMakeLists.txt +33 -0
- package/cpp/contrib/secp256k1/examples/EXAMPLES_COPYING +121 -0
- package/cpp/contrib/secp256k1/examples/ecdh.c +121 -0
- package/cpp/contrib/secp256k1/examples/ecdsa.c +138 -0
- package/cpp/contrib/secp256k1/examples/ellswift.c +122 -0
- package/cpp/contrib/secp256k1/examples/examples_util.h +108 -0
- package/cpp/contrib/secp256k1/examples/musig.c +261 -0
- package/cpp/contrib/secp256k1/examples/schnorr.c +154 -0
- package/cpp/contrib/secp256k1/include/secp256k1.h +877 -0
- package/cpp/contrib/secp256k1/include/secp256k1_dleag.h +150 -0
- package/cpp/contrib/secp256k1/include/secp256k1_ecdh.h +63 -0
- package/cpp/contrib/secp256k1/include/secp256k1_ecdsaotves.h +55 -0
- package/cpp/contrib/secp256k1/include/secp256k1_ed25519.h +239 -0
- package/cpp/contrib/secp256k1/include/secp256k1_ellswift.h +200 -0
- package/cpp/contrib/secp256k1/include/secp256k1_extrakeys.h +250 -0
- package/cpp/contrib/secp256k1/include/secp256k1_generator.h +106 -0
- package/cpp/contrib/secp256k1/include/secp256k1_hash.h +45 -0
- package/cpp/contrib/secp256k1/include/secp256k1_musig.h +588 -0
- package/cpp/contrib/secp256k1/include/secp256k1_preallocated.h +134 -0
- package/cpp/contrib/secp256k1/include/secp256k1_recovery.h +123 -0
- package/cpp/contrib/secp256k1/include/secp256k1_schnorrsig.h +190 -0
- package/cpp/contrib/secp256k1/include/visibility.h +58 -0
- package/cpp/contrib/secp256k1/libsecp256k1.pc.in +12 -0
- package/cpp/contrib/secp256k1/sage/gen_exhaustive_groups.sage +156 -0
- package/cpp/contrib/secp256k1/sage/gen_split_lambda_constants.sage +123 -0
- package/cpp/contrib/secp256k1/sage/group_prover.sage +353 -0
- package/cpp/contrib/secp256k1/sage/prove_group_implementations.sage +285 -0
- package/cpp/contrib/secp256k1/sage/secp256k1_params.sage +39 -0
- package/cpp/contrib/secp256k1/sage/weierstrass_prover.sage +275 -0
- package/cpp/contrib/secp256k1/src/CMakeLists.txt +253 -0
- package/cpp/contrib/secp256k1/src/asm/field_10x26_arm.s +916 -0
- package/cpp/contrib/secp256k1/src/assumptions.h +87 -0
- package/cpp/contrib/secp256k1/src/checkmem.h +117 -0
- package/cpp/contrib/secp256k1/src/ecdsa.h +21 -0
- package/cpp/contrib/secp256k1/src/ecdsa_impl.h +312 -0
- package/cpp/contrib/secp256k1/src/eckey.h +28 -0
- package/cpp/contrib/secp256k1/src/eckey_impl.h +94 -0
- package/cpp/contrib/secp256k1/src/ecmult.h +64 -0
- package/cpp/contrib/secp256k1/src/ecmult_compute_table.h +16 -0
- package/cpp/contrib/secp256k1/src/ecmult_compute_table_impl.h +49 -0
- package/cpp/contrib/secp256k1/src/ecmult_const.h +38 -0
- package/cpp/contrib/secp256k1/src/ecmult_const_impl.h +402 -0
- package/cpp/contrib/secp256k1/src/ecmult_gen.h +144 -0
- package/cpp/contrib/secp256k1/src/ecmult_gen_compute_table.h +14 -0
- package/cpp/contrib/secp256k1/src/ecmult_gen_compute_table_impl.h +108 -0
- package/cpp/contrib/secp256k1/src/ecmult_gen_impl.h +341 -0
- package/cpp/contrib/secp256k1/src/ecmult_impl.h +869 -0
- package/cpp/contrib/secp256k1/src/field.h +354 -0
- package/cpp/contrib/secp256k1/src/field_10x26.h +57 -0
- package/cpp/contrib/secp256k1/src/field_10x26_impl.h +1234 -0
- package/cpp/contrib/secp256k1/src/field_5x52.h +62 -0
- package/cpp/contrib/secp256k1/src/field_5x52_impl.h +524 -0
- package/cpp/contrib/secp256k1/src/field_5x52_int128_impl.h +274 -0
- package/cpp/contrib/secp256k1/src/field_impl.h +462 -0
- package/cpp/contrib/secp256k1/src/group.h +224 -0
- package/cpp/contrib/secp256k1/src/group_impl.h +1024 -0
- package/cpp/contrib/secp256k1/src/hash.h +54 -0
- package/cpp/contrib/secp256k1/src/hash_impl.h +360 -0
- package/cpp/contrib/secp256k1/src/hsort.h +33 -0
- package/cpp/contrib/secp256k1/src/hsort_impl.h +125 -0
- package/cpp/contrib/secp256k1/src/int128.h +90 -0
- package/cpp/contrib/secp256k1/src/int128_impl.h +18 -0
- package/cpp/contrib/secp256k1/src/int128_native.h +19 -0
- package/cpp/contrib/secp256k1/src/int128_native_impl.h +94 -0
- package/cpp/contrib/secp256k1/src/int128_struct.h +14 -0
- package/cpp/contrib/secp256k1/src/int128_struct_impl.h +205 -0
- package/cpp/contrib/secp256k1/src/modinv32.h +43 -0
- package/cpp/contrib/secp256k1/src/modinv32_impl.h +725 -0
- package/cpp/contrib/secp256k1/src/modinv64.h +47 -0
- package/cpp/contrib/secp256k1/src/modinv64_impl.h +780 -0
- package/cpp/contrib/secp256k1/src/modules/dleag/Makefile.am.include +3 -0
- package/cpp/contrib/secp256k1/src/modules/dleag/main_impl.h +1073 -0
- package/cpp/contrib/secp256k1/src/modules/dleag/tests_impl.h +68 -0
- package/cpp/contrib/secp256k1/src/modules/ecdh/Makefile.am.include +5 -0
- package/cpp/contrib/secp256k1/src/modules/ecdh/bench_impl.h +54 -0
- package/cpp/contrib/secp256k1/src/modules/ecdh/main_impl.h +79 -0
- package/cpp/contrib/secp256k1/src/modules/ecdh/tests_impl.h +218 -0
- package/cpp/contrib/secp256k1/src/modules/ecdsaotves/Makefile.am.include +3 -0
- package/cpp/contrib/secp256k1/src/modules/ecdsaotves/main_impl.h +365 -0
- package/cpp/contrib/secp256k1/src/modules/ecdsaotves/tests_impl.h +49 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/Makefile.am.include +16 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/common.h +68 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/core_ed25519.h +229 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/main_impl.h +98 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/common.h +21 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/ed25519_ref10.h +2698 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/ed25519_ref10_fe_25_5.h +1056 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/ed25519_ref10_fe_51.h +518 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/base.h +1344 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/base2.h +40 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/constants.h +40 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/ref10/fe_25_5/fe.h +220 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/scalarmult_ed25519_ref10.h +417 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/sha512/hash_sha512.h +14 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/sha512/hash_sha512_cp.h +287 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/tests_impl.h +109 -0
- package/cpp/contrib/secp256k1/src/modules/ed25519/utils.h +97 -0
- package/cpp/contrib/secp256k1/src/modules/ellswift/Makefile.am.include +5 -0
- package/cpp/contrib/secp256k1/src/modules/ellswift/bench_impl.h +106 -0
- package/cpp/contrib/secp256k1/src/modules/ellswift/main_impl.h +581 -0
- package/cpp/contrib/secp256k1/src/modules/ellswift/tests_exhaustive_impl.h +39 -0
- package/cpp/contrib/secp256k1/src/modules/ellswift/tests_impl.h +544 -0
- package/cpp/contrib/secp256k1/src/modules/extrakeys/Makefile.am.include +4 -0
- package/cpp/contrib/secp256k1/src/modules/extrakeys/main_impl.h +285 -0
- package/cpp/contrib/secp256k1/src/modules/extrakeys/tests_exhaustive_impl.h +68 -0
- package/cpp/contrib/secp256k1/src/modules/extrakeys/tests_impl.h +484 -0
- package/cpp/contrib/secp256k1/src/modules/generator/Makefile.am.include +9 -0
- package/cpp/contrib/secp256k1/src/modules/generator/main_impl.h +271 -0
- package/cpp/contrib/secp256k1/src/modules/generator/tests_impl.h +227 -0
- package/cpp/contrib/secp256k1/src/modules/musig/Makefile.am.include +8 -0
- package/cpp/contrib/secp256k1/src/modules/musig/keyagg.h +32 -0
- package/cpp/contrib/secp256k1/src/modules/musig/keyagg_impl.h +275 -0
- package/cpp/contrib/secp256k1/src/modules/musig/main_impl.h +12 -0
- package/cpp/contrib/secp256k1/src/modules/musig/session.h +24 -0
- package/cpp/contrib/secp256k1/src/modules/musig/session_impl.h +795 -0
- package/cpp/contrib/secp256k1/src/modules/musig/tests_impl.h +1161 -0
- package/cpp/contrib/secp256k1/src/modules/musig/vectors.h +346 -0
- package/cpp/contrib/secp256k1/src/modules/recovery/Makefile.am.include +5 -0
- package/cpp/contrib/secp256k1/src/modules/recovery/bench_impl.h +62 -0
- package/cpp/contrib/secp256k1/src/modules/recovery/main_impl.h +159 -0
- package/cpp/contrib/secp256k1/src/modules/recovery/tests_exhaustive_impl.h +148 -0
- package/cpp/contrib/secp256k1/src/modules/recovery/tests_impl.h +339 -0
- package/cpp/contrib/secp256k1/src/modules/schnorrsig/Makefile.am.include +5 -0
- package/cpp/contrib/secp256k1/src/modules/schnorrsig/bench_impl.h +104 -0
- package/cpp/contrib/secp256k1/src/modules/schnorrsig/main_impl.h +263 -0
- package/cpp/contrib/secp256k1/src/modules/schnorrsig/tests_exhaustive_impl.h +214 -0
- package/cpp/contrib/secp256k1/src/modules/schnorrsig/tests_impl.h +1010 -0
- package/cpp/contrib/secp256k1/src/precompute_ecmult.c +91 -0
- package/cpp/contrib/secp256k1/src/precompute_ecmult_gen.c +101 -0
- package/cpp/contrib/secp256k1/src/precomputed_ecmult.c +16456 -0
- package/cpp/contrib/secp256k1/src/precomputed_ecmult.h +40 -0
- package/cpp/contrib/secp256k1/src/precomputed_ecmult_gen.c +1779 -0
- package/cpp/contrib/secp256k1/src/precomputed_ecmult_gen.h +28 -0
- package/cpp/contrib/secp256k1/src/scalar.h +108 -0
- package/cpp/contrib/secp256k1/src/scalar_4x64.h +19 -0
- package/cpp/contrib/secp256k1/src/scalar_4x64_impl.h +1010 -0
- package/cpp/contrib/secp256k1/src/scalar_8x32.h +19 -0
- package/cpp/contrib/secp256k1/src/scalar_8x32_impl.h +830 -0
- package/cpp/contrib/secp256k1/src/scalar_impl.h +321 -0
- package/cpp/contrib/secp256k1/src/scalar_low.h +24 -0
- package/cpp/contrib/secp256k1/src/scalar_low_impl.h +215 -0
- package/cpp/contrib/secp256k1/src/scratch.h +44 -0
- package/cpp/contrib/secp256k1/src/scratch_impl.h +99 -0
- package/cpp/contrib/secp256k1/src/secp256k1.c +896 -0
- package/cpp/contrib/secp256k1/src/selftest.h +35 -0
- package/cpp/contrib/secp256k1/src/testrand.h +45 -0
- package/cpp/contrib/secp256k1/src/testrand_impl.h +162 -0
- package/cpp/contrib/secp256k1/src/testutil.h +161 -0
- package/cpp/contrib/secp256k1/src/unit_test.c +479 -0
- package/cpp/contrib/secp256k1/src/unit_test.h +147 -0
- package/cpp/contrib/secp256k1/src/util.h +469 -0
- package/cpp/contrib/secp256k1/src/util_local_visibility.h +12 -0
- package/cpp/contrib/secp256k1/tools/check-abi.sh +67 -0
- package/cpp/contrib/secp256k1/tools/symbol-check.py +72 -0
- package/cpp/contrib/secp256k1/tools/test_vectors_musig2_generate.py +656 -0
- package/cpp/contrib/secp256k1/tools/tests_wycheproof_generate_ecdh.py +166 -0
- package/cpp/contrib/secp256k1/tools/tests_wycheproof_generate_ecdsa.py +111 -0
- package/cpp/contrib/secp256k1/tools/wycheproof_utils.py +12 -0
- package/cpp/contrib/secp256k1/wasm/test_module.html +320 -0
- package/cpp/contrib/secp256k1/wasm/wrap.cpp +331 -0
- package/cpp/contrib/sqlite3.h +14349 -0
- package/cpp/contrib/sqlite3mc_amalgamation.c +369890 -0
- package/cpp/contrib/sqlite3mc_amalgamation.h +15548 -0
- package/cpp/contrib/unilib/uninorms.cpp +393 -0
- package/cpp/contrib/unilib/uninorms.h +56 -0
- package/cpp/contrib/unilib/utf8.cpp +78 -0
- package/cpp/contrib/unilib/utf8.h +260 -0
- package/cpp/contrib/update_mbedtls.sh +85 -0
- package/cpp/crypto/aes.cpp +141 -0
- package/cpp/crypto/aes.h +67 -0
- package/cpp/crypto/chacha20.cpp +342 -0
- package/cpp/crypto/chacha20.h +82 -0
- package/cpp/crypto/chacha20poly1305.cpp +91 -0
- package/cpp/crypto/chacha20poly1305.h +46 -0
- package/cpp/crypto/common.h +85 -0
- package/cpp/crypto/ctaes/COPYING +21 -0
- package/cpp/crypto/ctaes/README.md +41 -0
- package/cpp/crypto/ctaes/bench.c +170 -0
- package/cpp/crypto/ctaes/ctaes.c +556 -0
- package/cpp/crypto/ctaes/ctaes.h +41 -0
- package/cpp/crypto/ctaes/test.c +110 -0
- package/cpp/crypto/extkey.cpp +257 -0
- package/cpp/crypto/extkey.h +66 -0
- package/cpp/crypto/hmac_sha512.cpp +37 -0
- package/cpp/crypto/hmac_sha512.h +32 -0
- package/cpp/crypto/merkle.cpp +47 -0
- package/cpp/crypto/merkle.h +20 -0
- package/cpp/crypto/poly1305.cpp +223 -0
- package/cpp/crypto/poly1305.h +59 -0
- package/cpp/crypto/ripemd160.cpp +292 -0
- package/cpp/crypto/ripemd160.h +28 -0
- package/cpp/crypto/scrypt-sse2.cpp +141 -0
- package/cpp/crypto/scrypt.cpp +336 -0
- package/cpp/crypto/scrypt.h +49 -0
- package/cpp/crypto/sealed_key.cpp +62 -0
- package/cpp/crypto/sealed_key.h +34 -0
- package/cpp/crypto/secure_bytes.h +16 -0
- package/cpp/crypto/sha512.cpp +206 -0
- package/cpp/crypto/sha512.h +29 -0
- package/cpp/crypto/util.cpp +77 -0
- package/cpp/crypto/util.h +32 -0
- package/cpp/debug_rpc.cpp +703 -0
- package/cpp/debug_rpc.h +63 -0
- package/cpp/electrum.cpp +931 -0
- package/cpp/electrum.h +169 -0
- package/cpp/engine/xmr_engine.cpp +463 -0
- package/cpp/engine/xmr_engine.h +84 -0
- package/cpp/engine/xmr_engine_c.cpp +141 -0
- package/cpp/engine/xmr_engine_c.h +35 -0
- package/cpp/fees.cpp +270 -0
- package/cpp/fees.h +60 -0
- package/cpp/height_search.cpp +64 -0
- package/cpp/height_search.h +27 -0
- package/cpp/main.cpp +146 -0
- package/cpp/messages_npb.cpp +701 -0
- package/cpp/messages_npb.h +667 -0
- package/cpp/mnemonic/mnemonic.cpp +715 -0
- package/cpp/mnemonic/mnemonic.h +52 -0
- package/cpp/mnemonic/wordlists/english.h +1103 -0
- package/cpp/mnemonic/wordlists/japanese.h +2212 -0
- package/cpp/network/bridge.cpp +232 -0
- package/cpp/network/bridge.h +115 -0
- package/cpp/network/ca_roots.cpp +114 -0
- package/cpp/network/ca_roots.h +12 -0
- package/cpp/network/http_client.cpp +261 -0
- package/cpp/network/http_client.h +33 -0
- package/cpp/network/pem.cpp +84 -0
- package/cpp/network/pem.h +22 -0
- package/cpp/network/psa_user_config.h +15 -0
- package/cpp/network/socks5.cpp +180 -0
- package/cpp/network/socks5.h +26 -0
- package/cpp/network/tls_transport.cpp +502 -0
- package/cpp/network/tls_transport.h +62 -0
- package/cpp/network/transport.cpp +169 -0
- package/cpp/network/transport.h +115 -0
- package/cpp/network/url.cpp +88 -0
- package/cpp/network/url.h +25 -0
- package/cpp/network/websocket.cpp +253 -0
- package/cpp/network/websocket.h +68 -0
- package/cpp/network/ws_transport.cpp +361 -0
- package/cpp/network/ws_transport.h +72 -0
- package/cpp/node_client.cpp +1196 -0
- package/cpp/node_client.h +209 -0
- package/cpp/node_scan.h +35 -0
- package/cpp/schema.cpp +1249 -0
- package/cpp/schema.h +132 -0
- package/cpp/smsg.cpp +453 -0
- package/cpp/smsg.h +43 -0
- package/cpp/support/allocators/secure.h +85 -0
- package/cpp/support/cleanse.cpp +35 -0
- package/cpp/support/cleanse.h +15 -0
- package/cpp/support/coop.cpp +319 -0
- package/cpp/support/coop.h +157 -0
- package/cpp/support/lockedpool.cpp +406 -0
- package/cpp/support/lockedpool.h +240 -0
- package/cpp/uint256.cpp +62 -0
- package/cpp/uint256.h +121 -0
- package/cpp/util/base58.cpp +181 -0
- package/cpp/util/base58.h +45 -0
- package/cpp/util/bech32.cpp +578 -0
- package/cpp/util/bech32.h +96 -0
- package/cpp/util/debug.cpp +23 -0
- package/cpp/util/debug.h +12 -0
- package/cpp/util/int.cpp +118 -0
- package/cpp/util/int.h +18 -0
- package/cpp/util/json.h +26 -0
- package/cpp/util/log.cpp +137 -0
- package/cpp/util/log.h +37 -0
- package/cpp/util/mutex.h +89 -0
- package/cpp/util/platform.cpp +90 -0
- package/cpp/util/platform.h +17 -0
- package/cpp/util/random.cpp +136 -0
- package/cpp/util/random.h +28 -0
- package/cpp/util/rpc.cpp +192 -0
- package/cpp/util/rpc.h +454 -0
- package/cpp/util/str.cpp +254 -0
- package/cpp/util/str.h +54 -0
- package/cpp/util/thread.cpp +17 -0
- package/cpp/util/thread.h +12 -0
- package/cpp/util/time.cpp +30 -0
- package/cpp/util/time.h +30 -0
- package/cpp/util/tinyformat.h +1163 -0
- package/cpp/util/vector.h +83 -0
- package/cpp/version.h.in +12 -0
- package/cpp/view_key_chain.h +283 -0
- package/cpp/wallet/account_wallet.cpp +668 -0
- package/cpp/wallet/account_wallet.h +136 -0
- package/cpp/wallet/base_wallet.cpp +302 -0
- package/cpp/wallet/base_wallet.h +129 -0
- package/cpp/wallet/debug_wallet.cpp +40 -0
- package/cpp/wallet/debug_wallet.h +36 -0
- package/cpp/wallet/encrypted_seed.cpp +96 -0
- package/cpp/wallet/encrypted_seed.h +41 -0
- package/cpp/wallet/host_wallet.cpp +85 -0
- package/cpp/wallet/host_wallet.h +51 -0
- package/cpp/wallet/native_wallet.cpp +34 -0
- package/cpp/wallet/native_wallet.h +28 -0
- package/cpp/wallet/xmr/account_wallet.cpp +803 -0
- package/cpp/wallet/xmr/account_wallet.h +139 -0
- package/cpp/wallet/xmr/builder.cpp +568 -0
- package/cpp/wallet/xmr/builder.h +65 -0
- package/cpp/wallet/xmr/chain.cpp +1437 -0
- package/cpp/wallet/xmr/chain.h +213 -0
- package/cpp/wallet/xmr/daemon.cpp +583 -0
- package/cpp/wallet/xmr/daemon.h +153 -0
- package/cpp/wallet/xmr/decoys.cpp +197 -0
- package/cpp/wallet/xmr/decoys.h +64 -0
- package/cpp/wallet/xmr/epee.cpp +448 -0
- package/cpp/wallet/xmr/epee.h +25 -0
- package/cpp/wallet/xmr/fee.cpp +169 -0
- package/cpp/wallet/xmr/fee.h +61 -0
- package/cpp/wallet/xmr/reserve_proof.cpp +169 -0
- package/cpp/wallet/xmr/reserve_proof.h +24 -0
- package/cpp/wallet/xmr/scanner.cpp +860 -0
- package/cpp/wallet/xmr/scanner.h +239 -0
- package/lib/commonjs/NativeNitroBSX.js +128 -0
- package/lib/commonjs/NativeNitroBSX.js.map +1 -0
- package/lib/commonjs/format.js +21 -0
- package/lib/commonjs/format.js.map +1 -0
- package/lib/commonjs/index.js +50 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/service.js +75 -0
- package/lib/commonjs/service.js.map +1 -0
- package/lib/commonjs/specs/NitroBSX.nitro.js +6 -0
- package/lib/commonjs/specs/NitroBSX.nitro.js.map +1 -0
- package/lib/module/NativeNitroBSX.js +124 -0
- package/lib/module/NativeNitroBSX.js.map +1 -0
- package/lib/module/format.js +15 -0
- package/lib/module/format.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/service.js +66 -0
- package/lib/module/service.js.map +1 -0
- package/lib/module/specs/NitroBSX.nitro.js +4 -0
- package/lib/module/specs/NitroBSX.nitro.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeNitroBSX.d.ts +94 -0
- package/lib/typescript/commonjs/src/NativeNitroBSX.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/format.d.ts +3 -0
- package/lib/typescript/commonjs/src/format.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/service.d.ts +28 -0
- package/lib/typescript/commonjs/src/service.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/NitroBSX.nitro.d.ts +251 -0
- package/lib/typescript/commonjs/src/specs/NitroBSX.nitro.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeNitroBSX.d.ts +94 -0
- package/lib/typescript/module/src/NativeNitroBSX.d.ts.map +1 -0
- package/lib/typescript/module/src/format.d.ts +3 -0
- package/lib/typescript/module/src/format.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +5 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/service.d.ts +28 -0
- package/lib/typescript/module/src/service.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/NitroBSX.nitro.d.ts +251 -0
- package/lib/typescript/module/src/specs/NitroBSX.nitro.d.ts.map +1 -0
- package/nitro.json +19 -0
- package/nitrogen/generated/android/NitroBSX+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroBSX+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroBSXOnLoad.cpp +49 -0
- package/nitrogen/generated/android/NitroBSXOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrobsx/NitroBSXOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroBSX+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroBSX-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/NitroBSX-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/NitroBSX-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/NitroBSXAutolinking.mm +35 -0
- package/nitrogen/generated/ios/NitroBSXAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/HybridNitroBSXSpec.cpp +91 -0
- package/nitrogen/generated/shared/c++/HybridNitroBSXSpec.hpp +142 -0
- package/nitrogen/generated/shared/c++/NotificationPair.hpp +87 -0
- package/nitrogen/generated/shared/c++/SignOutcome.hpp +80 -0
- package/nitrogen/generated/shared/c++/SignTxResult.hpp +89 -0
- package/package.json +172 -4
- package/react-native-nitro-bsx.podspec +33 -0
- package/react-native.config.js +26 -0
- package/scripts/build-ios.sh +49 -0
- package/src/NativeNitroBSX.ts +203 -0
- package/src/format.ts +14 -0
- package/src/index.ts +4 -0
- package/src/service.ts +77 -0
- package/src/specs/NitroBSX.nitro.ts +300 -0
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The LM-OTS one-time public-key signature scheme
|
|
3
|
+
*
|
|
4
|
+
* Copyright The Mbed TLS Contributors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* The following sources were referenced in the design of this implementation
|
|
10
|
+
* of the LM-OTS algorithm:
|
|
11
|
+
*
|
|
12
|
+
* [1] IETF RFC8554
|
|
13
|
+
* D. McGrew, M. Curcio, S.Fluhrer
|
|
14
|
+
* https://datatracker.ietf.org/doc/html/rfc8554
|
|
15
|
+
*
|
|
16
|
+
* [2] NIST Special Publication 800-208
|
|
17
|
+
* David A. Cooper et. al.
|
|
18
|
+
* https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-208.pdf
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#include "tf_psa_crypto_common.h"
|
|
22
|
+
|
|
23
|
+
#if defined(MBEDTLS_LMS_C)
|
|
24
|
+
|
|
25
|
+
#include <string.h>
|
|
26
|
+
|
|
27
|
+
#include "lmots.h"
|
|
28
|
+
|
|
29
|
+
#include "mbedtls/lms.h"
|
|
30
|
+
#include "mbedtls/platform_util.h"
|
|
31
|
+
#include "mbedtls/private/error_common.h"
|
|
32
|
+
#include "psa_util_internal.h"
|
|
33
|
+
|
|
34
|
+
#include "psa/crypto.h"
|
|
35
|
+
|
|
36
|
+
/* Define a local translating function to save code size by not using too many
|
|
37
|
+
* arguments in each translating place. */
|
|
38
|
+
static int local_err_translation(psa_status_t status)
|
|
39
|
+
{
|
|
40
|
+
return psa_status_to_mbedtls(status, psa_to_lms_errors,
|
|
41
|
+
ARRAY_LENGTH(psa_to_lms_errors),
|
|
42
|
+
psa_generic_status_to_mbedtls);
|
|
43
|
+
}
|
|
44
|
+
#define PSA_TO_MBEDTLS_ERR(status) local_err_translation(status)
|
|
45
|
+
|
|
46
|
+
#define PUBLIC_KEY_TYPE_OFFSET (0)
|
|
47
|
+
#define PUBLIC_KEY_I_KEY_ID_OFFSET (PUBLIC_KEY_TYPE_OFFSET + \
|
|
48
|
+
MBEDTLS_LMOTS_TYPE_LEN)
|
|
49
|
+
#define PUBLIC_KEY_Q_LEAF_ID_OFFSET (PUBLIC_KEY_I_KEY_ID_OFFSET + \
|
|
50
|
+
MBEDTLS_LMOTS_I_KEY_ID_LEN)
|
|
51
|
+
#define PUBLIC_KEY_KEY_HASH_OFFSET (PUBLIC_KEY_Q_LEAF_ID_OFFSET + \
|
|
52
|
+
MBEDTLS_LMOTS_Q_LEAF_ID_LEN)
|
|
53
|
+
|
|
54
|
+
/* We only support parameter sets that use 8-bit digits, as it does not require
|
|
55
|
+
* translation logic between digits and bytes */
|
|
56
|
+
#define W_WINTERNITZ_PARAMETER (8u)
|
|
57
|
+
#define CHECKSUM_LEN (2)
|
|
58
|
+
#define I_DIGIT_IDX_LEN (2)
|
|
59
|
+
#define J_HASH_IDX_LEN (1)
|
|
60
|
+
#define D_CONST_LEN (2)
|
|
61
|
+
|
|
62
|
+
#define DIGIT_MAX_VALUE ((1u << W_WINTERNITZ_PARAMETER) - 1u)
|
|
63
|
+
|
|
64
|
+
#define D_CONST_LEN (2)
|
|
65
|
+
static const unsigned char D_PUBLIC_CONSTANT_BYTES[D_CONST_LEN] = { 0x80, 0x80 };
|
|
66
|
+
static const unsigned char D_MESSAGE_CONSTANT_BYTES[D_CONST_LEN] = { 0x81, 0x81 };
|
|
67
|
+
|
|
68
|
+
#if defined(MBEDTLS_TEST_HOOKS)
|
|
69
|
+
int (*mbedtls_lmots_sign_private_key_invalidated_hook)(unsigned char *) = NULL;
|
|
70
|
+
#endif /* defined(MBEDTLS_TEST_HOOKS) */
|
|
71
|
+
|
|
72
|
+
/* Calculate the checksum digits that are appended to the end of the LMOTS digit
|
|
73
|
+
* string. See NIST SP800-208 section 3.1 or RFC8554 Algorithm 2 for details of
|
|
74
|
+
* the checksum algorithm.
|
|
75
|
+
*
|
|
76
|
+
* params The LMOTS parameter set, I and q values which
|
|
77
|
+
* describe the key being used.
|
|
78
|
+
*
|
|
79
|
+
* digest The digit string to create the digest from. As
|
|
80
|
+
* this does not contain a checksum, it is the same
|
|
81
|
+
* size as a hash output.
|
|
82
|
+
*/
|
|
83
|
+
static unsigned short lmots_checksum_calculate(const mbedtls_lmots_parameters_t *params,
|
|
84
|
+
const unsigned char *digest)
|
|
85
|
+
{
|
|
86
|
+
size_t idx;
|
|
87
|
+
unsigned sum = 0;
|
|
88
|
+
|
|
89
|
+
for (idx = 0; idx < MBEDTLS_LMOTS_N_HASH_LEN(params->type); idx++) {
|
|
90
|
+
sum += DIGIT_MAX_VALUE - digest[idx];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return sum;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Create the string of digest digits (in the base determined by the Winternitz
|
|
97
|
+
* parameter with the checksum appended to the end (Q || cksm(Q)). See NIST
|
|
98
|
+
* SP800-208 section 3.1 or RFC8554 Algorithm 3 step 5 (also used in Algorithm
|
|
99
|
+
* 4b step 3) for details.
|
|
100
|
+
*
|
|
101
|
+
* params The LMOTS parameter set, I and q values which
|
|
102
|
+
* describe the key being used.
|
|
103
|
+
*
|
|
104
|
+
* msg The message that will be hashed to create the
|
|
105
|
+
* digest.
|
|
106
|
+
*
|
|
107
|
+
* msg_size The size of the message.
|
|
108
|
+
*
|
|
109
|
+
* C_random_value The random value that will be combined with the
|
|
110
|
+
* message digest. This is always the same size as a
|
|
111
|
+
* hash output for whichever hash algorithm is
|
|
112
|
+
* determined by the parameter set.
|
|
113
|
+
*
|
|
114
|
+
* output An output containing the digit string (+
|
|
115
|
+
* checksum) of length P digits (in the case of
|
|
116
|
+
* MBEDTLS_LMOTS_SHA256_N32_W8, this means it is of
|
|
117
|
+
* size P bytes).
|
|
118
|
+
*/
|
|
119
|
+
static int create_digit_array_with_checksum(const mbedtls_lmots_parameters_t *params,
|
|
120
|
+
const unsigned char *msg,
|
|
121
|
+
size_t msg_len,
|
|
122
|
+
const unsigned char *C_random_value,
|
|
123
|
+
unsigned char *out)
|
|
124
|
+
{
|
|
125
|
+
psa_hash_operation_t op = PSA_HASH_OPERATION_INIT;
|
|
126
|
+
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
|
127
|
+
size_t output_hash_len;
|
|
128
|
+
unsigned short checksum;
|
|
129
|
+
|
|
130
|
+
status = psa_hash_setup(&op, PSA_ALG_SHA_256);
|
|
131
|
+
if (status != PSA_SUCCESS) {
|
|
132
|
+
goto exit;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
status = psa_hash_update(&op, params->I_key_identifier,
|
|
136
|
+
MBEDTLS_LMOTS_I_KEY_ID_LEN);
|
|
137
|
+
if (status != PSA_SUCCESS) {
|
|
138
|
+
goto exit;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
status = psa_hash_update(&op, params->q_leaf_identifier,
|
|
142
|
+
MBEDTLS_LMOTS_Q_LEAF_ID_LEN);
|
|
143
|
+
if (status != PSA_SUCCESS) {
|
|
144
|
+
goto exit;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
status = psa_hash_update(&op, D_MESSAGE_CONSTANT_BYTES, D_CONST_LEN);
|
|
148
|
+
if (status != PSA_SUCCESS) {
|
|
149
|
+
goto exit;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
status = psa_hash_update(&op, C_random_value,
|
|
153
|
+
MBEDTLS_LMOTS_C_RANDOM_VALUE_LEN(params->type));
|
|
154
|
+
if (status != PSA_SUCCESS) {
|
|
155
|
+
goto exit;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
status = psa_hash_update(&op, msg, msg_len);
|
|
159
|
+
if (status != PSA_SUCCESS) {
|
|
160
|
+
goto exit;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
status = psa_hash_finish(&op, out,
|
|
164
|
+
MBEDTLS_LMOTS_N_HASH_LEN(params->type),
|
|
165
|
+
&output_hash_len);
|
|
166
|
+
if (status != PSA_SUCCESS) {
|
|
167
|
+
goto exit;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
checksum = lmots_checksum_calculate(params, out);
|
|
171
|
+
MBEDTLS_PUT_UINT16_BE(checksum, out, MBEDTLS_LMOTS_N_HASH_LEN(params->type));
|
|
172
|
+
|
|
173
|
+
exit:
|
|
174
|
+
psa_hash_abort(&op);
|
|
175
|
+
|
|
176
|
+
return PSA_TO_MBEDTLS_ERR(status);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Hash each element of the string of digits (+ checksum), producing a hash
|
|
180
|
+
* output for each element. This is used in several places (by varying the
|
|
181
|
+
* hash_idx_min/max_values) in order to calculate a public key from a private
|
|
182
|
+
* key (RFC8554 Algorithm 1 step 4), in order to sign a message (RFC8554
|
|
183
|
+
* Algorithm 3 step 5), and to calculate a public key candidate from a
|
|
184
|
+
* signature and message (RFC8554 Algorithm 4b step 3).
|
|
185
|
+
*
|
|
186
|
+
* params The LMOTS parameter set, I and q values which
|
|
187
|
+
* describe the key being used.
|
|
188
|
+
*
|
|
189
|
+
* x_digit_array The array of digits (of size P, 34 in the case of
|
|
190
|
+
* MBEDTLS_LMOTS_SHA256_N32_W8).
|
|
191
|
+
*
|
|
192
|
+
* hash_idx_min_values An array of the starting values of the j iterator
|
|
193
|
+
* for each of the members of the digit array. If
|
|
194
|
+
* this value in NULL, then all iterators will start
|
|
195
|
+
* at 0.
|
|
196
|
+
*
|
|
197
|
+
* hash_idx_max_values An array of the upper bound values of the j
|
|
198
|
+
* iterator for each of the members of the digit
|
|
199
|
+
* array. If this value in NULL, then iterator is
|
|
200
|
+
* bounded to be less than 2^w - 1 (255 in the case
|
|
201
|
+
* of MBEDTLS_LMOTS_SHA256_N32_W8)
|
|
202
|
+
*
|
|
203
|
+
* output An array containing a hash output for each member
|
|
204
|
+
* of the digit string P. In the case of
|
|
205
|
+
* MBEDTLS_LMOTS_SHA256_N32_W8, this is of size 32 *
|
|
206
|
+
* 34.
|
|
207
|
+
*/
|
|
208
|
+
static int hash_digit_array(const mbedtls_lmots_parameters_t *params,
|
|
209
|
+
const unsigned char *x_digit_array,
|
|
210
|
+
const unsigned char *hash_idx_min_values,
|
|
211
|
+
const unsigned char *hash_idx_max_values,
|
|
212
|
+
unsigned char *output)
|
|
213
|
+
{
|
|
214
|
+
unsigned int i_digit_idx;
|
|
215
|
+
unsigned char i_digit_idx_bytes[I_DIGIT_IDX_LEN];
|
|
216
|
+
unsigned int j_hash_idx;
|
|
217
|
+
unsigned char j_hash_idx_bytes[J_HASH_IDX_LEN];
|
|
218
|
+
unsigned int j_hash_idx_min;
|
|
219
|
+
unsigned int j_hash_idx_max;
|
|
220
|
+
psa_hash_operation_t op = PSA_HASH_OPERATION_INIT;
|
|
221
|
+
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
|
222
|
+
size_t output_hash_len;
|
|
223
|
+
unsigned char tmp_hash[MBEDTLS_LMOTS_N_HASH_LEN_MAX];
|
|
224
|
+
|
|
225
|
+
for (i_digit_idx = 0;
|
|
226
|
+
i_digit_idx < MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(params->type);
|
|
227
|
+
i_digit_idx++) {
|
|
228
|
+
|
|
229
|
+
memcpy(tmp_hash,
|
|
230
|
+
&x_digit_array[i_digit_idx * MBEDTLS_LMOTS_N_HASH_LEN(params->type)],
|
|
231
|
+
MBEDTLS_LMOTS_N_HASH_LEN(params->type));
|
|
232
|
+
|
|
233
|
+
j_hash_idx_min = hash_idx_min_values != NULL ?
|
|
234
|
+
hash_idx_min_values[i_digit_idx] : 0;
|
|
235
|
+
j_hash_idx_max = hash_idx_max_values != NULL ?
|
|
236
|
+
hash_idx_max_values[i_digit_idx] : DIGIT_MAX_VALUE;
|
|
237
|
+
|
|
238
|
+
for (j_hash_idx = j_hash_idx_min;
|
|
239
|
+
j_hash_idx < j_hash_idx_max;
|
|
240
|
+
j_hash_idx++) {
|
|
241
|
+
status = psa_hash_setup(&op, PSA_ALG_SHA_256);
|
|
242
|
+
if (status != PSA_SUCCESS) {
|
|
243
|
+
goto exit;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
status = psa_hash_update(&op,
|
|
247
|
+
params->I_key_identifier,
|
|
248
|
+
MBEDTLS_LMOTS_I_KEY_ID_LEN);
|
|
249
|
+
if (status != PSA_SUCCESS) {
|
|
250
|
+
goto exit;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
status = psa_hash_update(&op,
|
|
254
|
+
params->q_leaf_identifier,
|
|
255
|
+
MBEDTLS_LMOTS_Q_LEAF_ID_LEN);
|
|
256
|
+
if (status != PSA_SUCCESS) {
|
|
257
|
+
goto exit;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
MBEDTLS_PUT_UINT16_BE(i_digit_idx, i_digit_idx_bytes, 0);
|
|
261
|
+
status = psa_hash_update(&op, i_digit_idx_bytes, I_DIGIT_IDX_LEN);
|
|
262
|
+
if (status != PSA_SUCCESS) {
|
|
263
|
+
goto exit;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
j_hash_idx_bytes[0] = (uint8_t) j_hash_idx;
|
|
267
|
+
status = psa_hash_update(&op, j_hash_idx_bytes, J_HASH_IDX_LEN);
|
|
268
|
+
if (status != PSA_SUCCESS) {
|
|
269
|
+
goto exit;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
status = psa_hash_update(&op, tmp_hash,
|
|
273
|
+
MBEDTLS_LMOTS_N_HASH_LEN(params->type));
|
|
274
|
+
if (status != PSA_SUCCESS) {
|
|
275
|
+
goto exit;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
status = psa_hash_finish(&op, tmp_hash, sizeof(tmp_hash),
|
|
279
|
+
&output_hash_len);
|
|
280
|
+
if (status != PSA_SUCCESS) {
|
|
281
|
+
goto exit;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
psa_hash_abort(&op);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
memcpy(&output[i_digit_idx * MBEDTLS_LMOTS_N_HASH_LEN(params->type)],
|
|
288
|
+
tmp_hash, MBEDTLS_LMOTS_N_HASH_LEN(params->type));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
exit:
|
|
292
|
+
psa_hash_abort(&op);
|
|
293
|
+
mbedtls_platform_zeroize(tmp_hash, sizeof(tmp_hash));
|
|
294
|
+
|
|
295
|
+
return PSA_TO_MBEDTLS_ERR(status);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* Combine the hashes of the digit array into a public key. This is used in
|
|
299
|
+
* in order to calculate a public key from a private key (RFC8554 Algorithm 1
|
|
300
|
+
* step 4), and to calculate a public key candidate from a signature and message
|
|
301
|
+
* (RFC8554 Algorithm 4b step 3).
|
|
302
|
+
*
|
|
303
|
+
* params The LMOTS parameter set, I and q values which describe
|
|
304
|
+
* the key being used.
|
|
305
|
+
* y_hashed_digits The array of hashes, one hash for each digit of the
|
|
306
|
+
* symbol array (which is of size P, 34 in the case of
|
|
307
|
+
* MBEDTLS_LMOTS_SHA256_N32_W8)
|
|
308
|
+
*
|
|
309
|
+
* pub_key The output public key (or candidate public key in
|
|
310
|
+
* case this is being run as part of signature
|
|
311
|
+
* verification), in the form of a hash output.
|
|
312
|
+
*/
|
|
313
|
+
static int public_key_from_hashed_digit_array(const mbedtls_lmots_parameters_t *params,
|
|
314
|
+
const unsigned char *y_hashed_digits,
|
|
315
|
+
unsigned char *pub_key)
|
|
316
|
+
{
|
|
317
|
+
psa_hash_operation_t op = PSA_HASH_OPERATION_INIT;
|
|
318
|
+
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
|
319
|
+
size_t output_hash_len;
|
|
320
|
+
|
|
321
|
+
status = psa_hash_setup(&op, PSA_ALG_SHA_256);
|
|
322
|
+
if (status != PSA_SUCCESS) {
|
|
323
|
+
goto exit;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
status = psa_hash_update(&op,
|
|
327
|
+
params->I_key_identifier,
|
|
328
|
+
MBEDTLS_LMOTS_I_KEY_ID_LEN);
|
|
329
|
+
if (status != PSA_SUCCESS) {
|
|
330
|
+
goto exit;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
status = psa_hash_update(&op, params->q_leaf_identifier,
|
|
334
|
+
MBEDTLS_LMOTS_Q_LEAF_ID_LEN);
|
|
335
|
+
if (status != PSA_SUCCESS) {
|
|
336
|
+
goto exit;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
status = psa_hash_update(&op, D_PUBLIC_CONSTANT_BYTES, D_CONST_LEN);
|
|
340
|
+
if (status != PSA_SUCCESS) {
|
|
341
|
+
goto exit;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
status = psa_hash_update(&op, y_hashed_digits,
|
|
345
|
+
MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(params->type) *
|
|
346
|
+
MBEDTLS_LMOTS_N_HASH_LEN(params->type));
|
|
347
|
+
if (status != PSA_SUCCESS) {
|
|
348
|
+
goto exit;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
status = psa_hash_finish(&op, pub_key,
|
|
352
|
+
MBEDTLS_LMOTS_N_HASH_LEN(params->type),
|
|
353
|
+
&output_hash_len);
|
|
354
|
+
if (status != PSA_SUCCESS) {
|
|
355
|
+
|
|
356
|
+
exit:
|
|
357
|
+
psa_hash_abort(&op);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return PSA_TO_MBEDTLS_ERR(status);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
void mbedtls_lmots_public_init(mbedtls_lmots_public_t *ctx)
|
|
364
|
+
{
|
|
365
|
+
memset(ctx, 0, sizeof(*ctx));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
void mbedtls_lmots_public_free(mbedtls_lmots_public_t *ctx)
|
|
369
|
+
{
|
|
370
|
+
if (ctx == NULL) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
mbedtls_platform_zeroize(ctx, sizeof(*ctx));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
int mbedtls_lmots_import_public_key(mbedtls_lmots_public_t *ctx,
|
|
378
|
+
const unsigned char *key, size_t key_len)
|
|
379
|
+
{
|
|
380
|
+
if (key_len < MBEDTLS_LMOTS_SIG_TYPE_OFFSET + MBEDTLS_LMOTS_TYPE_LEN) {
|
|
381
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
uint32_t type = MBEDTLS_GET_UINT32_BE(key, MBEDTLS_LMOTS_SIG_TYPE_OFFSET);
|
|
385
|
+
if (type != (uint32_t) MBEDTLS_LMOTS_SHA256_N32_W8) {
|
|
386
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
387
|
+
}
|
|
388
|
+
ctx->params.type = (mbedtls_lmots_algorithm_type_t) type;
|
|
389
|
+
|
|
390
|
+
if (key_len != MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type)) {
|
|
391
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
memcpy(ctx->params.I_key_identifier,
|
|
395
|
+
key + PUBLIC_KEY_I_KEY_ID_OFFSET,
|
|
396
|
+
MBEDTLS_LMOTS_I_KEY_ID_LEN);
|
|
397
|
+
|
|
398
|
+
memcpy(ctx->params.q_leaf_identifier,
|
|
399
|
+
key + PUBLIC_KEY_Q_LEAF_ID_OFFSET,
|
|
400
|
+
MBEDTLS_LMOTS_Q_LEAF_ID_LEN);
|
|
401
|
+
|
|
402
|
+
memcpy(ctx->public_key,
|
|
403
|
+
key + PUBLIC_KEY_KEY_HASH_OFFSET,
|
|
404
|
+
MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type));
|
|
405
|
+
|
|
406
|
+
ctx->have_public_key = 1;
|
|
407
|
+
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
int mbedtls_lmots_export_public_key(const mbedtls_lmots_public_t *ctx,
|
|
412
|
+
unsigned char *key, size_t key_size,
|
|
413
|
+
size_t *key_len)
|
|
414
|
+
{
|
|
415
|
+
if (key_size < MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type)) {
|
|
416
|
+
return MBEDTLS_ERR_LMS_BUFFER_TOO_SMALL;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (!ctx->have_public_key) {
|
|
420
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
MBEDTLS_PUT_UINT32_BE(ctx->params.type, key, MBEDTLS_LMOTS_SIG_TYPE_OFFSET);
|
|
424
|
+
|
|
425
|
+
memcpy(key + PUBLIC_KEY_I_KEY_ID_OFFSET,
|
|
426
|
+
ctx->params.I_key_identifier,
|
|
427
|
+
MBEDTLS_LMOTS_I_KEY_ID_LEN);
|
|
428
|
+
|
|
429
|
+
memcpy(key + PUBLIC_KEY_Q_LEAF_ID_OFFSET,
|
|
430
|
+
ctx->params.q_leaf_identifier,
|
|
431
|
+
MBEDTLS_LMOTS_Q_LEAF_ID_LEN);
|
|
432
|
+
|
|
433
|
+
memcpy(key + PUBLIC_KEY_KEY_HASH_OFFSET, ctx->public_key,
|
|
434
|
+
MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type));
|
|
435
|
+
|
|
436
|
+
if (key_len != NULL) {
|
|
437
|
+
*key_len = MBEDTLS_LMOTS_PUBLIC_KEY_LEN(ctx->params.type);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return 0;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
int mbedtls_lmots_calculate_public_key_candidate(const mbedtls_lmots_parameters_t *params,
|
|
444
|
+
const unsigned char *msg,
|
|
445
|
+
size_t msg_size,
|
|
446
|
+
const unsigned char *sig,
|
|
447
|
+
size_t sig_size,
|
|
448
|
+
unsigned char *out,
|
|
449
|
+
size_t out_size,
|
|
450
|
+
size_t *out_len)
|
|
451
|
+
{
|
|
452
|
+
unsigned char tmp_digit_array[MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT_MAX];
|
|
453
|
+
unsigned char y_hashed_digits[MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT_MAX][MBEDTLS_LMOTS_N_HASH_LEN_MAX];
|
|
454
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
455
|
+
|
|
456
|
+
if (msg == NULL && msg_size != 0) {
|
|
457
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
if (sig_size != MBEDTLS_LMOTS_SIG_LEN(params->type) ||
|
|
461
|
+
out_size < MBEDTLS_LMOTS_N_HASH_LEN(params->type)) {
|
|
462
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
ret = create_digit_array_with_checksum(params, msg, msg_size,
|
|
466
|
+
sig + MBEDTLS_LMOTS_SIG_C_RANDOM_OFFSET,
|
|
467
|
+
tmp_digit_array);
|
|
468
|
+
if (ret) {
|
|
469
|
+
return ret;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
ret = hash_digit_array(params,
|
|
473
|
+
sig + MBEDTLS_LMOTS_SIG_SIGNATURE_OFFSET(params->type),
|
|
474
|
+
tmp_digit_array, NULL, (unsigned char *) y_hashed_digits);
|
|
475
|
+
if (ret) {
|
|
476
|
+
return ret;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
ret = public_key_from_hashed_digit_array(params,
|
|
480
|
+
(unsigned char *) y_hashed_digits,
|
|
481
|
+
out);
|
|
482
|
+
if (ret) {
|
|
483
|
+
return ret;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
if (out_len != NULL) {
|
|
487
|
+
*out_len = MBEDTLS_LMOTS_N_HASH_LEN(params->type);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return 0;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
int mbedtls_lmots_verify(const mbedtls_lmots_public_t *ctx,
|
|
494
|
+
const unsigned char *msg, size_t msg_size,
|
|
495
|
+
const unsigned char *sig, size_t sig_size)
|
|
496
|
+
{
|
|
497
|
+
unsigned char Kc_public_key_candidate[MBEDTLS_LMOTS_N_HASH_LEN_MAX];
|
|
498
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
499
|
+
|
|
500
|
+
if (msg == NULL && msg_size != 0) {
|
|
501
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (!ctx->have_public_key) {
|
|
505
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (ctx->params.type != MBEDTLS_LMOTS_SHA256_N32_W8) {
|
|
509
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (sig_size < MBEDTLS_LMOTS_SIG_TYPE_OFFSET + MBEDTLS_LMOTS_TYPE_LEN) {
|
|
513
|
+
return MBEDTLS_ERR_LMS_VERIFY_FAILED;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if (MBEDTLS_GET_UINT32_BE(sig, MBEDTLS_LMOTS_SIG_TYPE_OFFSET) != MBEDTLS_LMOTS_SHA256_N32_W8) {
|
|
517
|
+
return MBEDTLS_ERR_LMS_VERIFY_FAILED;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
ret = mbedtls_lmots_calculate_public_key_candidate(&ctx->params,
|
|
521
|
+
msg, msg_size, sig, sig_size,
|
|
522
|
+
Kc_public_key_candidate,
|
|
523
|
+
MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type),
|
|
524
|
+
NULL);
|
|
525
|
+
if (ret) {
|
|
526
|
+
return MBEDTLS_ERR_LMS_VERIFY_FAILED;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (memcmp(&Kc_public_key_candidate, ctx->public_key,
|
|
530
|
+
sizeof(ctx->public_key))) {
|
|
531
|
+
return MBEDTLS_ERR_LMS_VERIFY_FAILED;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return 0;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
#if defined(MBEDTLS_LMS_PRIVATE)
|
|
538
|
+
|
|
539
|
+
void mbedtls_lmots_private_init(mbedtls_lmots_private_t *ctx)
|
|
540
|
+
{
|
|
541
|
+
memset(ctx, 0, sizeof(*ctx));
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
void mbedtls_lmots_private_free(mbedtls_lmots_private_t *ctx)
|
|
545
|
+
{
|
|
546
|
+
if (ctx == NULL) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
mbedtls_platform_zeroize(ctx,
|
|
551
|
+
sizeof(*ctx));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
int mbedtls_lmots_generate_private_key(mbedtls_lmots_private_t *ctx,
|
|
555
|
+
mbedtls_lmots_algorithm_type_t type,
|
|
556
|
+
const unsigned char I_key_identifier[MBEDTLS_LMOTS_I_KEY_ID_LEN],
|
|
557
|
+
uint32_t q_leaf_identifier,
|
|
558
|
+
const unsigned char *seed,
|
|
559
|
+
size_t seed_size)
|
|
560
|
+
{
|
|
561
|
+
psa_hash_operation_t op = PSA_HASH_OPERATION_INIT;
|
|
562
|
+
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
|
563
|
+
size_t output_hash_len;
|
|
564
|
+
unsigned int i_digit_idx;
|
|
565
|
+
unsigned char i_digit_idx_bytes[2];
|
|
566
|
+
unsigned char const_bytes[1] = { 0xFF };
|
|
567
|
+
|
|
568
|
+
if (ctx->have_private_key) {
|
|
569
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if (type != MBEDTLS_LMOTS_SHA256_N32_W8) {
|
|
573
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
ctx->params.type = type;
|
|
577
|
+
|
|
578
|
+
memcpy(ctx->params.I_key_identifier,
|
|
579
|
+
I_key_identifier,
|
|
580
|
+
sizeof(ctx->params.I_key_identifier));
|
|
581
|
+
|
|
582
|
+
MBEDTLS_PUT_UINT32_BE(q_leaf_identifier, ctx->params.q_leaf_identifier, 0);
|
|
583
|
+
|
|
584
|
+
for (i_digit_idx = 0;
|
|
585
|
+
i_digit_idx < MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(ctx->params.type);
|
|
586
|
+
i_digit_idx++) {
|
|
587
|
+
status = psa_hash_setup(&op, PSA_ALG_SHA_256);
|
|
588
|
+
if (status != PSA_SUCCESS) {
|
|
589
|
+
goto exit;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
status = psa_hash_update(&op,
|
|
593
|
+
ctx->params.I_key_identifier,
|
|
594
|
+
sizeof(ctx->params.I_key_identifier));
|
|
595
|
+
if (status != PSA_SUCCESS) {
|
|
596
|
+
goto exit;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
status = psa_hash_update(&op,
|
|
600
|
+
ctx->params.q_leaf_identifier,
|
|
601
|
+
MBEDTLS_LMOTS_Q_LEAF_ID_LEN);
|
|
602
|
+
if (status != PSA_SUCCESS) {
|
|
603
|
+
goto exit;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
MBEDTLS_PUT_UINT16_BE(i_digit_idx, i_digit_idx_bytes, 0);
|
|
607
|
+
status = psa_hash_update(&op, i_digit_idx_bytes, I_DIGIT_IDX_LEN);
|
|
608
|
+
if (status != PSA_SUCCESS) {
|
|
609
|
+
goto exit;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
status = psa_hash_update(&op, const_bytes, sizeof(const_bytes));
|
|
613
|
+
if (status != PSA_SUCCESS) {
|
|
614
|
+
goto exit;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
status = psa_hash_update(&op, seed, seed_size);
|
|
618
|
+
if (status != PSA_SUCCESS) {
|
|
619
|
+
goto exit;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
status = psa_hash_finish(&op,
|
|
623
|
+
ctx->private_key[i_digit_idx],
|
|
624
|
+
MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type),
|
|
625
|
+
&output_hash_len);
|
|
626
|
+
if (status != PSA_SUCCESS) {
|
|
627
|
+
goto exit;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
psa_hash_abort(&op);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
ctx->have_private_key = 1;
|
|
634
|
+
|
|
635
|
+
exit:
|
|
636
|
+
psa_hash_abort(&op);
|
|
637
|
+
|
|
638
|
+
return PSA_TO_MBEDTLS_ERR(status);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
int mbedtls_lmots_calculate_public_key(mbedtls_lmots_public_t *ctx,
|
|
642
|
+
const mbedtls_lmots_private_t *priv_ctx)
|
|
643
|
+
{
|
|
644
|
+
unsigned char y_hashed_digits[MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT_MAX][MBEDTLS_LMOTS_N_HASH_LEN_MAX];
|
|
645
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
646
|
+
|
|
647
|
+
/* Check that a private key is loaded */
|
|
648
|
+
if (!priv_ctx->have_private_key) {
|
|
649
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
ret = hash_digit_array(&priv_ctx->params,
|
|
653
|
+
(unsigned char *) priv_ctx->private_key, NULL,
|
|
654
|
+
NULL, (unsigned char *) y_hashed_digits);
|
|
655
|
+
if (ret) {
|
|
656
|
+
goto exit;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
ret = public_key_from_hashed_digit_array(&priv_ctx->params,
|
|
660
|
+
(unsigned char *) y_hashed_digits,
|
|
661
|
+
ctx->public_key);
|
|
662
|
+
if (ret) {
|
|
663
|
+
goto exit;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
memcpy(&ctx->params, &priv_ctx->params,
|
|
667
|
+
sizeof(ctx->params));
|
|
668
|
+
|
|
669
|
+
ctx->have_public_key = 1;
|
|
670
|
+
|
|
671
|
+
exit:
|
|
672
|
+
mbedtls_platform_zeroize(y_hashed_digits, sizeof(y_hashed_digits));
|
|
673
|
+
|
|
674
|
+
return ret;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
int mbedtls_lmots_sign(mbedtls_lmots_private_t *ctx,
|
|
678
|
+
const unsigned char *msg, size_t msg_size,
|
|
679
|
+
unsigned char *sig, size_t sig_size, size_t *sig_len)
|
|
680
|
+
{
|
|
681
|
+
unsigned char tmp_digit_array[MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT_MAX];
|
|
682
|
+
/* Create a temporary buffer to prepare the signature in. This allows us to
|
|
683
|
+
* finish creating a signature (ensuring the process doesn't fail), and then
|
|
684
|
+
* erase the private key **before** writing any data into the sig parameter
|
|
685
|
+
* buffer. If data were directly written into the sig buffer, it might leak
|
|
686
|
+
* a partial signature on failure, which effectively compromises the private
|
|
687
|
+
* key.
|
|
688
|
+
*/
|
|
689
|
+
unsigned char tmp_sig[MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT_MAX][MBEDTLS_LMOTS_N_HASH_LEN_MAX];
|
|
690
|
+
unsigned char tmp_c_random[MBEDTLS_LMOTS_N_HASH_LEN_MAX];
|
|
691
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
692
|
+
|
|
693
|
+
if (msg == NULL && msg_size != 0) {
|
|
694
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
if (sig_size < MBEDTLS_LMOTS_SIG_LEN(ctx->params.type)) {
|
|
698
|
+
return MBEDTLS_ERR_LMS_BUFFER_TOO_SMALL;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/* Check that a private key is loaded */
|
|
702
|
+
if (!ctx->have_private_key) {
|
|
703
|
+
return MBEDTLS_ERR_LMS_BAD_INPUT_DATA;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
ret = psa_generate_random(tmp_c_random,
|
|
707
|
+
MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type));
|
|
708
|
+
if (ret) {
|
|
709
|
+
return ret;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
ret = create_digit_array_with_checksum(&ctx->params,
|
|
713
|
+
msg, msg_size,
|
|
714
|
+
tmp_c_random,
|
|
715
|
+
tmp_digit_array);
|
|
716
|
+
if (ret) {
|
|
717
|
+
goto exit;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
ret = hash_digit_array(&ctx->params, (unsigned char *) ctx->private_key,
|
|
721
|
+
NULL, tmp_digit_array, (unsigned char *) tmp_sig);
|
|
722
|
+
if (ret) {
|
|
723
|
+
goto exit;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
MBEDTLS_PUT_UINT32_BE(ctx->params.type, sig, MBEDTLS_LMOTS_SIG_TYPE_OFFSET);
|
|
727
|
+
|
|
728
|
+
/* Test hook to check if sig is being written to before we invalidate the
|
|
729
|
+
* private key.
|
|
730
|
+
*/
|
|
731
|
+
#if defined(MBEDTLS_TEST_HOOKS)
|
|
732
|
+
if (mbedtls_lmots_sign_private_key_invalidated_hook != NULL) {
|
|
733
|
+
ret = (*mbedtls_lmots_sign_private_key_invalidated_hook)(sig);
|
|
734
|
+
if (ret != 0) {
|
|
735
|
+
return ret;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
#endif /* defined(MBEDTLS_TEST_HOOKS) */
|
|
739
|
+
|
|
740
|
+
/* We've got a valid signature now, so it's time to make sure the private
|
|
741
|
+
* key can't be reused.
|
|
742
|
+
*/
|
|
743
|
+
ctx->have_private_key = 0;
|
|
744
|
+
mbedtls_platform_zeroize(ctx->private_key,
|
|
745
|
+
sizeof(ctx->private_key));
|
|
746
|
+
|
|
747
|
+
memcpy(sig + MBEDTLS_LMOTS_SIG_C_RANDOM_OFFSET, tmp_c_random,
|
|
748
|
+
MBEDTLS_LMOTS_C_RANDOM_VALUE_LEN(ctx->params.type));
|
|
749
|
+
|
|
750
|
+
memcpy(sig + MBEDTLS_LMOTS_SIG_SIGNATURE_OFFSET(ctx->params.type), tmp_sig,
|
|
751
|
+
MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(ctx->params.type)
|
|
752
|
+
* MBEDTLS_LMOTS_N_HASH_LEN(ctx->params.type));
|
|
753
|
+
|
|
754
|
+
if (sig_len != NULL) {
|
|
755
|
+
*sig_len = MBEDTLS_LMOTS_SIG_LEN(ctx->params.type);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
ret = 0;
|
|
759
|
+
|
|
760
|
+
exit:
|
|
761
|
+
mbedtls_platform_zeroize(tmp_digit_array, sizeof(tmp_digit_array));
|
|
762
|
+
mbedtls_platform_zeroize(tmp_sig, sizeof(tmp_sig));
|
|
763
|
+
|
|
764
|
+
return ret;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
#endif /* defined(MBEDTLS_LMS_PRIVATE) */
|
|
768
|
+
#endif /* defined(MBEDTLS_LMS_C) */
|