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,1089 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FIPS-180-2 compliant SHA-384/512 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-512 Secure Hash Standard was published by NIST in 2002.
|
|
9
|
+
*
|
|
10
|
+
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
#if defined(__aarch64__) && !defined(__ARM_FEATURE_SHA512) && \
|
|
14
|
+
defined(__clang__) && __clang_major__ >= 7
|
|
15
|
+
/*
|
|
16
|
+
* The intrinsic declaration are guarded by predefined ACLE macros in clang:
|
|
17
|
+
* these are normally only enabled by the -march option on the command line.
|
|
18
|
+
* By defining the macros ourselves we gain access to those declarations without
|
|
19
|
+
* requiring -march on the command line.
|
|
20
|
+
*
|
|
21
|
+
* `arm_neon.h` is included by tf_psa_crypto_common.h, so we put these defines
|
|
22
|
+
* at the top of this file, before any includes but after the intrinsic
|
|
23
|
+
* declaration. This is necessary with
|
|
24
|
+
* Clang <=15.x. With Clang 16.0 and above, these macro definitions are
|
|
25
|
+
* no longer required, but they're harmless. See
|
|
26
|
+
* https://reviews.llvm.org/D131064
|
|
27
|
+
*/
|
|
28
|
+
#define __ARM_FEATURE_SHA512 1
|
|
29
|
+
#define MBEDTLS_ENABLE_ARM_SHA3_EXTENSIONS_COMPILER_FLAG
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#include "tf_psa_crypto_common.h"
|
|
33
|
+
|
|
34
|
+
#if defined(MBEDTLS_SHA512_C) || defined(MBEDTLS_SHA384_C)
|
|
35
|
+
|
|
36
|
+
#include "mbedtls/private/sha512.h"
|
|
37
|
+
#include "mbedtls/platform_util.h"
|
|
38
|
+
#include "mbedtls/private/error_common.h"
|
|
39
|
+
|
|
40
|
+
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
|
41
|
+
#define UL64(x) x##ui64
|
|
42
|
+
#else
|
|
43
|
+
#define UL64(x) x##ULL
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#include <string.h>
|
|
47
|
+
|
|
48
|
+
#include "mbedtls/platform.h"
|
|
49
|
+
|
|
50
|
+
#if defined(__aarch64__)
|
|
51
|
+
# if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \
|
|
52
|
+
defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY)
|
|
53
|
+
/* *INDENT-OFF* */
|
|
54
|
+
# if !defined(MBEDTLS_HAVE_NEON_INTRINSICS)
|
|
55
|
+
# error "Target does not support NEON instructions"
|
|
56
|
+
# endif
|
|
57
|
+
/*
|
|
58
|
+
* Best performance comes from most recent compilers, with intrinsics and -O3.
|
|
59
|
+
* Must compile with -march=armv8.2-a+sha3, but we can't detect armv8.2-a, and
|
|
60
|
+
* can't always detect __ARM_FEATURE_SHA512 (notably clang 7-12).
|
|
61
|
+
*
|
|
62
|
+
* GCC < 8 won't work at all (lacks the sha512 instructions)
|
|
63
|
+
* GCC >= 8 uses intrinsics, sets __ARM_FEATURE_SHA512
|
|
64
|
+
*
|
|
65
|
+
* Clang < 7 won't work at all (lacks the sha512 instructions)
|
|
66
|
+
* Clang 7-12 don't have intrinsics (but we work around that with inline
|
|
67
|
+
* assembler) or __ARM_FEATURE_SHA512
|
|
68
|
+
* Clang == 13.0.0 same as clang 12 (only seen on macOS)
|
|
69
|
+
* Clang >= 13.0.1 has __ARM_FEATURE_SHA512 and intrinsics
|
|
70
|
+
*/
|
|
71
|
+
# if !defined(__ARM_FEATURE_SHA512) || defined(MBEDTLS_ENABLE_ARM_SHA3_EXTENSIONS_COMPILER_FLAG)
|
|
72
|
+
/* Test Clang first, as it defines __GNUC__ */
|
|
73
|
+
# if defined(__ARMCOMPILER_VERSION)
|
|
74
|
+
# if __ARMCOMPILER_VERSION < 6090000
|
|
75
|
+
# error "A more recent armclang is required for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
|
76
|
+
# elif __ARMCOMPILER_VERSION == 6090000
|
|
77
|
+
# error "Must use minimum -march=armv8.2-a+sha3 for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
|
78
|
+
# else
|
|
79
|
+
# pragma clang attribute push (__attribute__((target("sha3"))), apply_to=function)
|
|
80
|
+
# define MBEDTLS_POP_TARGET_PRAGMA
|
|
81
|
+
# endif
|
|
82
|
+
# elif defined(__clang__)
|
|
83
|
+
# if __clang_major__ < 7
|
|
84
|
+
# error "A more recent Clang is required for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
|
85
|
+
# else
|
|
86
|
+
# pragma clang attribute push (__attribute__((target("sha3"))), apply_to=function)
|
|
87
|
+
# define MBEDTLS_POP_TARGET_PRAGMA
|
|
88
|
+
# endif
|
|
89
|
+
# elif defined(__GNUC__)
|
|
90
|
+
# if __GNUC__ < 8
|
|
91
|
+
# error "A more recent GCC is required for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
|
92
|
+
# else
|
|
93
|
+
# pragma GCC push_options
|
|
94
|
+
# pragma GCC target ("arch=armv8.2-a+sha3")
|
|
95
|
+
# define MBEDTLS_POP_TARGET_PRAGMA
|
|
96
|
+
# endif
|
|
97
|
+
# else
|
|
98
|
+
# error "Only GCC and Clang supported for MBEDTLS_SHA512_USE_A64_CRYPTO_*"
|
|
99
|
+
# endif
|
|
100
|
+
# endif
|
|
101
|
+
/* *INDENT-ON* */
|
|
102
|
+
# endif
|
|
103
|
+
# if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT)
|
|
104
|
+
# if defined(__unix__)
|
|
105
|
+
# if defined(__linux__)
|
|
106
|
+
/* Our preferred method of detection is getauxval() */
|
|
107
|
+
# include <sys/auxv.h>
|
|
108
|
+
# if !defined(HWCAP_SHA512)
|
|
109
|
+
/* The same header that declares getauxval() should provide the HWCAP_xxx
|
|
110
|
+
* constants to analyze its return value. However, the libc may be too
|
|
111
|
+
* old to have the constant that we need. So if it's missing, assume that
|
|
112
|
+
* the value is the same one used by the Linux kernel ABI.
|
|
113
|
+
*/
|
|
114
|
+
# define HWCAP_SHA512 (1 << 21)
|
|
115
|
+
# endif
|
|
116
|
+
# endif
|
|
117
|
+
/* Use SIGILL on Unix, and fall back to it on Linux */
|
|
118
|
+
# include <signal.h>
|
|
119
|
+
# endif
|
|
120
|
+
# endif
|
|
121
|
+
#elif !defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
|
|
122
|
+
# undef MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY
|
|
123
|
+
# undef MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT
|
|
124
|
+
#endif
|
|
125
|
+
|
|
126
|
+
#if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT)
|
|
127
|
+
/*
|
|
128
|
+
* Capability detection code comes early, so we can disable
|
|
129
|
+
* MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT if no detection mechanism found
|
|
130
|
+
*/
|
|
131
|
+
#if defined(HWCAP_SHA512)
|
|
132
|
+
static int mbedtls_a64_crypto_sha512_determine_support(void)
|
|
133
|
+
{
|
|
134
|
+
return (getauxval(AT_HWCAP) & HWCAP_SHA512) ? 1 : 0;
|
|
135
|
+
}
|
|
136
|
+
#elif defined(__APPLE__)
|
|
137
|
+
#include <sys/types.h>
|
|
138
|
+
#include <sys/sysctl.h>
|
|
139
|
+
|
|
140
|
+
static int mbedtls_a64_crypto_sha512_determine_support(void)
|
|
141
|
+
{
|
|
142
|
+
int value = 0;
|
|
143
|
+
size_t value_len = sizeof(value);
|
|
144
|
+
|
|
145
|
+
int ret = sysctlbyname("hw.optional.armv8_2_sha512", &value, &value_len,
|
|
146
|
+
NULL, 0);
|
|
147
|
+
return ret == 0 && value != 0;
|
|
148
|
+
}
|
|
149
|
+
#elif defined(MBEDTLS_PLATFORM_IS_WINDOWS_ON_ARM64)
|
|
150
|
+
/*
|
|
151
|
+
* As of March 2022, there don't appear to be any PF_ARM_V8_* flags
|
|
152
|
+
* available to pass to IsProcessorFeaturePresent() to check for
|
|
153
|
+
* SHA-512 support. So we fall back to the C code only.
|
|
154
|
+
*/
|
|
155
|
+
#if defined(_MSC_VER)
|
|
156
|
+
#pragma message "No mechanism to detect A64_CRYPTO found, using C code only"
|
|
157
|
+
#else
|
|
158
|
+
#warning "No mechanism to detect A64_CRYPTO found, using C code only"
|
|
159
|
+
#endif
|
|
160
|
+
#elif defined(__unix__) && defined(SIG_SETMASK)
|
|
161
|
+
/* Detection with SIGILL, setjmp() and longjmp() */
|
|
162
|
+
#include <signal.h>
|
|
163
|
+
#include <setjmp.h>
|
|
164
|
+
|
|
165
|
+
static jmp_buf return_from_sigill;
|
|
166
|
+
|
|
167
|
+
/*
|
|
168
|
+
* A64 SHA512 support detection via SIGILL
|
|
169
|
+
*/
|
|
170
|
+
static void sigill_handler(int signal)
|
|
171
|
+
{
|
|
172
|
+
(void) signal;
|
|
173
|
+
longjmp(return_from_sigill, 1);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
static int mbedtls_a64_crypto_sha512_determine_support(void)
|
|
177
|
+
{
|
|
178
|
+
struct sigaction old_action, new_action;
|
|
179
|
+
|
|
180
|
+
sigset_t old_mask;
|
|
181
|
+
if (sigprocmask(0, NULL, &old_mask)) {
|
|
182
|
+
return 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
sigemptyset(&new_action.sa_mask);
|
|
186
|
+
new_action.sa_flags = 0;
|
|
187
|
+
new_action.sa_handler = sigill_handler;
|
|
188
|
+
|
|
189
|
+
sigaction(SIGILL, &new_action, &old_action);
|
|
190
|
+
|
|
191
|
+
static int ret = 0;
|
|
192
|
+
|
|
193
|
+
if (setjmp(return_from_sigill) == 0) { /* First return only */
|
|
194
|
+
/* If this traps, we will return a second time from setjmp() with 1 */
|
|
195
|
+
asm ("sha512h q0, q0, v0.2d" : : : "v0");
|
|
196
|
+
ret = 1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
sigaction(SIGILL, &old_action, NULL);
|
|
200
|
+
sigprocmask(SIG_SETMASK, &old_mask, NULL);
|
|
201
|
+
|
|
202
|
+
return ret;
|
|
203
|
+
}
|
|
204
|
+
#else
|
|
205
|
+
#warning "No mechanism to detect A64_CRYPTO found, using C code only"
|
|
206
|
+
#undef MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT
|
|
207
|
+
#endif /* HWCAP_SHA512, __APPLE__, __unix__ && SIG_SETMASK */
|
|
208
|
+
|
|
209
|
+
#endif /* MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT */
|
|
210
|
+
|
|
211
|
+
#define SHA512_BLOCK_SIZE 128
|
|
212
|
+
|
|
213
|
+
#if defined(MBEDTLS_SHA512_SMALLER)
|
|
214
|
+
static void sha512_put_uint64_be(uint64_t n, unsigned char *b, uint8_t i)
|
|
215
|
+
{
|
|
216
|
+
MBEDTLS_PUT_UINT64_BE(n, b, i);
|
|
217
|
+
}
|
|
218
|
+
#else
|
|
219
|
+
#define sha512_put_uint64_be MBEDTLS_PUT_UINT64_BE
|
|
220
|
+
#endif /* MBEDTLS_SHA512_SMALLER */
|
|
221
|
+
|
|
222
|
+
void mbedtls_sha512_init(mbedtls_sha512_context *ctx)
|
|
223
|
+
{
|
|
224
|
+
memset(ctx, 0, sizeof(mbedtls_sha512_context));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
void mbedtls_sha512_free(mbedtls_sha512_context *ctx)
|
|
228
|
+
{
|
|
229
|
+
if (ctx == NULL) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_sha512_context));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
void mbedtls_sha512_clone(mbedtls_sha512_context *dst,
|
|
237
|
+
const mbedtls_sha512_context *src)
|
|
238
|
+
{
|
|
239
|
+
*dst = *src;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/*
|
|
243
|
+
* SHA-512 context setup
|
|
244
|
+
*/
|
|
245
|
+
int mbedtls_sha512_starts(mbedtls_sha512_context *ctx, int is384)
|
|
246
|
+
{
|
|
247
|
+
#if defined(MBEDTLS_SHA384_C) && defined(MBEDTLS_SHA512_C)
|
|
248
|
+
if (is384 != 0 && is384 != 1) {
|
|
249
|
+
return MBEDTLS_ERR_SHA512_BAD_INPUT_DATA;
|
|
250
|
+
}
|
|
251
|
+
#elif defined(MBEDTLS_SHA512_C)
|
|
252
|
+
if (is384 != 0) {
|
|
253
|
+
return MBEDTLS_ERR_SHA512_BAD_INPUT_DATA;
|
|
254
|
+
}
|
|
255
|
+
#else /* defined MBEDTLS_SHA384_C only */
|
|
256
|
+
if (is384 == 0) {
|
|
257
|
+
return MBEDTLS_ERR_SHA512_BAD_INPUT_DATA;
|
|
258
|
+
}
|
|
259
|
+
#endif
|
|
260
|
+
|
|
261
|
+
ctx->total[0] = 0;
|
|
262
|
+
ctx->total[1] = 0;
|
|
263
|
+
|
|
264
|
+
if (is384 == 0) {
|
|
265
|
+
#if defined(MBEDTLS_SHA512_C)
|
|
266
|
+
ctx->state[0] = UL64(0x6A09E667F3BCC908);
|
|
267
|
+
ctx->state[1] = UL64(0xBB67AE8584CAA73B);
|
|
268
|
+
ctx->state[2] = UL64(0x3C6EF372FE94F82B);
|
|
269
|
+
ctx->state[3] = UL64(0xA54FF53A5F1D36F1);
|
|
270
|
+
ctx->state[4] = UL64(0x510E527FADE682D1);
|
|
271
|
+
ctx->state[5] = UL64(0x9B05688C2B3E6C1F);
|
|
272
|
+
ctx->state[6] = UL64(0x1F83D9ABFB41BD6B);
|
|
273
|
+
ctx->state[7] = UL64(0x5BE0CD19137E2179);
|
|
274
|
+
#endif /* MBEDTLS_SHA512_C */
|
|
275
|
+
} else {
|
|
276
|
+
#if defined(MBEDTLS_SHA384_C)
|
|
277
|
+
ctx->state[0] = UL64(0xCBBB9D5DC1059ED8);
|
|
278
|
+
ctx->state[1] = UL64(0x629A292A367CD507);
|
|
279
|
+
ctx->state[2] = UL64(0x9159015A3070DD17);
|
|
280
|
+
ctx->state[3] = UL64(0x152FECD8F70E5939);
|
|
281
|
+
ctx->state[4] = UL64(0x67332667FFC00B31);
|
|
282
|
+
ctx->state[5] = UL64(0x8EB44A8768581511);
|
|
283
|
+
ctx->state[6] = UL64(0xDB0C2E0D64F98FA7);
|
|
284
|
+
ctx->state[7] = UL64(0x47B5481DBEFA4FA4);
|
|
285
|
+
#endif /* MBEDTLS_SHA384_C */
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
#if defined(MBEDTLS_SHA384_C)
|
|
289
|
+
ctx->is384 = is384;
|
|
290
|
+
#endif
|
|
291
|
+
|
|
292
|
+
return 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/*
|
|
296
|
+
* Round constants
|
|
297
|
+
*/
|
|
298
|
+
static const uint64_t K[80] =
|
|
299
|
+
{
|
|
300
|
+
UL64(0x428A2F98D728AE22), UL64(0x7137449123EF65CD),
|
|
301
|
+
UL64(0xB5C0FBCFEC4D3B2F), UL64(0xE9B5DBA58189DBBC),
|
|
302
|
+
UL64(0x3956C25BF348B538), UL64(0x59F111F1B605D019),
|
|
303
|
+
UL64(0x923F82A4AF194F9B), UL64(0xAB1C5ED5DA6D8118),
|
|
304
|
+
UL64(0xD807AA98A3030242), UL64(0x12835B0145706FBE),
|
|
305
|
+
UL64(0x243185BE4EE4B28C), UL64(0x550C7DC3D5FFB4E2),
|
|
306
|
+
UL64(0x72BE5D74F27B896F), UL64(0x80DEB1FE3B1696B1),
|
|
307
|
+
UL64(0x9BDC06A725C71235), UL64(0xC19BF174CF692694),
|
|
308
|
+
UL64(0xE49B69C19EF14AD2), UL64(0xEFBE4786384F25E3),
|
|
309
|
+
UL64(0x0FC19DC68B8CD5B5), UL64(0x240CA1CC77AC9C65),
|
|
310
|
+
UL64(0x2DE92C6F592B0275), UL64(0x4A7484AA6EA6E483),
|
|
311
|
+
UL64(0x5CB0A9DCBD41FBD4), UL64(0x76F988DA831153B5),
|
|
312
|
+
UL64(0x983E5152EE66DFAB), UL64(0xA831C66D2DB43210),
|
|
313
|
+
UL64(0xB00327C898FB213F), UL64(0xBF597FC7BEEF0EE4),
|
|
314
|
+
UL64(0xC6E00BF33DA88FC2), UL64(0xD5A79147930AA725),
|
|
315
|
+
UL64(0x06CA6351E003826F), UL64(0x142929670A0E6E70),
|
|
316
|
+
UL64(0x27B70A8546D22FFC), UL64(0x2E1B21385C26C926),
|
|
317
|
+
UL64(0x4D2C6DFC5AC42AED), UL64(0x53380D139D95B3DF),
|
|
318
|
+
UL64(0x650A73548BAF63DE), UL64(0x766A0ABB3C77B2A8),
|
|
319
|
+
UL64(0x81C2C92E47EDAEE6), UL64(0x92722C851482353B),
|
|
320
|
+
UL64(0xA2BFE8A14CF10364), UL64(0xA81A664BBC423001),
|
|
321
|
+
UL64(0xC24B8B70D0F89791), UL64(0xC76C51A30654BE30),
|
|
322
|
+
UL64(0xD192E819D6EF5218), UL64(0xD69906245565A910),
|
|
323
|
+
UL64(0xF40E35855771202A), UL64(0x106AA07032BBD1B8),
|
|
324
|
+
UL64(0x19A4C116B8D2D0C8), UL64(0x1E376C085141AB53),
|
|
325
|
+
UL64(0x2748774CDF8EEB99), UL64(0x34B0BCB5E19B48A8),
|
|
326
|
+
UL64(0x391C0CB3C5C95A63), UL64(0x4ED8AA4AE3418ACB),
|
|
327
|
+
UL64(0x5B9CCA4F7763E373), UL64(0x682E6FF3D6B2B8A3),
|
|
328
|
+
UL64(0x748F82EE5DEFB2FC), UL64(0x78A5636F43172F60),
|
|
329
|
+
UL64(0x84C87814A1F0AB72), UL64(0x8CC702081A6439EC),
|
|
330
|
+
UL64(0x90BEFFFA23631E28), UL64(0xA4506CEBDE82BDE9),
|
|
331
|
+
UL64(0xBEF9A3F7B2C67915), UL64(0xC67178F2E372532B),
|
|
332
|
+
UL64(0xCA273ECEEA26619C), UL64(0xD186B8C721C0C207),
|
|
333
|
+
UL64(0xEADA7DD6CDE0EB1E), UL64(0xF57D4F7FEE6ED178),
|
|
334
|
+
UL64(0x06F067AA72176FBA), UL64(0x0A637DC5A2C898A6),
|
|
335
|
+
UL64(0x113F9804BEF90DAE), UL64(0x1B710B35131C471B),
|
|
336
|
+
UL64(0x28DB77F523047D84), UL64(0x32CAAB7B40C72493),
|
|
337
|
+
UL64(0x3C9EBE0A15C9BEBC), UL64(0x431D67C49C100D4C),
|
|
338
|
+
UL64(0x4CC5D4BECB3E42B6), UL64(0x597F299CFC657E2A),
|
|
339
|
+
UL64(0x5FCB6FAB3AD6FAEC), UL64(0x6C44198C4A475817)
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
#if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \
|
|
343
|
+
defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY)
|
|
344
|
+
|
|
345
|
+
#if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY)
|
|
346
|
+
# define mbedtls_internal_sha512_process_many_a64_crypto mbedtls_internal_sha512_process_many
|
|
347
|
+
# define mbedtls_internal_sha512_process_a64_crypto mbedtls_internal_sha512_process
|
|
348
|
+
#endif
|
|
349
|
+
|
|
350
|
+
/* Accelerated SHA-512 implementation originally written by Simon Tatham for PuTTY,
|
|
351
|
+
* under the MIT licence; dual-licensed as Apache 2 with his kind permission.
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
#if defined(__clang__) && \
|
|
355
|
+
(__clang_major__ < 13 || \
|
|
356
|
+
(__clang_major__ == 13 && __clang_minor__ == 0 && __clang_patchlevel__ == 0))
|
|
357
|
+
static inline uint64x2_t vsha512su0q_u64(uint64x2_t x, uint64x2_t y)
|
|
358
|
+
{
|
|
359
|
+
asm ("sha512su0 %0.2D,%1.2D" : "+w" (x) : "w" (y));
|
|
360
|
+
return x;
|
|
361
|
+
}
|
|
362
|
+
static inline uint64x2_t vsha512su1q_u64(uint64x2_t x, uint64x2_t y, uint64x2_t z)
|
|
363
|
+
{
|
|
364
|
+
asm ("sha512su1 %0.2D,%1.2D,%2.2D" : "+w" (x) : "w" (y), "w" (z));
|
|
365
|
+
return x;
|
|
366
|
+
}
|
|
367
|
+
static inline uint64x2_t vsha512hq_u64(uint64x2_t x, uint64x2_t y, uint64x2_t z)
|
|
368
|
+
{
|
|
369
|
+
asm ("sha512h %0,%1,%2.2D" : "+w" (x) : "w" (y), "w" (z));
|
|
370
|
+
return x;
|
|
371
|
+
}
|
|
372
|
+
static inline uint64x2_t vsha512h2q_u64(uint64x2_t x, uint64x2_t y, uint64x2_t z)
|
|
373
|
+
{
|
|
374
|
+
asm ("sha512h2 %0,%1,%2.2D" : "+w" (x) : "w" (y), "w" (z));
|
|
375
|
+
return x;
|
|
376
|
+
}
|
|
377
|
+
#endif /* __clang__ etc */
|
|
378
|
+
|
|
379
|
+
static size_t mbedtls_internal_sha512_process_many_a64_crypto(
|
|
380
|
+
mbedtls_sha512_context *ctx, const uint8_t *msg, size_t len)
|
|
381
|
+
{
|
|
382
|
+
uint64x2_t ab = vld1q_u64(&ctx->state[0]);
|
|
383
|
+
uint64x2_t cd = vld1q_u64(&ctx->state[2]);
|
|
384
|
+
uint64x2_t ef = vld1q_u64(&ctx->state[4]);
|
|
385
|
+
uint64x2_t gh = vld1q_u64(&ctx->state[6]);
|
|
386
|
+
|
|
387
|
+
size_t processed = 0;
|
|
388
|
+
|
|
389
|
+
for (;
|
|
390
|
+
len >= SHA512_BLOCK_SIZE;
|
|
391
|
+
processed += SHA512_BLOCK_SIZE,
|
|
392
|
+
msg += SHA512_BLOCK_SIZE,
|
|
393
|
+
len -= SHA512_BLOCK_SIZE) {
|
|
394
|
+
uint64x2_t initial_sum, sum, intermed;
|
|
395
|
+
|
|
396
|
+
uint64x2_t ab_orig = ab;
|
|
397
|
+
uint64x2_t cd_orig = cd;
|
|
398
|
+
uint64x2_t ef_orig = ef;
|
|
399
|
+
uint64x2_t gh_orig = gh;
|
|
400
|
+
|
|
401
|
+
uint64x2_t s0 = (uint64x2_t) vld1q_u8(msg + 16 * 0);
|
|
402
|
+
uint64x2_t s1 = (uint64x2_t) vld1q_u8(msg + 16 * 1);
|
|
403
|
+
uint64x2_t s2 = (uint64x2_t) vld1q_u8(msg + 16 * 2);
|
|
404
|
+
uint64x2_t s3 = (uint64x2_t) vld1q_u8(msg + 16 * 3);
|
|
405
|
+
uint64x2_t s4 = (uint64x2_t) vld1q_u8(msg + 16 * 4);
|
|
406
|
+
uint64x2_t s5 = (uint64x2_t) vld1q_u8(msg + 16 * 5);
|
|
407
|
+
uint64x2_t s6 = (uint64x2_t) vld1q_u8(msg + 16 * 6);
|
|
408
|
+
uint64x2_t s7 = (uint64x2_t) vld1q_u8(msg + 16 * 7);
|
|
409
|
+
|
|
410
|
+
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ /* assume LE if these not defined; untested on BE */
|
|
411
|
+
s0 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s0)));
|
|
412
|
+
s1 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s1)));
|
|
413
|
+
s2 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s2)));
|
|
414
|
+
s3 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s3)));
|
|
415
|
+
s4 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s4)));
|
|
416
|
+
s5 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s5)));
|
|
417
|
+
s6 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s6)));
|
|
418
|
+
s7 = vreinterpretq_u64_u8(vrev64q_u8(vreinterpretq_u8_u64(s7)));
|
|
419
|
+
#endif
|
|
420
|
+
|
|
421
|
+
/* Rounds 0 and 1 */
|
|
422
|
+
initial_sum = vaddq_u64(s0, vld1q_u64(&K[0]));
|
|
423
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), gh);
|
|
424
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ef, gh, 1), vextq_u64(cd, ef, 1));
|
|
425
|
+
gh = vsha512h2q_u64(intermed, cd, ab);
|
|
426
|
+
cd = vaddq_u64(cd, intermed);
|
|
427
|
+
|
|
428
|
+
/* Rounds 2 and 3 */
|
|
429
|
+
initial_sum = vaddq_u64(s1, vld1q_u64(&K[2]));
|
|
430
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ef);
|
|
431
|
+
intermed = vsha512hq_u64(sum, vextq_u64(cd, ef, 1), vextq_u64(ab, cd, 1));
|
|
432
|
+
ef = vsha512h2q_u64(intermed, ab, gh);
|
|
433
|
+
ab = vaddq_u64(ab, intermed);
|
|
434
|
+
|
|
435
|
+
/* Rounds 4 and 5 */
|
|
436
|
+
initial_sum = vaddq_u64(s2, vld1q_u64(&K[4]));
|
|
437
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), cd);
|
|
438
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ab, cd, 1), vextq_u64(gh, ab, 1));
|
|
439
|
+
cd = vsha512h2q_u64(intermed, gh, ef);
|
|
440
|
+
gh = vaddq_u64(gh, intermed);
|
|
441
|
+
|
|
442
|
+
/* Rounds 6 and 7 */
|
|
443
|
+
initial_sum = vaddq_u64(s3, vld1q_u64(&K[6]));
|
|
444
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ab);
|
|
445
|
+
intermed = vsha512hq_u64(sum, vextq_u64(gh, ab, 1), vextq_u64(ef, gh, 1));
|
|
446
|
+
ab = vsha512h2q_u64(intermed, ef, cd);
|
|
447
|
+
ef = vaddq_u64(ef, intermed);
|
|
448
|
+
|
|
449
|
+
/* Rounds 8 and 9 */
|
|
450
|
+
initial_sum = vaddq_u64(s4, vld1q_u64(&K[8]));
|
|
451
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), gh);
|
|
452
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ef, gh, 1), vextq_u64(cd, ef, 1));
|
|
453
|
+
gh = vsha512h2q_u64(intermed, cd, ab);
|
|
454
|
+
cd = vaddq_u64(cd, intermed);
|
|
455
|
+
|
|
456
|
+
/* Rounds 10 and 11 */
|
|
457
|
+
initial_sum = vaddq_u64(s5, vld1q_u64(&K[10]));
|
|
458
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ef);
|
|
459
|
+
intermed = vsha512hq_u64(sum, vextq_u64(cd, ef, 1), vextq_u64(ab, cd, 1));
|
|
460
|
+
ef = vsha512h2q_u64(intermed, ab, gh);
|
|
461
|
+
ab = vaddq_u64(ab, intermed);
|
|
462
|
+
|
|
463
|
+
/* Rounds 12 and 13 */
|
|
464
|
+
initial_sum = vaddq_u64(s6, vld1q_u64(&K[12]));
|
|
465
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), cd);
|
|
466
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ab, cd, 1), vextq_u64(gh, ab, 1));
|
|
467
|
+
cd = vsha512h2q_u64(intermed, gh, ef);
|
|
468
|
+
gh = vaddq_u64(gh, intermed);
|
|
469
|
+
|
|
470
|
+
/* Rounds 14 and 15 */
|
|
471
|
+
initial_sum = vaddq_u64(s7, vld1q_u64(&K[14]));
|
|
472
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ab);
|
|
473
|
+
intermed = vsha512hq_u64(sum, vextq_u64(gh, ab, 1), vextq_u64(ef, gh, 1));
|
|
474
|
+
ab = vsha512h2q_u64(intermed, ef, cd);
|
|
475
|
+
ef = vaddq_u64(ef, intermed);
|
|
476
|
+
|
|
477
|
+
for (unsigned int t = 16; t < 80; t += 16) {
|
|
478
|
+
/* Rounds t and t + 1 */
|
|
479
|
+
s0 = vsha512su1q_u64(vsha512su0q_u64(s0, s1), s7, vextq_u64(s4, s5, 1));
|
|
480
|
+
initial_sum = vaddq_u64(s0, vld1q_u64(&K[t]));
|
|
481
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), gh);
|
|
482
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ef, gh, 1), vextq_u64(cd, ef, 1));
|
|
483
|
+
gh = vsha512h2q_u64(intermed, cd, ab);
|
|
484
|
+
cd = vaddq_u64(cd, intermed);
|
|
485
|
+
|
|
486
|
+
/* Rounds t + 2 and t + 3 */
|
|
487
|
+
s1 = vsha512su1q_u64(vsha512su0q_u64(s1, s2), s0, vextq_u64(s5, s6, 1));
|
|
488
|
+
initial_sum = vaddq_u64(s1, vld1q_u64(&K[t + 2]));
|
|
489
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ef);
|
|
490
|
+
intermed = vsha512hq_u64(sum, vextq_u64(cd, ef, 1), vextq_u64(ab, cd, 1));
|
|
491
|
+
ef = vsha512h2q_u64(intermed, ab, gh);
|
|
492
|
+
ab = vaddq_u64(ab, intermed);
|
|
493
|
+
|
|
494
|
+
/* Rounds t + 4 and t + 5 */
|
|
495
|
+
s2 = vsha512su1q_u64(vsha512su0q_u64(s2, s3), s1, vextq_u64(s6, s7, 1));
|
|
496
|
+
initial_sum = vaddq_u64(s2, vld1q_u64(&K[t + 4]));
|
|
497
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), cd);
|
|
498
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ab, cd, 1), vextq_u64(gh, ab, 1));
|
|
499
|
+
cd = vsha512h2q_u64(intermed, gh, ef);
|
|
500
|
+
gh = vaddq_u64(gh, intermed);
|
|
501
|
+
|
|
502
|
+
/* Rounds t + 6 and t + 7 */
|
|
503
|
+
s3 = vsha512su1q_u64(vsha512su0q_u64(s3, s4), s2, vextq_u64(s7, s0, 1));
|
|
504
|
+
initial_sum = vaddq_u64(s3, vld1q_u64(&K[t + 6]));
|
|
505
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ab);
|
|
506
|
+
intermed = vsha512hq_u64(sum, vextq_u64(gh, ab, 1), vextq_u64(ef, gh, 1));
|
|
507
|
+
ab = vsha512h2q_u64(intermed, ef, cd);
|
|
508
|
+
ef = vaddq_u64(ef, intermed);
|
|
509
|
+
|
|
510
|
+
/* Rounds t + 8 and t + 9 */
|
|
511
|
+
s4 = vsha512su1q_u64(vsha512su0q_u64(s4, s5), s3, vextq_u64(s0, s1, 1));
|
|
512
|
+
initial_sum = vaddq_u64(s4, vld1q_u64(&K[t + 8]));
|
|
513
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), gh);
|
|
514
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ef, gh, 1), vextq_u64(cd, ef, 1));
|
|
515
|
+
gh = vsha512h2q_u64(intermed, cd, ab);
|
|
516
|
+
cd = vaddq_u64(cd, intermed);
|
|
517
|
+
|
|
518
|
+
/* Rounds t + 10 and t + 11 */
|
|
519
|
+
s5 = vsha512su1q_u64(vsha512su0q_u64(s5, s6), s4, vextq_u64(s1, s2, 1));
|
|
520
|
+
initial_sum = vaddq_u64(s5, vld1q_u64(&K[t + 10]));
|
|
521
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ef);
|
|
522
|
+
intermed = vsha512hq_u64(sum, vextq_u64(cd, ef, 1), vextq_u64(ab, cd, 1));
|
|
523
|
+
ef = vsha512h2q_u64(intermed, ab, gh);
|
|
524
|
+
ab = vaddq_u64(ab, intermed);
|
|
525
|
+
|
|
526
|
+
/* Rounds t + 12 and t + 13 */
|
|
527
|
+
s6 = vsha512su1q_u64(vsha512su0q_u64(s6, s7), s5, vextq_u64(s2, s3, 1));
|
|
528
|
+
initial_sum = vaddq_u64(s6, vld1q_u64(&K[t + 12]));
|
|
529
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), cd);
|
|
530
|
+
intermed = vsha512hq_u64(sum, vextq_u64(ab, cd, 1), vextq_u64(gh, ab, 1));
|
|
531
|
+
cd = vsha512h2q_u64(intermed, gh, ef);
|
|
532
|
+
gh = vaddq_u64(gh, intermed);
|
|
533
|
+
|
|
534
|
+
/* Rounds t + 14 and t + 15 */
|
|
535
|
+
s7 = vsha512su1q_u64(vsha512su0q_u64(s7, s0), s6, vextq_u64(s3, s4, 1));
|
|
536
|
+
initial_sum = vaddq_u64(s7, vld1q_u64(&K[t + 14]));
|
|
537
|
+
sum = vaddq_u64(vextq_u64(initial_sum, initial_sum, 1), ab);
|
|
538
|
+
intermed = vsha512hq_u64(sum, vextq_u64(gh, ab, 1), vextq_u64(ef, gh, 1));
|
|
539
|
+
ab = vsha512h2q_u64(intermed, ef, cd);
|
|
540
|
+
ef = vaddq_u64(ef, intermed);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
ab = vaddq_u64(ab, ab_orig);
|
|
544
|
+
cd = vaddq_u64(cd, cd_orig);
|
|
545
|
+
ef = vaddq_u64(ef, ef_orig);
|
|
546
|
+
gh = vaddq_u64(gh, gh_orig);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
vst1q_u64(&ctx->state[0], ab);
|
|
550
|
+
vst1q_u64(&ctx->state[2], cd);
|
|
551
|
+
vst1q_u64(&ctx->state[4], ef);
|
|
552
|
+
vst1q_u64(&ctx->state[6], gh);
|
|
553
|
+
|
|
554
|
+
return processed;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
static int mbedtls_internal_sha512_process_a64_crypto(mbedtls_sha512_context *ctx,
|
|
558
|
+
const unsigned char data[SHA512_BLOCK_SIZE])
|
|
559
|
+
{
|
|
560
|
+
return (mbedtls_internal_sha512_process_many_a64_crypto(ctx, data,
|
|
561
|
+
SHA512_BLOCK_SIZE) ==
|
|
562
|
+
SHA512_BLOCK_SIZE) ? 0 : -1;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
#endif /* MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT || MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY */
|
|
566
|
+
|
|
567
|
+
#if defined(MBEDTLS_POP_TARGET_PRAGMA)
|
|
568
|
+
#if defined(__clang__)
|
|
569
|
+
#pragma clang attribute pop
|
|
570
|
+
#elif defined(__GNUC__)
|
|
571
|
+
#pragma GCC pop_options
|
|
572
|
+
#endif
|
|
573
|
+
#undef MBEDTLS_POP_TARGET_PRAGMA
|
|
574
|
+
#endif
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
#if !defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT)
|
|
578
|
+
#define mbedtls_internal_sha512_process_many_c mbedtls_internal_sha512_process_many
|
|
579
|
+
#define mbedtls_internal_sha512_process_c mbedtls_internal_sha512_process
|
|
580
|
+
#endif
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
#if !defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY)
|
|
584
|
+
|
|
585
|
+
static int mbedtls_internal_sha512_process_c(mbedtls_sha512_context *ctx,
|
|
586
|
+
const unsigned char data[SHA512_BLOCK_SIZE])
|
|
587
|
+
{
|
|
588
|
+
int i;
|
|
589
|
+
struct {
|
|
590
|
+
uint64_t temp1, temp2, W[80];
|
|
591
|
+
uint64_t A[8];
|
|
592
|
+
} local;
|
|
593
|
+
|
|
594
|
+
#define SHR(x, n) ((x) >> (n))
|
|
595
|
+
#define ROTR(x, n) (SHR((x), (n)) | ((x) << (64 - (n))))
|
|
596
|
+
|
|
597
|
+
#define S0(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7))
|
|
598
|
+
#define S1(x) (ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6))
|
|
599
|
+
|
|
600
|
+
#define S2(x) (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39))
|
|
601
|
+
#define S3(x) (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41))
|
|
602
|
+
|
|
603
|
+
#define F0(x, y, z) (((x) & (y)) | ((z) & ((x) | (y))))
|
|
604
|
+
#define F1(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
|
|
605
|
+
|
|
606
|
+
#define P(a, b, c, d, e, f, g, h, x, K) \
|
|
607
|
+
do \
|
|
608
|
+
{ \
|
|
609
|
+
local.temp1 = (h) + S3(e) + F1((e), (f), (g)) + (K) + (x); \
|
|
610
|
+
local.temp2 = S2(a) + F0((a), (b), (c)); \
|
|
611
|
+
(d) += local.temp1; (h) = local.temp1 + local.temp2; \
|
|
612
|
+
} while (0)
|
|
613
|
+
|
|
614
|
+
for (i = 0; i < 8; i++) {
|
|
615
|
+
local.A[i] = ctx->state[i];
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
#if defined(MBEDTLS_SHA512_SMALLER)
|
|
619
|
+
for (i = 0; i < 80; i++) {
|
|
620
|
+
if (i < 16) {
|
|
621
|
+
local.W[i] = MBEDTLS_GET_UINT64_BE(data, i << 3);
|
|
622
|
+
} else {
|
|
623
|
+
local.W[i] = S1(local.W[i - 2]) + local.W[i - 7] +
|
|
624
|
+
S0(local.W[i - 15]) + local.W[i - 16];
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4],
|
|
628
|
+
local.A[5], local.A[6], local.A[7], local.W[i], K[i]);
|
|
629
|
+
|
|
630
|
+
local.temp1 = local.A[7]; local.A[7] = local.A[6];
|
|
631
|
+
local.A[6] = local.A[5]; local.A[5] = local.A[4];
|
|
632
|
+
local.A[4] = local.A[3]; local.A[3] = local.A[2];
|
|
633
|
+
local.A[2] = local.A[1]; local.A[1] = local.A[0];
|
|
634
|
+
local.A[0] = local.temp1;
|
|
635
|
+
}
|
|
636
|
+
#else /* MBEDTLS_SHA512_SMALLER */
|
|
637
|
+
for (i = 0; i < 16; i++) {
|
|
638
|
+
local.W[i] = MBEDTLS_GET_UINT64_BE(data, i << 3);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
for (; i < 80; i++) {
|
|
642
|
+
local.W[i] = S1(local.W[i - 2]) + local.W[i - 7] +
|
|
643
|
+
S0(local.W[i - 15]) + local.W[i - 16];
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
i = 0;
|
|
647
|
+
do {
|
|
648
|
+
P(local.A[0], local.A[1], local.A[2], local.A[3], local.A[4],
|
|
649
|
+
local.A[5], local.A[6], local.A[7], local.W[i], K[i]); i++;
|
|
650
|
+
P(local.A[7], local.A[0], local.A[1], local.A[2], local.A[3],
|
|
651
|
+
local.A[4], local.A[5], local.A[6], local.W[i], K[i]); i++;
|
|
652
|
+
P(local.A[6], local.A[7], local.A[0], local.A[1], local.A[2],
|
|
653
|
+
local.A[3], local.A[4], local.A[5], local.W[i], K[i]); i++;
|
|
654
|
+
P(local.A[5], local.A[6], local.A[7], local.A[0], local.A[1],
|
|
655
|
+
local.A[2], local.A[3], local.A[4], local.W[i], K[i]); i++;
|
|
656
|
+
P(local.A[4], local.A[5], local.A[6], local.A[7], local.A[0],
|
|
657
|
+
local.A[1], local.A[2], local.A[3], local.W[i], K[i]); i++;
|
|
658
|
+
P(local.A[3], local.A[4], local.A[5], local.A[6], local.A[7],
|
|
659
|
+
local.A[0], local.A[1], local.A[2], local.W[i], K[i]); i++;
|
|
660
|
+
P(local.A[2], local.A[3], local.A[4], local.A[5], local.A[6],
|
|
661
|
+
local.A[7], local.A[0], local.A[1], local.W[i], K[i]); i++;
|
|
662
|
+
P(local.A[1], local.A[2], local.A[3], local.A[4], local.A[5],
|
|
663
|
+
local.A[6], local.A[7], local.A[0], local.W[i], K[i]); i++;
|
|
664
|
+
} while (i < 80);
|
|
665
|
+
#endif /* MBEDTLS_SHA512_SMALLER */
|
|
666
|
+
|
|
667
|
+
for (i = 0; i < 8; i++) {
|
|
668
|
+
ctx->state[i] += local.A[i];
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/* Zeroise buffers and variables to clear sensitive data from memory. */
|
|
672
|
+
mbedtls_platform_zeroize(&local, sizeof(local));
|
|
673
|
+
|
|
674
|
+
return 0;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
static size_t mbedtls_internal_sha512_process_many_c(
|
|
678
|
+
mbedtls_sha512_context *ctx, const uint8_t *data, size_t len)
|
|
679
|
+
{
|
|
680
|
+
size_t processed = 0;
|
|
681
|
+
|
|
682
|
+
while (len >= SHA512_BLOCK_SIZE) {
|
|
683
|
+
if (mbedtls_internal_sha512_process_c(ctx, data) != 0) {
|
|
684
|
+
return 0;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
data += SHA512_BLOCK_SIZE;
|
|
688
|
+
len -= SHA512_BLOCK_SIZE;
|
|
689
|
+
|
|
690
|
+
processed += SHA512_BLOCK_SIZE;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
return processed;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
#endif /* !MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY */
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
#if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT)
|
|
700
|
+
|
|
701
|
+
static int mbedtls_a64_crypto_sha512_has_support(void)
|
|
702
|
+
{
|
|
703
|
+
static int done = 0;
|
|
704
|
+
static int supported = 0;
|
|
705
|
+
|
|
706
|
+
if (!done) {
|
|
707
|
+
supported = mbedtls_a64_crypto_sha512_determine_support();
|
|
708
|
+
done = 1;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
return supported;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
static size_t mbedtls_internal_sha512_process_many(mbedtls_sha512_context *ctx,
|
|
715
|
+
const uint8_t *msg, size_t len)
|
|
716
|
+
{
|
|
717
|
+
if (mbedtls_a64_crypto_sha512_has_support()) {
|
|
718
|
+
return mbedtls_internal_sha512_process_many_a64_crypto(ctx, msg, len);
|
|
719
|
+
} else {
|
|
720
|
+
return mbedtls_internal_sha512_process_many_c(ctx, msg, len);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
static int mbedtls_internal_sha512_process(mbedtls_sha512_context *ctx,
|
|
725
|
+
const unsigned char data[SHA512_BLOCK_SIZE])
|
|
726
|
+
{
|
|
727
|
+
if (mbedtls_a64_crypto_sha512_has_support()) {
|
|
728
|
+
return mbedtls_internal_sha512_process_a64_crypto(ctx, data);
|
|
729
|
+
} else {
|
|
730
|
+
return mbedtls_internal_sha512_process_c(ctx, data);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
#endif /* MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT */
|
|
735
|
+
|
|
736
|
+
/*
|
|
737
|
+
* SHA-512 process buffer
|
|
738
|
+
*/
|
|
739
|
+
int mbedtls_sha512_update(mbedtls_sha512_context *ctx,
|
|
740
|
+
const unsigned char *input,
|
|
741
|
+
size_t ilen)
|
|
742
|
+
{
|
|
743
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
744
|
+
size_t fill;
|
|
745
|
+
unsigned int left;
|
|
746
|
+
|
|
747
|
+
if (ilen == 0) {
|
|
748
|
+
return 0;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
left = (unsigned int) (ctx->total[0] & 0x7F);
|
|
752
|
+
fill = SHA512_BLOCK_SIZE - left;
|
|
753
|
+
|
|
754
|
+
ctx->total[0] += (uint64_t) ilen;
|
|
755
|
+
|
|
756
|
+
if (ctx->total[0] < (uint64_t) ilen) {
|
|
757
|
+
ctx->total[1]++;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (left && ilen >= fill) {
|
|
761
|
+
memcpy((void *) (ctx->buffer + left), input, fill);
|
|
762
|
+
|
|
763
|
+
if ((ret = mbedtls_internal_sha512_process(ctx, ctx->buffer)) != 0) {
|
|
764
|
+
return ret;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
input += fill;
|
|
768
|
+
ilen -= fill;
|
|
769
|
+
left = 0;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
while (ilen >= SHA512_BLOCK_SIZE) {
|
|
773
|
+
size_t processed =
|
|
774
|
+
mbedtls_internal_sha512_process_many(ctx, input, ilen);
|
|
775
|
+
if (processed < SHA512_BLOCK_SIZE) {
|
|
776
|
+
return MBEDTLS_ERR_ERROR_GENERIC_ERROR;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
input += processed;
|
|
780
|
+
ilen -= processed;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
if (ilen > 0) {
|
|
784
|
+
memcpy((void *) (ctx->buffer + left), input, ilen);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
return 0;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/*
|
|
791
|
+
* SHA-512 final digest
|
|
792
|
+
*/
|
|
793
|
+
int mbedtls_sha512_finish(mbedtls_sha512_context *ctx,
|
|
794
|
+
unsigned char *output)
|
|
795
|
+
{
|
|
796
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
797
|
+
unsigned used;
|
|
798
|
+
uint64_t high, low;
|
|
799
|
+
int truncated = 0;
|
|
800
|
+
|
|
801
|
+
/*
|
|
802
|
+
* Add padding: 0x80 then 0x00 until 16 bytes remain for the length
|
|
803
|
+
*/
|
|
804
|
+
used = ctx->total[0] & 0x7F;
|
|
805
|
+
|
|
806
|
+
ctx->buffer[used++] = 0x80;
|
|
807
|
+
|
|
808
|
+
if (used <= 112) {
|
|
809
|
+
/* Enough room for padding + length in current block */
|
|
810
|
+
memset(ctx->buffer + used, 0, 112 - used);
|
|
811
|
+
} else {
|
|
812
|
+
/* We'll need an extra block */
|
|
813
|
+
memset(ctx->buffer + used, 0, SHA512_BLOCK_SIZE - used);
|
|
814
|
+
|
|
815
|
+
if ((ret = mbedtls_internal_sha512_process(ctx, ctx->buffer)) != 0) {
|
|
816
|
+
goto exit;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
memset(ctx->buffer, 0, 112);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/*
|
|
823
|
+
* Add message length
|
|
824
|
+
*/
|
|
825
|
+
high = (ctx->total[0] >> 61)
|
|
826
|
+
| (ctx->total[1] << 3);
|
|
827
|
+
low = (ctx->total[0] << 3);
|
|
828
|
+
|
|
829
|
+
sha512_put_uint64_be(high, ctx->buffer, 112);
|
|
830
|
+
sha512_put_uint64_be(low, ctx->buffer, 120);
|
|
831
|
+
|
|
832
|
+
if ((ret = mbedtls_internal_sha512_process(ctx, ctx->buffer)) != 0) {
|
|
833
|
+
goto exit;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/*
|
|
837
|
+
* Output final state
|
|
838
|
+
*/
|
|
839
|
+
sha512_put_uint64_be(ctx->state[0], output, 0);
|
|
840
|
+
sha512_put_uint64_be(ctx->state[1], output, 8);
|
|
841
|
+
sha512_put_uint64_be(ctx->state[2], output, 16);
|
|
842
|
+
sha512_put_uint64_be(ctx->state[3], output, 24);
|
|
843
|
+
sha512_put_uint64_be(ctx->state[4], output, 32);
|
|
844
|
+
sha512_put_uint64_be(ctx->state[5], output, 40);
|
|
845
|
+
|
|
846
|
+
#if defined(MBEDTLS_SHA384_C)
|
|
847
|
+
truncated = ctx->is384;
|
|
848
|
+
#endif
|
|
849
|
+
if (!truncated) {
|
|
850
|
+
sha512_put_uint64_be(ctx->state[6], output, 48);
|
|
851
|
+
sha512_put_uint64_be(ctx->state[7], output, 56);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
ret = 0;
|
|
855
|
+
|
|
856
|
+
exit:
|
|
857
|
+
mbedtls_sha512_free(ctx);
|
|
858
|
+
return ret;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/*
|
|
862
|
+
* output = SHA-512( input buffer )
|
|
863
|
+
*/
|
|
864
|
+
int mbedtls_sha512(const unsigned char *input,
|
|
865
|
+
size_t ilen,
|
|
866
|
+
unsigned char *output,
|
|
867
|
+
int is384)
|
|
868
|
+
{
|
|
869
|
+
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
|
870
|
+
mbedtls_sha512_context ctx;
|
|
871
|
+
|
|
872
|
+
#if defined(MBEDTLS_SHA384_C) && defined(MBEDTLS_SHA512_C)
|
|
873
|
+
if (is384 != 0 && is384 != 1) {
|
|
874
|
+
return MBEDTLS_ERR_SHA512_BAD_INPUT_DATA;
|
|
875
|
+
}
|
|
876
|
+
#elif defined(MBEDTLS_SHA512_C)
|
|
877
|
+
if (is384 != 0) {
|
|
878
|
+
return MBEDTLS_ERR_SHA512_BAD_INPUT_DATA;
|
|
879
|
+
}
|
|
880
|
+
#else /* defined MBEDTLS_SHA384_C only */
|
|
881
|
+
if (is384 == 0) {
|
|
882
|
+
return MBEDTLS_ERR_SHA512_BAD_INPUT_DATA;
|
|
883
|
+
}
|
|
884
|
+
#endif
|
|
885
|
+
|
|
886
|
+
mbedtls_sha512_init(&ctx);
|
|
887
|
+
|
|
888
|
+
if ((ret = mbedtls_sha512_starts(&ctx, is384)) != 0) {
|
|
889
|
+
goto exit;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
if ((ret = mbedtls_sha512_update(&ctx, input, ilen)) != 0) {
|
|
893
|
+
goto exit;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
if ((ret = mbedtls_sha512_finish(&ctx, output)) != 0) {
|
|
897
|
+
goto exit;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
exit:
|
|
901
|
+
mbedtls_sha512_free(&ctx);
|
|
902
|
+
|
|
903
|
+
return ret;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
#if defined(MBEDTLS_SELF_TEST)
|
|
907
|
+
|
|
908
|
+
/*
|
|
909
|
+
* FIPS-180-2 test vectors
|
|
910
|
+
*/
|
|
911
|
+
static const unsigned char sha_test_buf[3][113] =
|
|
912
|
+
{
|
|
913
|
+
{ "abc" },
|
|
914
|
+
{
|
|
915
|
+
"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
|
|
916
|
+
},
|
|
917
|
+
{ "" }
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
static const size_t sha_test_buflen[3] =
|
|
921
|
+
{
|
|
922
|
+
3, 112, 1000
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
typedef const unsigned char (sha_test_sum_t)[64];
|
|
926
|
+
|
|
927
|
+
/*
|
|
928
|
+
* SHA-384 test vectors
|
|
929
|
+
*/
|
|
930
|
+
#if defined(MBEDTLS_SHA384_C)
|
|
931
|
+
static sha_test_sum_t sha384_test_sum[] =
|
|
932
|
+
{
|
|
933
|
+
{ 0xCB, 0x00, 0x75, 0x3F, 0x45, 0xA3, 0x5E, 0x8B,
|
|
934
|
+
0xB5, 0xA0, 0x3D, 0x69, 0x9A, 0xC6, 0x50, 0x07,
|
|
935
|
+
0x27, 0x2C, 0x32, 0xAB, 0x0E, 0xDE, 0xD1, 0x63,
|
|
936
|
+
0x1A, 0x8B, 0x60, 0x5A, 0x43, 0xFF, 0x5B, 0xED,
|
|
937
|
+
0x80, 0x86, 0x07, 0x2B, 0xA1, 0xE7, 0xCC, 0x23,
|
|
938
|
+
0x58, 0xBA, 0xEC, 0xA1, 0x34, 0xC8, 0x25, 0xA7 },
|
|
939
|
+
{ 0x09, 0x33, 0x0C, 0x33, 0xF7, 0x11, 0x47, 0xE8,
|
|
940
|
+
0x3D, 0x19, 0x2F, 0xC7, 0x82, 0xCD, 0x1B, 0x47,
|
|
941
|
+
0x53, 0x11, 0x1B, 0x17, 0x3B, 0x3B, 0x05, 0xD2,
|
|
942
|
+
0x2F, 0xA0, 0x80, 0x86, 0xE3, 0xB0, 0xF7, 0x12,
|
|
943
|
+
0xFC, 0xC7, 0xC7, 0x1A, 0x55, 0x7E, 0x2D, 0xB9,
|
|
944
|
+
0x66, 0xC3, 0xE9, 0xFA, 0x91, 0x74, 0x60, 0x39 },
|
|
945
|
+
{ 0x9D, 0x0E, 0x18, 0x09, 0x71, 0x64, 0x74, 0xCB,
|
|
946
|
+
0x08, 0x6E, 0x83, 0x4E, 0x31, 0x0A, 0x4A, 0x1C,
|
|
947
|
+
0xED, 0x14, 0x9E, 0x9C, 0x00, 0xF2, 0x48, 0x52,
|
|
948
|
+
0x79, 0x72, 0xCE, 0xC5, 0x70, 0x4C, 0x2A, 0x5B,
|
|
949
|
+
0x07, 0xB8, 0xB3, 0xDC, 0x38, 0xEC, 0xC4, 0xEB,
|
|
950
|
+
0xAE, 0x97, 0xDD, 0xD8, 0x7F, 0x3D, 0x89, 0x85 }
|
|
951
|
+
};
|
|
952
|
+
#endif /* MBEDTLS_SHA384_C */
|
|
953
|
+
|
|
954
|
+
/*
|
|
955
|
+
* SHA-512 test vectors
|
|
956
|
+
*/
|
|
957
|
+
#if defined(MBEDTLS_SHA512_C)
|
|
958
|
+
static sha_test_sum_t sha512_test_sum[] =
|
|
959
|
+
{
|
|
960
|
+
{ 0xDD, 0xAF, 0x35, 0xA1, 0x93, 0x61, 0x7A, 0xBA,
|
|
961
|
+
0xCC, 0x41, 0x73, 0x49, 0xAE, 0x20, 0x41, 0x31,
|
|
962
|
+
0x12, 0xE6, 0xFA, 0x4E, 0x89, 0xA9, 0x7E, 0xA2,
|
|
963
|
+
0x0A, 0x9E, 0xEE, 0xE6, 0x4B, 0x55, 0xD3, 0x9A,
|
|
964
|
+
0x21, 0x92, 0x99, 0x2A, 0x27, 0x4F, 0xC1, 0xA8,
|
|
965
|
+
0x36, 0xBA, 0x3C, 0x23, 0xA3, 0xFE, 0xEB, 0xBD,
|
|
966
|
+
0x45, 0x4D, 0x44, 0x23, 0x64, 0x3C, 0xE8, 0x0E,
|
|
967
|
+
0x2A, 0x9A, 0xC9, 0x4F, 0xA5, 0x4C, 0xA4, 0x9F },
|
|
968
|
+
{ 0x8E, 0x95, 0x9B, 0x75, 0xDA, 0xE3, 0x13, 0xDA,
|
|
969
|
+
0x8C, 0xF4, 0xF7, 0x28, 0x14, 0xFC, 0x14, 0x3F,
|
|
970
|
+
0x8F, 0x77, 0x79, 0xC6, 0xEB, 0x9F, 0x7F, 0xA1,
|
|
971
|
+
0x72, 0x99, 0xAE, 0xAD, 0xB6, 0x88, 0x90, 0x18,
|
|
972
|
+
0x50, 0x1D, 0x28, 0x9E, 0x49, 0x00, 0xF7, 0xE4,
|
|
973
|
+
0x33, 0x1B, 0x99, 0xDE, 0xC4, 0xB5, 0x43, 0x3A,
|
|
974
|
+
0xC7, 0xD3, 0x29, 0xEE, 0xB6, 0xDD, 0x26, 0x54,
|
|
975
|
+
0x5E, 0x96, 0xE5, 0x5B, 0x87, 0x4B, 0xE9, 0x09 },
|
|
976
|
+
{ 0xE7, 0x18, 0x48, 0x3D, 0x0C, 0xE7, 0x69, 0x64,
|
|
977
|
+
0x4E, 0x2E, 0x42, 0xC7, 0xBC, 0x15, 0xB4, 0x63,
|
|
978
|
+
0x8E, 0x1F, 0x98, 0xB1, 0x3B, 0x20, 0x44, 0x28,
|
|
979
|
+
0x56, 0x32, 0xA8, 0x03, 0xAF, 0xA9, 0x73, 0xEB,
|
|
980
|
+
0xDE, 0x0F, 0xF2, 0x44, 0x87, 0x7E, 0xA6, 0x0A,
|
|
981
|
+
0x4C, 0xB0, 0x43, 0x2C, 0xE5, 0x77, 0xC3, 0x1B,
|
|
982
|
+
0xEB, 0x00, 0x9C, 0x5C, 0x2C, 0x49, 0xAA, 0x2E,
|
|
983
|
+
0x4E, 0xAD, 0xB2, 0x17, 0xAD, 0x8C, 0xC0, 0x9B }
|
|
984
|
+
};
|
|
985
|
+
#endif /* MBEDTLS_SHA512_C */
|
|
986
|
+
|
|
987
|
+
static int mbedtls_sha512_common_self_test(int verbose, int is384)
|
|
988
|
+
{
|
|
989
|
+
int i, buflen, ret = 0;
|
|
990
|
+
unsigned char *buf;
|
|
991
|
+
unsigned char sha512sum[64];
|
|
992
|
+
mbedtls_sha512_context ctx;
|
|
993
|
+
|
|
994
|
+
#if defined(MBEDTLS_SHA384_C) && defined(MBEDTLS_SHA512_C)
|
|
995
|
+
sha_test_sum_t *sha_test_sum = (is384) ? sha384_test_sum : sha512_test_sum;
|
|
996
|
+
#elif defined(MBEDTLS_SHA512_C)
|
|
997
|
+
sha_test_sum_t *sha_test_sum = sha512_test_sum;
|
|
998
|
+
#else
|
|
999
|
+
sha_test_sum_t *sha_test_sum = sha384_test_sum;
|
|
1000
|
+
#endif
|
|
1001
|
+
|
|
1002
|
+
buf = mbedtls_calloc(1024, sizeof(unsigned char));
|
|
1003
|
+
if (NULL == buf) {
|
|
1004
|
+
if (verbose != 0) {
|
|
1005
|
+
mbedtls_printf("Buffer allocation failed\n");
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return 1;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
mbedtls_sha512_init(&ctx);
|
|
1012
|
+
|
|
1013
|
+
for (i = 0; i < 3; i++) {
|
|
1014
|
+
if (verbose != 0) {
|
|
1015
|
+
mbedtls_printf(" SHA-%d test #%d: ", 512 - is384 * 128, i + 1);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
if ((ret = mbedtls_sha512_starts(&ctx, is384)) != 0) {
|
|
1019
|
+
goto fail;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
if (i == 2) {
|
|
1023
|
+
memset(buf, 'a', buflen = 1000);
|
|
1024
|
+
|
|
1025
|
+
for (int j = 0; j < 1000; j++) {
|
|
1026
|
+
ret = mbedtls_sha512_update(&ctx, buf, buflen);
|
|
1027
|
+
if (ret != 0) {
|
|
1028
|
+
goto fail;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
} else {
|
|
1032
|
+
ret = mbedtls_sha512_update(&ctx, sha_test_buf[i],
|
|
1033
|
+
sha_test_buflen[i]);
|
|
1034
|
+
if (ret != 0) {
|
|
1035
|
+
goto fail;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
if ((ret = mbedtls_sha512_finish(&ctx, sha512sum)) != 0) {
|
|
1040
|
+
goto fail;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
if (memcmp(sha512sum, sha_test_sum[i], 64 - is384 * 16) != 0) {
|
|
1044
|
+
ret = 1;
|
|
1045
|
+
goto fail;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
if (verbose != 0) {
|
|
1049
|
+
mbedtls_printf("passed\n");
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
if (verbose != 0) {
|
|
1054
|
+
mbedtls_printf("\n");
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
goto exit;
|
|
1058
|
+
|
|
1059
|
+
fail:
|
|
1060
|
+
if (verbose != 0) {
|
|
1061
|
+
mbedtls_printf("failed\n");
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
exit:
|
|
1065
|
+
mbedtls_sha512_free(&ctx);
|
|
1066
|
+
mbedtls_free(buf);
|
|
1067
|
+
|
|
1068
|
+
return ret;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
#if defined(MBEDTLS_SHA512_C)
|
|
1072
|
+
int mbedtls_sha512_self_test(int verbose)
|
|
1073
|
+
{
|
|
1074
|
+
return mbedtls_sha512_common_self_test(verbose, 0);
|
|
1075
|
+
}
|
|
1076
|
+
#endif /* MBEDTLS_SHA512_C */
|
|
1077
|
+
|
|
1078
|
+
#if defined(MBEDTLS_SHA384_C)
|
|
1079
|
+
int mbedtls_sha384_self_test(int verbose)
|
|
1080
|
+
{
|
|
1081
|
+
return mbedtls_sha512_common_self_test(verbose, 1);
|
|
1082
|
+
}
|
|
1083
|
+
#endif /* MBEDTLS_SHA384_C */
|
|
1084
|
+
|
|
1085
|
+
#undef ARRAY_LENGTH
|
|
1086
|
+
|
|
1087
|
+
#endif /* MBEDTLS_SELF_TEST */
|
|
1088
|
+
|
|
1089
|
+
#endif /* MBEDTLS_SHA512_C || MBEDTLS_SHA384_C */
|