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,951 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FIPS-202 compliant SHA3 implementation
|
|
3
|
+
*
|
|
4
|
+
* Copyright The Mbed TLS Contributors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
|
6
|
+
*/
|
|
7
|
+
/*
|
|
8
|
+
* The SHA-3 Secure Hash Standard was published by NIST in 2015.
|
|
9
|
+
*
|
|
10
|
+
* https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.202.pdf
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
#include "tf_psa_crypto_common.h"
|
|
14
|
+
|
|
15
|
+
#if defined(MBEDTLS_SHA3_C)
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* These macros select manually unrolled implementations of parts of the main permutation function.
|
|
19
|
+
*
|
|
20
|
+
* Unrolling has a major impact on both performance and code size. gcc performance benefits a lot
|
|
21
|
+
* from manually unrolling at higher optimisation levels.
|
|
22
|
+
*
|
|
23
|
+
* Depending on your size/perf priorities, compiler and target, it may be beneficial to adjust
|
|
24
|
+
* these; the defaults here should give sensible trade-offs for gcc and clang on aarch64 and
|
|
25
|
+
* x86-64.
|
|
26
|
+
*/
|
|
27
|
+
#if !defined(MBEDTLS_SHA3_THETA_UNROLL)
|
|
28
|
+
#define MBEDTLS_SHA3_THETA_UNROLL 0 //no-check-names
|
|
29
|
+
#endif
|
|
30
|
+
#if !defined(MBEDTLS_SHA3_CHI_UNROLL)
|
|
31
|
+
#if defined(__OPTIMIZE_SIZE__)
|
|
32
|
+
#define MBEDTLS_SHA3_CHI_UNROLL 0 //no-check-names
|
|
33
|
+
#else
|
|
34
|
+
#define MBEDTLS_SHA3_CHI_UNROLL 1 //no-check-names
|
|
35
|
+
#endif
|
|
36
|
+
#endif
|
|
37
|
+
#if !defined(MBEDTLS_SHA3_PI_UNROLL)
|
|
38
|
+
#define MBEDTLS_SHA3_PI_UNROLL 1 //no-check-names
|
|
39
|
+
#endif
|
|
40
|
+
#if !defined(MBEDTLS_SHA3_RHO_UNROLL)
|
|
41
|
+
#define MBEDTLS_SHA3_RHO_UNROLL 1 //no-check-names
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
#include "mbedtls/private/sha3.h"
|
|
45
|
+
#include "mbedtls/platform_util.h"
|
|
46
|
+
#include "mbedtls/private/error_common.h"
|
|
47
|
+
|
|
48
|
+
#include <string.h>
|
|
49
|
+
|
|
50
|
+
#if defined(MBEDTLS_SELF_TEST)
|
|
51
|
+
#include "mbedtls/platform.h"
|
|
52
|
+
#endif /* MBEDTLS_SELF_TEST */
|
|
53
|
+
|
|
54
|
+
#define SHA3_XOR_BYTE 0x06
|
|
55
|
+
#define SHAKE_XOR_BYTE 0x1F
|
|
56
|
+
|
|
57
|
+
/* Precomputed masks for the iota transform.
|
|
58
|
+
*
|
|
59
|
+
* Each round uses a 64-bit mask value. In each mask values, only
|
|
60
|
+
* bits whose position is of the form 2^k-1 can be set, thus only
|
|
61
|
+
* 7 of 64 bits of the mask need to be known for each mask value.
|
|
62
|
+
*
|
|
63
|
+
* We use a compressed encoding of the mask where bits 63, 31 and 15
|
|
64
|
+
* are moved to bits 4-6. This allows us to make each mask value
|
|
65
|
+
* 1 byte rather than 8 bytes, saving 7*24 = 168 bytes of data (with
|
|
66
|
+
* perhaps a little variation due to alignment). Decompressing this
|
|
67
|
+
* requires a little code, but much less than the savings on the table.
|
|
68
|
+
*
|
|
69
|
+
* The impact on performance depends on the platform and compiler.
|
|
70
|
+
* There's a bit more computation, but less memory bandwidth. A quick
|
|
71
|
+
* benchmark on x86_64 shows a 7% speed improvement with GCC and a
|
|
72
|
+
* 5% speed penalty with Clang, compared to the naive uint64_t[24] table.
|
|
73
|
+
* YMMV.
|
|
74
|
+
*/
|
|
75
|
+
/* Helper macro to set the values of the higher bits in unused low positions */
|
|
76
|
+
#define H(b63, b31, b15) (b63 << 6 | b31 << 5 | b15 << 4)
|
|
77
|
+
static const uint8_t iota_r_packed[24] = {
|
|
78
|
+
H(0, 0, 0) | 0x01, H(0, 0, 1) | 0x82, H(1, 0, 1) | 0x8a, H(1, 1, 1) | 0x00,
|
|
79
|
+
H(0, 0, 1) | 0x8b, H(0, 1, 0) | 0x01, H(1, 1, 1) | 0x81, H(1, 0, 1) | 0x09,
|
|
80
|
+
H(0, 0, 0) | 0x8a, H(0, 0, 0) | 0x88, H(0, 1, 1) | 0x09, H(0, 1, 0) | 0x0a,
|
|
81
|
+
H(0, 1, 1) | 0x8b, H(1, 0, 0) | 0x8b, H(1, 0, 1) | 0x89, H(1, 0, 1) | 0x03,
|
|
82
|
+
H(1, 0, 1) | 0x02, H(1, 0, 0) | 0x80, H(0, 0, 1) | 0x0a, H(1, 1, 0) | 0x0a,
|
|
83
|
+
H(1, 1, 1) | 0x81, H(1, 0, 1) | 0x80, H(0, 1, 0) | 0x01, H(1, 1, 1) | 0x08,
|
|
84
|
+
};
|
|
85
|
+
#undef H
|
|
86
|
+
|
|
87
|
+
static const uint32_t rho[6] = {
|
|
88
|
+
0x3f022425, 0x1c143a09, 0x2c3d3615, 0x27191713, 0x312b382e, 0x3e030832
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
static const uint32_t pi[6] = {
|
|
92
|
+
0x110b070a, 0x10050312, 0x04181508, 0x0d13170f, 0x0e14020c, 0x01060916
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
#define ROTR64(x, y) (((x) << (64U - (y))) | ((x) >> (y))) // 64-bit rotate right
|
|
96
|
+
#define ABSORB(ctx, idx, v) do { ctx->state[(idx) >> 3] ^= ((uint64_t) (v)) << (((idx) & 0x7) << 3); \
|
|
97
|
+
} while (0)
|
|
98
|
+
#define SQUEEZE(ctx, idx) ((uint8_t) (ctx->state[(idx) >> 3] >> (((idx) & 0x7) << 3)))
|
|
99
|
+
#define SWAP(x, y) do { uint64_t tmp = (x); (x) = (y); (y) = tmp; } while (0)
|
|
100
|
+
|
|
101
|
+
/* The permutation function. */
|
|
102
|
+
static void keccak_f1600(mbedtls_sha3_context *ctx)
|
|
103
|
+
{
|
|
104
|
+
uint64_t lane[5];
|
|
105
|
+
uint64_t *s = ctx->state;
|
|
106
|
+
int i;
|
|
107
|
+
|
|
108
|
+
for (int round = 0; round < 24; round++) {
|
|
109
|
+
uint64_t t;
|
|
110
|
+
|
|
111
|
+
/* Theta */
|
|
112
|
+
#if MBEDTLS_SHA3_THETA_UNROLL == 0 //no-check-names
|
|
113
|
+
for (i = 0; i < 5; i++) {
|
|
114
|
+
lane[i] = s[i] ^ s[i + 5] ^ s[i + 10] ^ s[i + 15] ^ s[i + 20];
|
|
115
|
+
}
|
|
116
|
+
for (i = 0; i < 5; i++) {
|
|
117
|
+
t = lane[(i + 4) % 5] ^ ROTR64(lane[(i + 1) % 5], 63);
|
|
118
|
+
s[i] ^= t; s[i + 5] ^= t; s[i + 10] ^= t; s[i + 15] ^= t; s[i + 20] ^= t;
|
|
119
|
+
}
|
|
120
|
+
#else
|
|
121
|
+
lane[0] = s[0] ^ s[5] ^ s[10] ^ s[15] ^ s[20];
|
|
122
|
+
lane[1] = s[1] ^ s[6] ^ s[11] ^ s[16] ^ s[21];
|
|
123
|
+
lane[2] = s[2] ^ s[7] ^ s[12] ^ s[17] ^ s[22];
|
|
124
|
+
lane[3] = s[3] ^ s[8] ^ s[13] ^ s[18] ^ s[23];
|
|
125
|
+
lane[4] = s[4] ^ s[9] ^ s[14] ^ s[19] ^ s[24];
|
|
126
|
+
|
|
127
|
+
t = lane[4] ^ ROTR64(lane[1], 63);
|
|
128
|
+
s[0] ^= t; s[5] ^= t; s[10] ^= t; s[15] ^= t; s[20] ^= t;
|
|
129
|
+
|
|
130
|
+
t = lane[0] ^ ROTR64(lane[2], 63);
|
|
131
|
+
s[1] ^= t; s[6] ^= t; s[11] ^= t; s[16] ^= t; s[21] ^= t;
|
|
132
|
+
|
|
133
|
+
t = lane[1] ^ ROTR64(lane[3], 63);
|
|
134
|
+
s[2] ^= t; s[7] ^= t; s[12] ^= t; s[17] ^= t; s[22] ^= t;
|
|
135
|
+
|
|
136
|
+
t = lane[2] ^ ROTR64(lane[4], 63);
|
|
137
|
+
s[3] ^= t; s[8] ^= t; s[13] ^= t; s[18] ^= t; s[23] ^= t;
|
|
138
|
+
|
|
139
|
+
t = lane[3] ^ ROTR64(lane[0], 63);
|
|
140
|
+
s[4] ^= t; s[9] ^= t; s[14] ^= t; s[19] ^= t; s[24] ^= t;
|
|
141
|
+
#endif
|
|
142
|
+
|
|
143
|
+
/* Rho */
|
|
144
|
+
for (i = 1; i < 25; i += 4) {
|
|
145
|
+
uint32_t r = rho[(i - 1) >> 2];
|
|
146
|
+
#if MBEDTLS_SHA3_RHO_UNROLL == 0
|
|
147
|
+
for (int j = i; j < i + 4; j++) {
|
|
148
|
+
uint8_t r8 = (uint8_t) (r >> 24);
|
|
149
|
+
r <<= 8;
|
|
150
|
+
s[j] = ROTR64(s[j], r8);
|
|
151
|
+
}
|
|
152
|
+
#else
|
|
153
|
+
s[i + 0] = ROTR64(s[i + 0], MBEDTLS_BYTE_3(r));
|
|
154
|
+
s[i + 1] = ROTR64(s[i + 1], MBEDTLS_BYTE_2(r));
|
|
155
|
+
s[i + 2] = ROTR64(s[i + 2], MBEDTLS_BYTE_1(r));
|
|
156
|
+
s[i + 3] = ROTR64(s[i + 3], MBEDTLS_BYTE_0(r));
|
|
157
|
+
#endif
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Pi */
|
|
161
|
+
t = s[1];
|
|
162
|
+
#if MBEDTLS_SHA3_PI_UNROLL == 0
|
|
163
|
+
for (i = 0; i < 24; i += 4) {
|
|
164
|
+
uint32_t p = pi[i >> 2];
|
|
165
|
+
for (unsigned j = 0; j < 4; j++) {
|
|
166
|
+
SWAP(s[p & 0xff], t);
|
|
167
|
+
p >>= 8;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
#else
|
|
171
|
+
uint32_t p = pi[0];
|
|
172
|
+
SWAP(s[MBEDTLS_BYTE_0(p)], t); SWAP(s[MBEDTLS_BYTE_1(p)], t);
|
|
173
|
+
SWAP(s[MBEDTLS_BYTE_2(p)], t); SWAP(s[MBEDTLS_BYTE_3(p)], t);
|
|
174
|
+
p = pi[1];
|
|
175
|
+
SWAP(s[MBEDTLS_BYTE_0(p)], t); SWAP(s[MBEDTLS_BYTE_1(p)], t);
|
|
176
|
+
SWAP(s[MBEDTLS_BYTE_2(p)], t); SWAP(s[MBEDTLS_BYTE_3(p)], t);
|
|
177
|
+
p = pi[2];
|
|
178
|
+
SWAP(s[MBEDTLS_BYTE_0(p)], t); SWAP(s[MBEDTLS_BYTE_1(p)], t);
|
|
179
|
+
SWAP(s[MBEDTLS_BYTE_2(p)], t); SWAP(s[MBEDTLS_BYTE_3(p)], t);
|
|
180
|
+
p = pi[3];
|
|
181
|
+
SWAP(s[MBEDTLS_BYTE_0(p)], t); SWAP(s[MBEDTLS_BYTE_1(p)], t);
|
|
182
|
+
SWAP(s[MBEDTLS_BYTE_2(p)], t); SWAP(s[MBEDTLS_BYTE_3(p)], t);
|
|
183
|
+
p = pi[4];
|
|
184
|
+
SWAP(s[MBEDTLS_BYTE_0(p)], t); SWAP(s[MBEDTLS_BYTE_1(p)], t);
|
|
185
|
+
SWAP(s[MBEDTLS_BYTE_2(p)], t); SWAP(s[MBEDTLS_BYTE_3(p)], t);
|
|
186
|
+
p = pi[5];
|
|
187
|
+
SWAP(s[MBEDTLS_BYTE_0(p)], t); SWAP(s[MBEDTLS_BYTE_1(p)], t);
|
|
188
|
+
SWAP(s[MBEDTLS_BYTE_2(p)], t); SWAP(s[MBEDTLS_BYTE_3(p)], t);
|
|
189
|
+
#endif
|
|
190
|
+
|
|
191
|
+
/* Chi */
|
|
192
|
+
#if MBEDTLS_SHA3_CHI_UNROLL == 0 //no-check-names
|
|
193
|
+
for (i = 0; i <= 20; i += 5) {
|
|
194
|
+
lane[0] = s[i]; lane[1] = s[i + 1]; lane[2] = s[i + 2];
|
|
195
|
+
lane[3] = s[i + 3]; lane[4] = s[i + 4];
|
|
196
|
+
s[i + 0] ^= (~lane[1]) & lane[2];
|
|
197
|
+
s[i + 1] ^= (~lane[2]) & lane[3];
|
|
198
|
+
s[i + 2] ^= (~lane[3]) & lane[4];
|
|
199
|
+
s[i + 3] ^= (~lane[4]) & lane[0];
|
|
200
|
+
s[i + 4] ^= (~lane[0]) & lane[1];
|
|
201
|
+
}
|
|
202
|
+
#else
|
|
203
|
+
lane[0] = s[0]; lane[1] = s[1]; lane[2] = s[2]; lane[3] = s[3]; lane[4] = s[4];
|
|
204
|
+
s[0] ^= (~lane[1]) & lane[2];
|
|
205
|
+
s[1] ^= (~lane[2]) & lane[3];
|
|
206
|
+
s[2] ^= (~lane[3]) & lane[4];
|
|
207
|
+
s[3] ^= (~lane[4]) & lane[0];
|
|
208
|
+
s[4] ^= (~lane[0]) & lane[1];
|
|
209
|
+
|
|
210
|
+
lane[0] = s[5]; lane[1] = s[6]; lane[2] = s[7]; lane[3] = s[8]; lane[4] = s[9];
|
|
211
|
+
s[5] ^= (~lane[1]) & lane[2];
|
|
212
|
+
s[6] ^= (~lane[2]) & lane[3];
|
|
213
|
+
s[7] ^= (~lane[3]) & lane[4];
|
|
214
|
+
s[8] ^= (~lane[4]) & lane[0];
|
|
215
|
+
s[9] ^= (~lane[0]) & lane[1];
|
|
216
|
+
|
|
217
|
+
lane[0] = s[10]; lane[1] = s[11]; lane[2] = s[12]; lane[3] = s[13]; lane[4] = s[14];
|
|
218
|
+
s[10] ^= (~lane[1]) & lane[2];
|
|
219
|
+
s[11] ^= (~lane[2]) & lane[3];
|
|
220
|
+
s[12] ^= (~lane[3]) & lane[4];
|
|
221
|
+
s[13] ^= (~lane[4]) & lane[0];
|
|
222
|
+
s[14] ^= (~lane[0]) & lane[1];
|
|
223
|
+
|
|
224
|
+
lane[0] = s[15]; lane[1] = s[16]; lane[2] = s[17]; lane[3] = s[18]; lane[4] = s[19];
|
|
225
|
+
s[15] ^= (~lane[1]) & lane[2];
|
|
226
|
+
s[16] ^= (~lane[2]) & lane[3];
|
|
227
|
+
s[17] ^= (~lane[3]) & lane[4];
|
|
228
|
+
s[18] ^= (~lane[4]) & lane[0];
|
|
229
|
+
s[19] ^= (~lane[0]) & lane[1];
|
|
230
|
+
|
|
231
|
+
lane[0] = s[20]; lane[1] = s[21]; lane[2] = s[22]; lane[3] = s[23]; lane[4] = s[24];
|
|
232
|
+
s[20] ^= (~lane[1]) & lane[2];
|
|
233
|
+
s[21] ^= (~lane[2]) & lane[3];
|
|
234
|
+
s[22] ^= (~lane[3]) & lane[4];
|
|
235
|
+
s[23] ^= (~lane[4]) & lane[0];
|
|
236
|
+
s[24] ^= (~lane[0]) & lane[1];
|
|
237
|
+
#endif
|
|
238
|
+
|
|
239
|
+
/* Iota */
|
|
240
|
+
/* Decompress the round masks (see definition of rc) */
|
|
241
|
+
s[0] ^= ((iota_r_packed[round] & 0x40ull) << 57 |
|
|
242
|
+
(iota_r_packed[round] & 0x20ull) << 26 |
|
|
243
|
+
(iota_r_packed[round] & 0x10ull) << 11 |
|
|
244
|
+
(iota_r_packed[round] & 0x8f));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
void mbedtls_sha3_init(mbedtls_sha3_context *ctx)
|
|
249
|
+
{
|
|
250
|
+
memset(ctx, 0, sizeof(mbedtls_sha3_context));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
void mbedtls_sha3_free(mbedtls_sha3_context *ctx)
|
|
254
|
+
{
|
|
255
|
+
if (ctx == NULL) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_sha3_context));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
void mbedtls_sha3_clone(mbedtls_sha3_context *dst,
|
|
263
|
+
const mbedtls_sha3_context *src)
|
|
264
|
+
{
|
|
265
|
+
*dst = *src;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/*
|
|
269
|
+
* SHA-3 context setup
|
|
270
|
+
*/
|
|
271
|
+
int mbedtls_sha3_starts(mbedtls_sha3_context *ctx, mbedtls_sha3_id id)
|
|
272
|
+
{
|
|
273
|
+
/* Clean up in case the context is being reused */
|
|
274
|
+
memset(ctx, 0, sizeof(*ctx));
|
|
275
|
+
|
|
276
|
+
switch (id) {
|
|
277
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
|
278
|
+
case MBEDTLS_SHA3_224:
|
|
279
|
+
ctx->olen = 224 / 8;
|
|
280
|
+
ctx->max_block_size = 1152 / 8;
|
|
281
|
+
break;
|
|
282
|
+
#endif
|
|
283
|
+
|
|
284
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
|
285
|
+
case MBEDTLS_SHA3_256:
|
|
286
|
+
ctx->olen = 256 / 8;
|
|
287
|
+
ctx->max_block_size = 1088 / 8;
|
|
288
|
+
break;
|
|
289
|
+
#endif
|
|
290
|
+
|
|
291
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
|
292
|
+
case MBEDTLS_SHA3_384:
|
|
293
|
+
ctx->olen = 384 / 8;
|
|
294
|
+
ctx->max_block_size = 832 / 8;
|
|
295
|
+
break;
|
|
296
|
+
#endif
|
|
297
|
+
|
|
298
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
|
299
|
+
case MBEDTLS_SHA3_512:
|
|
300
|
+
ctx->olen = 512 / 8;
|
|
301
|
+
ctx->max_block_size = 576 / 8;
|
|
302
|
+
break;
|
|
303
|
+
#endif
|
|
304
|
+
|
|
305
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE128)
|
|
306
|
+
case MBEDTLS_SHA3_SHAKE128:
|
|
307
|
+
ctx->max_block_size = 1344 / 8;
|
|
308
|
+
break;
|
|
309
|
+
#endif
|
|
310
|
+
|
|
311
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE256)
|
|
312
|
+
case MBEDTLS_SHA3_SHAKE256:
|
|
313
|
+
ctx->max_block_size = 1088 / 8;
|
|
314
|
+
break;
|
|
315
|
+
#endif
|
|
316
|
+
|
|
317
|
+
default:
|
|
318
|
+
return MBEDTLS_ERR_SHA3_BAD_INPUT_DATA;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return 0;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/*
|
|
325
|
+
* SHA-3 process buffer
|
|
326
|
+
*/
|
|
327
|
+
int mbedtls_sha3_update(mbedtls_sha3_context *ctx,
|
|
328
|
+
const uint8_t *input,
|
|
329
|
+
size_t ilen)
|
|
330
|
+
{
|
|
331
|
+
if (ilen >= 8) {
|
|
332
|
+
// 8-byte align index
|
|
333
|
+
int align_bytes = 8 - (ctx->index % 8);
|
|
334
|
+
if (align_bytes) {
|
|
335
|
+
for (; align_bytes > 0; align_bytes--) {
|
|
336
|
+
ABSORB(ctx, ctx->index, *input++);
|
|
337
|
+
ilen--;
|
|
338
|
+
ctx->index++;
|
|
339
|
+
}
|
|
340
|
+
if ((ctx->index = ctx->index % ctx->max_block_size) == 0) {
|
|
341
|
+
keccak_f1600(ctx);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// process input in 8-byte chunks
|
|
346
|
+
while (ilen >= 8) {
|
|
347
|
+
ABSORB(ctx, ctx->index, MBEDTLS_GET_UINT64_LE(input, 0));
|
|
348
|
+
input += 8;
|
|
349
|
+
ilen -= 8;
|
|
350
|
+
if ((ctx->index = (ctx->index + 8) % ctx->max_block_size) == 0) {
|
|
351
|
+
keccak_f1600(ctx);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// handle remaining bytes
|
|
357
|
+
while (ilen-- > 0) {
|
|
358
|
+
ABSORB(ctx, ctx->index, *input++);
|
|
359
|
+
if ((ctx->index = (ctx->index + 1) % ctx->max_block_size) == 0) {
|
|
360
|
+
keccak_f1600(ctx);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return 0;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
int mbedtls_sha3_finish(mbedtls_sha3_context *ctx,
|
|
368
|
+
uint8_t *output, size_t olen)
|
|
369
|
+
{
|
|
370
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
371
|
+
uint8_t xor_byte;
|
|
372
|
+
|
|
373
|
+
/* Catch SHA-3 families, with fixed output length */
|
|
374
|
+
if (ctx->olen > 0) {
|
|
375
|
+
if (ctx->olen > olen) {
|
|
376
|
+
ret = MBEDTLS_ERR_SHA3_BAD_INPUT_DATA;
|
|
377
|
+
goto exit;
|
|
378
|
+
}
|
|
379
|
+
olen = ctx->olen;
|
|
380
|
+
xor_byte = SHA3_XOR_BYTE;
|
|
381
|
+
} else {
|
|
382
|
+
xor_byte = SHAKE_XOR_BYTE;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (ctx->finished == 0) {
|
|
386
|
+
ABSORB(ctx, ctx->index, xor_byte);
|
|
387
|
+
ABSORB(ctx, ctx->max_block_size - 1, 0x80);
|
|
388
|
+
keccak_f1600(ctx);
|
|
389
|
+
ctx->index = 0;
|
|
390
|
+
ctx->finished = 1;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
while (olen-- > 0) {
|
|
394
|
+
*output++ = SQUEEZE(ctx, ctx->index);
|
|
395
|
+
|
|
396
|
+
if ((ctx->index = (ctx->index + 1) % ctx->max_block_size) == 0) {
|
|
397
|
+
keccak_f1600(ctx);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* If there is a fixed output length (SHA3), we only accept a single call
|
|
402
|
+
* to finish(), and have it clean up the context. If the output length is
|
|
403
|
+
* variable (SHAKE), leave the context ready for further finish() calls. */
|
|
404
|
+
if (ctx->olen > 0) {
|
|
405
|
+
ret = 0;
|
|
406
|
+
goto exit;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return 0;
|
|
410
|
+
|
|
411
|
+
exit:
|
|
412
|
+
mbedtls_sha3_free(ctx);
|
|
413
|
+
return ret;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/*
|
|
417
|
+
* output = SHA-3( input buffer )
|
|
418
|
+
*/
|
|
419
|
+
int mbedtls_sha3(mbedtls_sha3_id id, const uint8_t *input,
|
|
420
|
+
size_t ilen, uint8_t *output, size_t olen)
|
|
421
|
+
{
|
|
422
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
423
|
+
mbedtls_sha3_context ctx;
|
|
424
|
+
|
|
425
|
+
mbedtls_sha3_init(&ctx);
|
|
426
|
+
|
|
427
|
+
/* Sanity checks are performed in every mbedtls_sha3_xxx() */
|
|
428
|
+
if ((ret = mbedtls_sha3_starts(&ctx, id)) != 0) {
|
|
429
|
+
goto exit;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if ((ret = mbedtls_sha3_update(&ctx, input, ilen)) != 0) {
|
|
433
|
+
goto exit;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if ((ret = mbedtls_sha3_finish(&ctx, output, olen)) != 0) {
|
|
437
|
+
goto exit;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
exit:
|
|
441
|
+
mbedtls_sha3_free(&ctx);
|
|
442
|
+
|
|
443
|
+
return ret;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**************** Self-tests ****************/
|
|
447
|
+
|
|
448
|
+
#if defined(MBEDTLS_SELF_TEST)
|
|
449
|
+
|
|
450
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_SOME_HASH)
|
|
451
|
+
|
|
452
|
+
static const unsigned char test_data[2][4] =
|
|
453
|
+
{
|
|
454
|
+
"",
|
|
455
|
+
"abc",
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
static const size_t test_data_len[2] =
|
|
459
|
+
{
|
|
460
|
+
0, /* "" */
|
|
461
|
+
3 /* "abc" */
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
|
465
|
+
static const unsigned char test_hash_sha3_224[2][28] =
|
|
466
|
+
{
|
|
467
|
+
{ /* "" */
|
|
468
|
+
0x6B, 0x4E, 0x03, 0x42, 0x36, 0x67, 0xDB, 0xB7,
|
|
469
|
+
0x3B, 0x6E, 0x15, 0x45, 0x4F, 0x0E, 0xB1, 0xAB,
|
|
470
|
+
0xD4, 0x59, 0x7F, 0x9A, 0x1B, 0x07, 0x8E, 0x3F,
|
|
471
|
+
0x5B, 0x5A, 0x6B, 0xC7
|
|
472
|
+
},
|
|
473
|
+
{ /* "abc" */
|
|
474
|
+
0xE6, 0x42, 0x82, 0x4C, 0x3F, 0x8C, 0xF2, 0x4A,
|
|
475
|
+
0xD0, 0x92, 0x34, 0xEE, 0x7D, 0x3C, 0x76, 0x6F,
|
|
476
|
+
0xC9, 0xA3, 0xA5, 0x16, 0x8D, 0x0C, 0x94, 0xAD,
|
|
477
|
+
0x73, 0xB4, 0x6F, 0xDF
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
#endif
|
|
481
|
+
|
|
482
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
|
483
|
+
static const unsigned char test_hash_sha3_256[2][32] =
|
|
484
|
+
{
|
|
485
|
+
{ /* "" */
|
|
486
|
+
0xA7, 0xFF, 0xC6, 0xF8, 0xBF, 0x1E, 0xD7, 0x66,
|
|
487
|
+
0x51, 0xC1, 0x47, 0x56, 0xA0, 0x61, 0xD6, 0x62,
|
|
488
|
+
0xF5, 0x80, 0xFF, 0x4D, 0xE4, 0x3B, 0x49, 0xFA,
|
|
489
|
+
0x82, 0xD8, 0x0A, 0x4B, 0x80, 0xF8, 0x43, 0x4A
|
|
490
|
+
},
|
|
491
|
+
{ /* "abc" */
|
|
492
|
+
0x3A, 0x98, 0x5D, 0xA7, 0x4F, 0xE2, 0x25, 0xB2,
|
|
493
|
+
0x04, 0x5C, 0x17, 0x2D, 0x6B, 0xD3, 0x90, 0xBD,
|
|
494
|
+
0x85, 0x5F, 0x08, 0x6E, 0x3E, 0x9D, 0x52, 0x5B,
|
|
495
|
+
0x46, 0xBF, 0xE2, 0x45, 0x11, 0x43, 0x15, 0x32
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
#endif
|
|
499
|
+
|
|
500
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
|
501
|
+
static const unsigned char test_hash_sha3_384[2][48] =
|
|
502
|
+
{
|
|
503
|
+
{ /* "" */
|
|
504
|
+
0x0C, 0x63, 0xA7, 0x5B, 0x84, 0x5E, 0x4F, 0x7D,
|
|
505
|
+
0x01, 0x10, 0x7D, 0x85, 0x2E, 0x4C, 0x24, 0x85,
|
|
506
|
+
0xC5, 0x1A, 0x50, 0xAA, 0xAA, 0x94, 0xFC, 0x61,
|
|
507
|
+
0x99, 0x5E, 0x71, 0xBB, 0xEE, 0x98, 0x3A, 0x2A,
|
|
508
|
+
0xC3, 0x71, 0x38, 0x31, 0x26, 0x4A, 0xDB, 0x47,
|
|
509
|
+
0xFB, 0x6B, 0xD1, 0xE0, 0x58, 0xD5, 0xF0, 0x04
|
|
510
|
+
},
|
|
511
|
+
{ /* "abc" */
|
|
512
|
+
0xEC, 0x01, 0x49, 0x82, 0x88, 0x51, 0x6F, 0xC9,
|
|
513
|
+
0x26, 0x45, 0x9F, 0x58, 0xE2, 0xC6, 0xAD, 0x8D,
|
|
514
|
+
0xF9, 0xB4, 0x73, 0xCB, 0x0F, 0xC0, 0x8C, 0x25,
|
|
515
|
+
0x96, 0xDA, 0x7C, 0xF0, 0xE4, 0x9B, 0xE4, 0xB2,
|
|
516
|
+
0x98, 0xD8, 0x8C, 0xEA, 0x92, 0x7A, 0xC7, 0xF5,
|
|
517
|
+
0x39, 0xF1, 0xED, 0xF2, 0x28, 0x37, 0x6D, 0x25
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
#endif
|
|
521
|
+
|
|
522
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
|
523
|
+
static const unsigned char test_hash_sha3_512[2][64] =
|
|
524
|
+
{
|
|
525
|
+
{ /* "" */
|
|
526
|
+
0xA6, 0x9F, 0x73, 0xCC, 0xA2, 0x3A, 0x9A, 0xC5,
|
|
527
|
+
0xC8, 0xB5, 0x67, 0xDC, 0x18, 0x5A, 0x75, 0x6E,
|
|
528
|
+
0x97, 0xC9, 0x82, 0x16, 0x4F, 0xE2, 0x58, 0x59,
|
|
529
|
+
0xE0, 0xD1, 0xDC, 0xC1, 0x47, 0x5C, 0x80, 0xA6,
|
|
530
|
+
0x15, 0xB2, 0x12, 0x3A, 0xF1, 0xF5, 0xF9, 0x4C,
|
|
531
|
+
0x11, 0xE3, 0xE9, 0x40, 0x2C, 0x3A, 0xC5, 0x58,
|
|
532
|
+
0xF5, 0x00, 0x19, 0x9D, 0x95, 0xB6, 0xD3, 0xE3,
|
|
533
|
+
0x01, 0x75, 0x85, 0x86, 0x28, 0x1D, 0xCD, 0x26
|
|
534
|
+
},
|
|
535
|
+
{ /* "abc" */
|
|
536
|
+
0xB7, 0x51, 0x85, 0x0B, 0x1A, 0x57, 0x16, 0x8A,
|
|
537
|
+
0x56, 0x93, 0xCD, 0x92, 0x4B, 0x6B, 0x09, 0x6E,
|
|
538
|
+
0x08, 0xF6, 0x21, 0x82, 0x74, 0x44, 0xF7, 0x0D,
|
|
539
|
+
0x88, 0x4F, 0x5D, 0x02, 0x40, 0xD2, 0x71, 0x2E,
|
|
540
|
+
0x10, 0xE1, 0x16, 0xE9, 0x19, 0x2A, 0xF3, 0xC9,
|
|
541
|
+
0x1A, 0x7E, 0xC5, 0x76, 0x47, 0xE3, 0x93, 0x40,
|
|
542
|
+
0x57, 0x34, 0x0B, 0x4C, 0xF4, 0x08, 0xD5, 0xA5,
|
|
543
|
+
0x65, 0x92, 0xF8, 0x27, 0x4E, 0xEC, 0x53, 0xF0
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
#endif
|
|
547
|
+
|
|
548
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
|
549
|
+
static const unsigned char long_kat_hash_sha3_224[28] =
|
|
550
|
+
{
|
|
551
|
+
0xD6, 0x93, 0x35, 0xB9, 0x33, 0x25, 0x19, 0x2E,
|
|
552
|
+
0x51, 0x6A, 0x91, 0x2E, 0x6D, 0x19, 0xA1, 0x5C,
|
|
553
|
+
0xB5, 0x1C, 0x6E, 0xD5, 0xC1, 0x52, 0x43, 0xE7,
|
|
554
|
+
0xA7, 0xFD, 0x65, 0x3C
|
|
555
|
+
};
|
|
556
|
+
#endif
|
|
557
|
+
|
|
558
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
|
559
|
+
static const unsigned char long_kat_hash_sha3_256[32] =
|
|
560
|
+
{
|
|
561
|
+
0x5C, 0x88, 0x75, 0xAE, 0x47, 0x4A, 0x36, 0x34,
|
|
562
|
+
0xBA, 0x4F, 0xD5, 0x5E, 0xC8, 0x5B, 0xFF, 0xD6,
|
|
563
|
+
0x61, 0xF3, 0x2A, 0xCA, 0x75, 0xC6, 0xD6, 0x99,
|
|
564
|
+
0xD0, 0xCD, 0xCB, 0x6C, 0x11, 0x58, 0x91, 0xC1
|
|
565
|
+
};
|
|
566
|
+
#endif
|
|
567
|
+
|
|
568
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
|
569
|
+
static const unsigned char long_kat_hash_sha3_384[48] =
|
|
570
|
+
{
|
|
571
|
+
0xEE, 0xE9, 0xE2, 0x4D, 0x78, 0xC1, 0x85, 0x53,
|
|
572
|
+
0x37, 0x98, 0x34, 0x51, 0xDF, 0x97, 0xC8, 0xAD,
|
|
573
|
+
0x9E, 0xED, 0xF2, 0x56, 0xC6, 0x33, 0x4F, 0x8E,
|
|
574
|
+
0x94, 0x8D, 0x25, 0x2D, 0x5E, 0x0E, 0x76, 0x84,
|
|
575
|
+
0x7A, 0xA0, 0x77, 0x4D, 0xDB, 0x90, 0xA8, 0x42,
|
|
576
|
+
0x19, 0x0D, 0x2C, 0x55, 0x8B, 0x4B, 0x83, 0x40
|
|
577
|
+
};
|
|
578
|
+
#endif
|
|
579
|
+
|
|
580
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
|
581
|
+
static const unsigned char long_kat_hash_sha3_512[64] =
|
|
582
|
+
{
|
|
583
|
+
0x3C, 0x3A, 0x87, 0x6D, 0xA1, 0x40, 0x34, 0xAB,
|
|
584
|
+
0x60, 0x62, 0x7C, 0x07, 0x7B, 0xB9, 0x8F, 0x7E,
|
|
585
|
+
0x12, 0x0A, 0x2A, 0x53, 0x70, 0x21, 0x2D, 0xFF,
|
|
586
|
+
0xB3, 0x38, 0x5A, 0x18, 0xD4, 0xF3, 0x88, 0x59,
|
|
587
|
+
0xED, 0x31, 0x1D, 0x0A, 0x9D, 0x51, 0x41, 0xCE,
|
|
588
|
+
0x9C, 0xC5, 0xC6, 0x6E, 0xE6, 0x89, 0xB2, 0x66,
|
|
589
|
+
0xA8, 0xAA, 0x18, 0xAC, 0xE8, 0x28, 0x2A, 0x0E,
|
|
590
|
+
0x0D, 0xB5, 0x96, 0xC9, 0x0B, 0x0A, 0x7B, 0x87
|
|
591
|
+
};
|
|
592
|
+
#endif
|
|
593
|
+
|
|
594
|
+
static int mbedtls_sha3_kat_test(int verbose,
|
|
595
|
+
const char *type_name,
|
|
596
|
+
mbedtls_sha3_id id,
|
|
597
|
+
int test_num)
|
|
598
|
+
{
|
|
599
|
+
uint8_t hash[64];
|
|
600
|
+
int result;
|
|
601
|
+
|
|
602
|
+
result = mbedtls_sha3(id,
|
|
603
|
+
test_data[test_num], test_data_len[test_num],
|
|
604
|
+
hash, sizeof(hash));
|
|
605
|
+
if (result != 0) {
|
|
606
|
+
if (verbose != 0) {
|
|
607
|
+
mbedtls_printf(" %s test %d error code: %d\n",
|
|
608
|
+
type_name, test_num, result);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
return result;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
switch (id) {
|
|
615
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
|
616
|
+
case MBEDTLS_SHA3_224:
|
|
617
|
+
result = memcmp(hash, test_hash_sha3_224[test_num], 28);
|
|
618
|
+
break;
|
|
619
|
+
#endif
|
|
620
|
+
|
|
621
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
|
622
|
+
case MBEDTLS_SHA3_256:
|
|
623
|
+
result = memcmp(hash, test_hash_sha3_256[test_num], 32);
|
|
624
|
+
break;
|
|
625
|
+
#endif
|
|
626
|
+
|
|
627
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
|
628
|
+
case MBEDTLS_SHA3_384:
|
|
629
|
+
result = memcmp(hash, test_hash_sha3_384[test_num], 48);
|
|
630
|
+
break;
|
|
631
|
+
#endif
|
|
632
|
+
|
|
633
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
|
634
|
+
case MBEDTLS_SHA3_512:
|
|
635
|
+
result = memcmp(hash, test_hash_sha3_512[test_num], 64);
|
|
636
|
+
break;
|
|
637
|
+
#endif
|
|
638
|
+
default:
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
if (0 != result) {
|
|
643
|
+
if (verbose != 0) {
|
|
644
|
+
mbedtls_printf(" %s test %d failed\n", type_name, test_num);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
return -1;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
if (verbose != 0) {
|
|
651
|
+
mbedtls_printf(" %s test %d passed\n", type_name, test_num);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
return 0;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
static int mbedtls_sha3_long_kat_test(int verbose,
|
|
658
|
+
const char *type_name,
|
|
659
|
+
mbedtls_sha3_id id)
|
|
660
|
+
{
|
|
661
|
+
mbedtls_sha3_context ctx;
|
|
662
|
+
unsigned char buffer[1000];
|
|
663
|
+
unsigned char hash[64];
|
|
664
|
+
int result = 0;
|
|
665
|
+
|
|
666
|
+
memset(buffer, 'a', 1000);
|
|
667
|
+
|
|
668
|
+
if (verbose != 0) {
|
|
669
|
+
mbedtls_printf(" %s long KAT test ", type_name);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
mbedtls_sha3_init(&ctx);
|
|
673
|
+
|
|
674
|
+
result = mbedtls_sha3_starts(&ctx, id);
|
|
675
|
+
if (result != 0) {
|
|
676
|
+
if (verbose != 0) {
|
|
677
|
+
mbedtls_printf("setup failed\n ");
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/* Process 1,000,000 (one million) 'a' characters */
|
|
682
|
+
for (int i = 0; i < 1000; i++) {
|
|
683
|
+
result = mbedtls_sha3_update(&ctx, buffer, 1000);
|
|
684
|
+
if (result != 0) {
|
|
685
|
+
if (verbose != 0) {
|
|
686
|
+
mbedtls_printf("update error code: %i\n", result);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
goto cleanup;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
result = mbedtls_sha3_finish(&ctx, hash, sizeof(hash));
|
|
694
|
+
if (result != 0) {
|
|
695
|
+
if (verbose != 0) {
|
|
696
|
+
mbedtls_printf("finish error code: %d\n", result);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
goto cleanup;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
switch (id) {
|
|
703
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
|
704
|
+
case MBEDTLS_SHA3_224:
|
|
705
|
+
result = memcmp(hash, long_kat_hash_sha3_224, 28);
|
|
706
|
+
break;
|
|
707
|
+
#endif
|
|
708
|
+
|
|
709
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
|
710
|
+
case MBEDTLS_SHA3_256:
|
|
711
|
+
result = memcmp(hash, long_kat_hash_sha3_256, 32);
|
|
712
|
+
break;
|
|
713
|
+
#endif
|
|
714
|
+
|
|
715
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
|
716
|
+
case MBEDTLS_SHA3_384:
|
|
717
|
+
result = memcmp(hash, long_kat_hash_sha3_384, 48);
|
|
718
|
+
break;
|
|
719
|
+
#endif
|
|
720
|
+
|
|
721
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
|
722
|
+
case MBEDTLS_SHA3_512:
|
|
723
|
+
result = memcmp(hash, long_kat_hash_sha3_512, 64);
|
|
724
|
+
break;
|
|
725
|
+
#endif
|
|
726
|
+
default:
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
if (result != 0) {
|
|
731
|
+
if (verbose != 0) {
|
|
732
|
+
mbedtls_printf("failed\n");
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (verbose != 0) {
|
|
737
|
+
mbedtls_printf("passed\n");
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
cleanup:
|
|
741
|
+
mbedtls_sha3_free(&ctx);
|
|
742
|
+
return result;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_SOME_HASH) */
|
|
746
|
+
|
|
747
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE128)
|
|
748
|
+
static const unsigned char shake128_test_input[2][16] =
|
|
749
|
+
{
|
|
750
|
+
{
|
|
751
|
+
0xD4, 0xD6, 0x7B, 0x00, 0xCA, 0x51, 0x39, 0x77,
|
|
752
|
+
0x91, 0xB8, 0x12, 0x05, 0xD5, 0x58, 0x2C, 0x0A
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
0xCC, 0x0A, 0x93, 0x9D, 0x40, 0xFE, 0xFD, 0xC6,
|
|
756
|
+
0xC9, 0x9A, 0xCF, 0xA3, 0x7D, 0xE1, 0x0D, 0xF6
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
static const unsigned char shake128_test_output[2][16] =
|
|
761
|
+
{
|
|
762
|
+
{
|
|
763
|
+
0xD0, 0xAC, 0xFB, 0x2A, 0x14, 0x92, 0x8C, 0xAF,
|
|
764
|
+
0x8C, 0x16, 0x8A, 0xE5, 0x14, 0x92, 0x5E, 0x4E
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
0xB7, 0x0B, 0x72, 0x4A, 0x91, 0xBA, 0x86, 0x5E,
|
|
768
|
+
0xF4, 0x34, 0xF8, 0x50, 0x48, 0x50, 0x48, 0x91
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
#endif
|
|
772
|
+
|
|
773
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE256)
|
|
774
|
+
static const unsigned char shake256_test_input[2][32] =
|
|
775
|
+
{
|
|
776
|
+
{
|
|
777
|
+
0xEF, 0x89, 0x6C, 0xDC, 0xB3, 0x63, 0xA6, 0x15,
|
|
778
|
+
0x91, 0x78, 0xA1, 0xBB, 0x1C, 0x99, 0x39, 0x46,
|
|
779
|
+
0xC5, 0x04, 0x02, 0x09, 0x5C, 0xDA, 0xEA, 0x4F,
|
|
780
|
+
0xD4, 0xD4, 0x19, 0xAA, 0x47, 0x32, 0x1C, 0x88
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
0x76, 0x89, 0x1A, 0x7B, 0xCC, 0x6C, 0x04, 0x49,
|
|
784
|
+
0x00, 0x35, 0xB7, 0x43, 0x15, 0x2F, 0x64, 0xA8,
|
|
785
|
+
0xDD, 0x2E, 0xA1, 0x8A, 0xB4, 0x72, 0xB8, 0xD3,
|
|
786
|
+
0x6E, 0xCF, 0x45, 0x85, 0x8D, 0x0B, 0x00, 0x46
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
static const unsigned char shake256_test_output[2][32] =
|
|
791
|
+
{
|
|
792
|
+
{
|
|
793
|
+
0x7A, 0xBB, 0xA4, 0xE8, 0xB8, 0xDD, 0x76, 0x6B,
|
|
794
|
+
0xBA, 0xBE, 0x98, 0xF8, 0xF1, 0x69, 0xCB, 0x62,
|
|
795
|
+
0x08, 0x67, 0x4D, 0xE1, 0x9A, 0x51, 0xD7, 0x3C,
|
|
796
|
+
0x92, 0xB7, 0xDC, 0x04, 0xA4, 0xB5, 0xEE, 0x3D
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
0xE8, 0x44, 0x7D, 0xF8, 0x7D, 0x01, 0xBE, 0xEB,
|
|
800
|
+
0x72, 0x4C, 0x9A, 0x2A, 0x38, 0xAB, 0x00, 0xFC,
|
|
801
|
+
0xC2, 0x4E, 0x9B, 0xD1, 0x78, 0x60, 0xE6, 0x73,
|
|
802
|
+
0xB0, 0x21, 0x22, 0x2D, 0x62, 0x1A, 0x78, 0x10
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
#endif
|
|
806
|
+
|
|
807
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE128) || defined(MBEDTLS_SHA3_WANT_SHAKE256)
|
|
808
|
+
static int mbedtls_shake_self_test(int verbose)
|
|
809
|
+
{
|
|
810
|
+
uint8_t output[32];
|
|
811
|
+
int i;
|
|
812
|
+
int result;
|
|
813
|
+
|
|
814
|
+
for (i = 0; i < 2; i++) {
|
|
815
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE128)
|
|
816
|
+
if (verbose != 0) {
|
|
817
|
+
mbedtls_printf(" SHAKE128 test %d ", i);
|
|
818
|
+
}
|
|
819
|
+
result = mbedtls_sha3(MBEDTLS_SHA3_SHAKE128,
|
|
820
|
+
shake128_test_input[i], 16,
|
|
821
|
+
output, 16);
|
|
822
|
+
if (result != 0) {
|
|
823
|
+
if (verbose != 0) {
|
|
824
|
+
mbedtls_printf("error code: %d\n", result);
|
|
825
|
+
}
|
|
826
|
+
return -1;
|
|
827
|
+
}
|
|
828
|
+
if (0 != memcmp(shake128_test_output[i], output, 16)) {
|
|
829
|
+
if (verbose != 0) {
|
|
830
|
+
mbedtls_printf("failed\n");
|
|
831
|
+
}
|
|
832
|
+
return -1;
|
|
833
|
+
}
|
|
834
|
+
if (verbose != 0) {
|
|
835
|
+
mbedtls_printf("passed\n");
|
|
836
|
+
}
|
|
837
|
+
#endif
|
|
838
|
+
|
|
839
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE256)
|
|
840
|
+
if (verbose != 0) {
|
|
841
|
+
mbedtls_printf(" SHAKE256 test %d ", i);
|
|
842
|
+
}
|
|
843
|
+
result = mbedtls_sha3(MBEDTLS_SHA3_SHAKE256,
|
|
844
|
+
shake256_test_input[i], 32,
|
|
845
|
+
output, 32);
|
|
846
|
+
if (result != 0) {
|
|
847
|
+
if (verbose != 0) {
|
|
848
|
+
mbedtls_printf("error code: %d\n", result);
|
|
849
|
+
}
|
|
850
|
+
return -1;
|
|
851
|
+
}
|
|
852
|
+
if (0 != memcmp(shake256_test_output[i], output, 32)) {
|
|
853
|
+
if (verbose != 0) {
|
|
854
|
+
mbedtls_printf("failed\n");
|
|
855
|
+
}
|
|
856
|
+
return -1;
|
|
857
|
+
}
|
|
858
|
+
if (verbose != 0) {
|
|
859
|
+
mbedtls_printf("passed\n");
|
|
860
|
+
}
|
|
861
|
+
#endif
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (verbose != 0) {
|
|
865
|
+
mbedtls_printf("\n");
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
return 0;
|
|
869
|
+
}
|
|
870
|
+
#endif
|
|
871
|
+
|
|
872
|
+
int mbedtls_sha3_self_test(int verbose)
|
|
873
|
+
{
|
|
874
|
+
int i;
|
|
875
|
+
|
|
876
|
+
/* SHA-3 Known Answer Tests (KAT) */
|
|
877
|
+
for (i = 0; i < 2; i++) {
|
|
878
|
+
|
|
879
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
|
880
|
+
if (0 != mbedtls_sha3_kat_test(verbose,
|
|
881
|
+
"SHA3-224", MBEDTLS_SHA3_224, i)) {
|
|
882
|
+
return 1;
|
|
883
|
+
}
|
|
884
|
+
#endif
|
|
885
|
+
|
|
886
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
|
887
|
+
if (0 != mbedtls_sha3_kat_test(verbose,
|
|
888
|
+
"SHA3-256", MBEDTLS_SHA3_256, i)) {
|
|
889
|
+
return 1;
|
|
890
|
+
}
|
|
891
|
+
#endif
|
|
892
|
+
|
|
893
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
|
894
|
+
if (0 != mbedtls_sha3_kat_test(verbose,
|
|
895
|
+
"SHA3-384", MBEDTLS_SHA3_384, i)) {
|
|
896
|
+
return 1;
|
|
897
|
+
}
|
|
898
|
+
#endif
|
|
899
|
+
|
|
900
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
|
901
|
+
if (0 != mbedtls_sha3_kat_test(verbose,
|
|
902
|
+
"SHA3-512", MBEDTLS_SHA3_512, i)) {
|
|
903
|
+
return 1;
|
|
904
|
+
}
|
|
905
|
+
#endif
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/* SHA-3 long KAT tests */
|
|
909
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_224)
|
|
910
|
+
if (0 != mbedtls_sha3_long_kat_test(verbose,
|
|
911
|
+
"SHA3-224", MBEDTLS_SHA3_224)) {
|
|
912
|
+
return 1;
|
|
913
|
+
}
|
|
914
|
+
#endif
|
|
915
|
+
|
|
916
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_256)
|
|
917
|
+
if (0 != mbedtls_sha3_long_kat_test(verbose,
|
|
918
|
+
"SHA3-256", MBEDTLS_SHA3_256)) {
|
|
919
|
+
return 1;
|
|
920
|
+
}
|
|
921
|
+
#endif
|
|
922
|
+
|
|
923
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_384)
|
|
924
|
+
if (0 != mbedtls_sha3_long_kat_test(verbose,
|
|
925
|
+
"SHA3-384", MBEDTLS_SHA3_384)) {
|
|
926
|
+
return 1;
|
|
927
|
+
}
|
|
928
|
+
#endif
|
|
929
|
+
|
|
930
|
+
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA3_512)
|
|
931
|
+
if (0 != mbedtls_sha3_long_kat_test(verbose,
|
|
932
|
+
"SHA3-512", MBEDTLS_SHA3_512)) {
|
|
933
|
+
return 1;
|
|
934
|
+
}
|
|
935
|
+
#endif
|
|
936
|
+
if (verbose != 0) {
|
|
937
|
+
mbedtls_printf("\n");
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
#if defined(MBEDTLS_SHA3_WANT_SHAKE128) || defined(MBEDTLS_SHA3_WANT_SHAKE256)
|
|
941
|
+
/* SHAKE tests */
|
|
942
|
+
if (0 != mbedtls_shake_self_test(verbose)) {
|
|
943
|
+
return 1;
|
|
944
|
+
}
|
|
945
|
+
#endif
|
|
946
|
+
|
|
947
|
+
return 0;
|
|
948
|
+
}
|
|
949
|
+
#endif /* MBEDTLS_SELF_TEST */
|
|
950
|
+
|
|
951
|
+
#endif /* MBEDTLS_SHA3_C */
|