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,966 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ARIA implementation
|
|
3
|
+
*
|
|
4
|
+
* Copyright The Mbed TLS Contributors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* This implementation is based on the following standards:
|
|
10
|
+
* [1] http://210.104.33.10/ARIA/doc/ARIA-specification-e.pdf
|
|
11
|
+
* [2] https://tools.ietf.org/html/rfc5794
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#include "tf_psa_crypto_common.h"
|
|
15
|
+
|
|
16
|
+
#if defined(MBEDTLS_ARIA_C)
|
|
17
|
+
|
|
18
|
+
#include "mbedtls/private/aria.h"
|
|
19
|
+
|
|
20
|
+
#include <string.h>
|
|
21
|
+
|
|
22
|
+
#include "mbedtls/platform.h"
|
|
23
|
+
|
|
24
|
+
#include "mbedtls/platform_util.h"
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* modify byte order: ( A B C D ) -> ( B A D C ), i.e. swap pairs of bytes
|
|
28
|
+
*
|
|
29
|
+
* This is submatrix P1 in [1] Appendix B.1
|
|
30
|
+
*
|
|
31
|
+
* Common compilers fail to translate this to minimal number of instructions,
|
|
32
|
+
* so let's provide asm versions for common platforms with C fallback.
|
|
33
|
+
*/
|
|
34
|
+
#if defined(MBEDTLS_HAVE_ASM)
|
|
35
|
+
#if defined(__arm__) /* rev16 available from v6 up */
|
|
36
|
+
/* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */
|
|
37
|
+
#if defined(__GNUC__) && \
|
|
38
|
+
(!defined(__ARMCC_VERSION) || __ARMCC_VERSION >= 6000000) && \
|
|
39
|
+
__ARM_ARCH >= 6
|
|
40
|
+
static inline uint32_t aria_p1(uint32_t x)
|
|
41
|
+
{
|
|
42
|
+
uint32_t r;
|
|
43
|
+
__asm("rev16 %0, %1" : "=l" (r) : "l" (x));
|
|
44
|
+
return r;
|
|
45
|
+
}
|
|
46
|
+
#define ARIA_P1 aria_p1
|
|
47
|
+
#elif defined(__ARMCC_VERSION) && __ARMCC_VERSION < 6000000 && \
|
|
48
|
+
(__TARGET_ARCH_ARM >= 6 || __TARGET_ARCH_THUMB >= 3)
|
|
49
|
+
static inline uint32_t aria_p1(uint32_t x)
|
|
50
|
+
{
|
|
51
|
+
uint32_t r;
|
|
52
|
+
__asm("rev16 r, x");
|
|
53
|
+
return r;
|
|
54
|
+
}
|
|
55
|
+
#define ARIA_P1 aria_p1
|
|
56
|
+
#endif
|
|
57
|
+
#endif /* arm */
|
|
58
|
+
#if defined(__GNUC__) && \
|
|
59
|
+
defined(__i386__) || defined(__amd64__) || defined(__x86_64__)
|
|
60
|
+
/* I couldn't find an Intel equivalent of rev16, so two instructions */
|
|
61
|
+
#define ARIA_P1(x) ARIA_P2(ARIA_P3(x))
|
|
62
|
+
#endif /* x86 gnuc */
|
|
63
|
+
#endif /* MBEDTLS_HAVE_ASM && GNUC */
|
|
64
|
+
#if !defined(ARIA_P1)
|
|
65
|
+
#define ARIA_P1(x) ((((x) >> 8) & 0x00FF00FF) ^ (((x) & 0x00FF00FF) << 8))
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* modify byte order: ( A B C D ) -> ( C D A B ), i.e. rotate by 16 bits
|
|
70
|
+
*
|
|
71
|
+
* This is submatrix P2 in [1] Appendix B.1
|
|
72
|
+
*
|
|
73
|
+
* Common compilers will translate this to a single instruction.
|
|
74
|
+
*/
|
|
75
|
+
#define ARIA_P2(x) (((x) >> 16) ^ ((x) << 16))
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* modify byte order: ( A B C D ) -> ( D C B A ), i.e. change endianness
|
|
79
|
+
*
|
|
80
|
+
* This is submatrix P3 in [1] Appendix B.1
|
|
81
|
+
*/
|
|
82
|
+
#define ARIA_P3(x) MBEDTLS_BSWAP32(x)
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
* ARIA Affine Transform
|
|
86
|
+
* (a, b, c, d) = state in/out
|
|
87
|
+
*
|
|
88
|
+
* If we denote the first byte of input by 0, ..., the last byte by f,
|
|
89
|
+
* then inputs are: a = 0123, b = 4567, c = 89ab, d = cdef.
|
|
90
|
+
*
|
|
91
|
+
* Reading [1] 2.4 or [2] 2.4.3 in columns and performing simple
|
|
92
|
+
* rearrangements on adjacent pairs, output is:
|
|
93
|
+
*
|
|
94
|
+
* a = 3210 + 4545 + 6767 + 88aa + 99bb + dccd + effe
|
|
95
|
+
* = 3210 + 4567 + 6745 + 89ab + 98ba + dcfe + efcd
|
|
96
|
+
* b = 0101 + 2323 + 5476 + 8998 + baab + eecc + ffdd
|
|
97
|
+
* = 0123 + 2301 + 5476 + 89ab + ba98 + efcd + fedc
|
|
98
|
+
* c = 0022 + 1133 + 4554 + 7667 + ab89 + dcdc + fefe
|
|
99
|
+
* = 0123 + 1032 + 4567 + 7654 + ab89 + dcfe + fedc
|
|
100
|
+
* d = 1001 + 2332 + 6644 + 7755 + 9898 + baba + cdef
|
|
101
|
+
* = 1032 + 2301 + 6745 + 7654 + 98ba + ba98 + cdef
|
|
102
|
+
*
|
|
103
|
+
* Note: another presentation of the A transform can be found as the first
|
|
104
|
+
* half of App. B.1 in [1] in terms of 4-byte operators P1, P2, P3 and P4.
|
|
105
|
+
* The implementation below uses only P1 and P2 as they are sufficient.
|
|
106
|
+
*/
|
|
107
|
+
static inline void aria_a(uint32_t *a, uint32_t *b,
|
|
108
|
+
uint32_t *c, uint32_t *d)
|
|
109
|
+
{
|
|
110
|
+
uint32_t ta, tb, tc;
|
|
111
|
+
ta = *b; // 4567
|
|
112
|
+
*b = *a; // 0123
|
|
113
|
+
*a = ARIA_P2(ta); // 6745
|
|
114
|
+
tb = ARIA_P2(*d); // efcd
|
|
115
|
+
*d = ARIA_P1(*c); // 98ba
|
|
116
|
+
*c = ARIA_P1(tb); // fedc
|
|
117
|
+
ta ^= *d; // 4567+98ba
|
|
118
|
+
tc = ARIA_P2(*b); // 2301
|
|
119
|
+
ta = ARIA_P1(ta) ^ tc ^ *c; // 2301+5476+89ab+fedc
|
|
120
|
+
tb ^= ARIA_P2(*d); // ba98+efcd
|
|
121
|
+
tc ^= ARIA_P1(*a); // 2301+7654
|
|
122
|
+
*b ^= ta ^ tb; // 0123+2301+5476+89ab+ba98+efcd+fedc OUT
|
|
123
|
+
tb = ARIA_P2(tb) ^ ta; // 2301+5476+89ab+98ba+cdef+fedc
|
|
124
|
+
*a ^= ARIA_P1(tb); // 3210+4567+6745+89ab+98ba+dcfe+efcd OUT
|
|
125
|
+
ta = ARIA_P2(ta); // 0123+7654+ab89+dcfe
|
|
126
|
+
*d ^= ARIA_P1(ta) ^ tc; // 1032+2301+6745+7654+98ba+ba98+cdef OUT
|
|
127
|
+
tc = ARIA_P2(tc); // 0123+5476
|
|
128
|
+
*c ^= ARIA_P1(tc) ^ ta; // 0123+1032+4567+7654+ab89+dcfe+fedc OUT
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/*
|
|
132
|
+
* ARIA Substitution Layer SL1 / SL2
|
|
133
|
+
* (a, b, c, d) = state in/out
|
|
134
|
+
* (sa, sb, sc, sd) = 256 8-bit S-Boxes (see below)
|
|
135
|
+
*
|
|
136
|
+
* By passing sb1, sb2, is1, is2 as S-Boxes you get SL1
|
|
137
|
+
* By passing is1, is2, sb1, sb2 as S-Boxes you get SL2
|
|
138
|
+
*/
|
|
139
|
+
static inline void aria_sl(uint32_t *a, uint32_t *b,
|
|
140
|
+
uint32_t *c, uint32_t *d,
|
|
141
|
+
const uint8_t sa[256], const uint8_t sb[256],
|
|
142
|
+
const uint8_t sc[256], const uint8_t sd[256])
|
|
143
|
+
{
|
|
144
|
+
*a = ((uint32_t) sa[MBEDTLS_BYTE_0(*a)]) ^
|
|
145
|
+
(((uint32_t) sb[MBEDTLS_BYTE_1(*a)]) << 8) ^
|
|
146
|
+
(((uint32_t) sc[MBEDTLS_BYTE_2(*a)]) << 16) ^
|
|
147
|
+
(((uint32_t) sd[MBEDTLS_BYTE_3(*a)]) << 24);
|
|
148
|
+
*b = ((uint32_t) sa[MBEDTLS_BYTE_0(*b)]) ^
|
|
149
|
+
(((uint32_t) sb[MBEDTLS_BYTE_1(*b)]) << 8) ^
|
|
150
|
+
(((uint32_t) sc[MBEDTLS_BYTE_2(*b)]) << 16) ^
|
|
151
|
+
(((uint32_t) sd[MBEDTLS_BYTE_3(*b)]) << 24);
|
|
152
|
+
*c = ((uint32_t) sa[MBEDTLS_BYTE_0(*c)]) ^
|
|
153
|
+
(((uint32_t) sb[MBEDTLS_BYTE_1(*c)]) << 8) ^
|
|
154
|
+
(((uint32_t) sc[MBEDTLS_BYTE_2(*c)]) << 16) ^
|
|
155
|
+
(((uint32_t) sd[MBEDTLS_BYTE_3(*c)]) << 24);
|
|
156
|
+
*d = ((uint32_t) sa[MBEDTLS_BYTE_0(*d)]) ^
|
|
157
|
+
(((uint32_t) sb[MBEDTLS_BYTE_1(*d)]) << 8) ^
|
|
158
|
+
(((uint32_t) sc[MBEDTLS_BYTE_2(*d)]) << 16) ^
|
|
159
|
+
(((uint32_t) sd[MBEDTLS_BYTE_3(*d)]) << 24);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
* S-Boxes
|
|
164
|
+
*/
|
|
165
|
+
static const uint8_t aria_sb1[256] =
|
|
166
|
+
{
|
|
167
|
+
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B,
|
|
168
|
+
0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0,
|
|
169
|
+
0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26,
|
|
170
|
+
0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
|
|
171
|
+
0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2,
|
|
172
|
+
0xEB, 0x27, 0xB2, 0x75, 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0,
|
|
173
|
+
0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, 0x53, 0xD1, 0x00, 0xED,
|
|
174
|
+
0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
|
|
175
|
+
0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F,
|
|
176
|
+
0x50, 0x3C, 0x9F, 0xA8, 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5,
|
|
177
|
+
0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, 0xCD, 0x0C, 0x13, 0xEC,
|
|
178
|
+
0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
|
|
179
|
+
0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14,
|
|
180
|
+
0xDE, 0x5E, 0x0B, 0xDB, 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C,
|
|
181
|
+
0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, 0xE7, 0xC8, 0x37, 0x6D,
|
|
182
|
+
0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
|
|
183
|
+
0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F,
|
|
184
|
+
0x4B, 0xBD, 0x8B, 0x8A, 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E,
|
|
185
|
+
0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, 0xE1, 0xF8, 0x98, 0x11,
|
|
186
|
+
0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
|
|
187
|
+
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F,
|
|
188
|
+
0xB0, 0x54, 0xBB, 0x16
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
static const uint8_t aria_sb2[256] =
|
|
192
|
+
{
|
|
193
|
+
0xE2, 0x4E, 0x54, 0xFC, 0x94, 0xC2, 0x4A, 0xCC, 0x62, 0x0D, 0x6A, 0x46,
|
|
194
|
+
0x3C, 0x4D, 0x8B, 0xD1, 0x5E, 0xFA, 0x64, 0xCB, 0xB4, 0x97, 0xBE, 0x2B,
|
|
195
|
+
0xBC, 0x77, 0x2E, 0x03, 0xD3, 0x19, 0x59, 0xC1, 0x1D, 0x06, 0x41, 0x6B,
|
|
196
|
+
0x55, 0xF0, 0x99, 0x69, 0xEA, 0x9C, 0x18, 0xAE, 0x63, 0xDF, 0xE7, 0xBB,
|
|
197
|
+
0x00, 0x73, 0x66, 0xFB, 0x96, 0x4C, 0x85, 0xE4, 0x3A, 0x09, 0x45, 0xAA,
|
|
198
|
+
0x0F, 0xEE, 0x10, 0xEB, 0x2D, 0x7F, 0xF4, 0x29, 0xAC, 0xCF, 0xAD, 0x91,
|
|
199
|
+
0x8D, 0x78, 0xC8, 0x95, 0xF9, 0x2F, 0xCE, 0xCD, 0x08, 0x7A, 0x88, 0x38,
|
|
200
|
+
0x5C, 0x83, 0x2A, 0x28, 0x47, 0xDB, 0xB8, 0xC7, 0x93, 0xA4, 0x12, 0x53,
|
|
201
|
+
0xFF, 0x87, 0x0E, 0x31, 0x36, 0x21, 0x58, 0x48, 0x01, 0x8E, 0x37, 0x74,
|
|
202
|
+
0x32, 0xCA, 0xE9, 0xB1, 0xB7, 0xAB, 0x0C, 0xD7, 0xC4, 0x56, 0x42, 0x26,
|
|
203
|
+
0x07, 0x98, 0x60, 0xD9, 0xB6, 0xB9, 0x11, 0x40, 0xEC, 0x20, 0x8C, 0xBD,
|
|
204
|
+
0xA0, 0xC9, 0x84, 0x04, 0x49, 0x23, 0xF1, 0x4F, 0x50, 0x1F, 0x13, 0xDC,
|
|
205
|
+
0xD8, 0xC0, 0x9E, 0x57, 0xE3, 0xC3, 0x7B, 0x65, 0x3B, 0x02, 0x8F, 0x3E,
|
|
206
|
+
0xE8, 0x25, 0x92, 0xE5, 0x15, 0xDD, 0xFD, 0x17, 0xA9, 0xBF, 0xD4, 0x9A,
|
|
207
|
+
0x7E, 0xC5, 0x39, 0x67, 0xFE, 0x76, 0x9D, 0x43, 0xA7, 0xE1, 0xD0, 0xF5,
|
|
208
|
+
0x68, 0xF2, 0x1B, 0x34, 0x70, 0x05, 0xA3, 0x8A, 0xD5, 0x79, 0x86, 0xA8,
|
|
209
|
+
0x30, 0xC6, 0x51, 0x4B, 0x1E, 0xA6, 0x27, 0xF6, 0x35, 0xD2, 0x6E, 0x24,
|
|
210
|
+
0x16, 0x82, 0x5F, 0xDA, 0xE6, 0x75, 0xA2, 0xEF, 0x2C, 0xB2, 0x1C, 0x9F,
|
|
211
|
+
0x5D, 0x6F, 0x80, 0x0A, 0x72, 0x44, 0x9B, 0x6C, 0x90, 0x0B, 0x5B, 0x33,
|
|
212
|
+
0x7D, 0x5A, 0x52, 0xF3, 0x61, 0xA1, 0xF7, 0xB0, 0xD6, 0x3F, 0x7C, 0x6D,
|
|
213
|
+
0xED, 0x14, 0xE0, 0xA5, 0x3D, 0x22, 0xB3, 0xF8, 0x89, 0xDE, 0x71, 0x1A,
|
|
214
|
+
0xAF, 0xBA, 0xB5, 0x81
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
static const uint8_t aria_is1[256] =
|
|
218
|
+
{
|
|
219
|
+
0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E,
|
|
220
|
+
0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87,
|
|
221
|
+
0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, 0x54, 0x7B, 0x94, 0x32,
|
|
222
|
+
0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
|
|
223
|
+
0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49,
|
|
224
|
+
0x6D, 0x8B, 0xD1, 0x25, 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16,
|
|
225
|
+
0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, 0x6C, 0x70, 0x48, 0x50,
|
|
226
|
+
0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84,
|
|
227
|
+
0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05,
|
|
228
|
+
0xB8, 0xB3, 0x45, 0x06, 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02,
|
|
229
|
+
0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, 0x3A, 0x91, 0x11, 0x41,
|
|
230
|
+
0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73,
|
|
231
|
+
0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8,
|
|
232
|
+
0x1C, 0x75, 0xDF, 0x6E, 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89,
|
|
233
|
+
0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, 0xFC, 0x56, 0x3E, 0x4B,
|
|
234
|
+
0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4,
|
|
235
|
+
0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59,
|
|
236
|
+
0x27, 0x80, 0xEC, 0x5F, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D,
|
|
237
|
+
0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0xA0, 0xE0, 0x3B, 0x4D,
|
|
238
|
+
0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61,
|
|
239
|
+
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63,
|
|
240
|
+
0x55, 0x21, 0x0C, 0x7D
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
static const uint8_t aria_is2[256] =
|
|
244
|
+
{
|
|
245
|
+
0x30, 0x68, 0x99, 0x1B, 0x87, 0xB9, 0x21, 0x78, 0x50, 0x39, 0xDB, 0xE1,
|
|
246
|
+
0x72, 0x09, 0x62, 0x3C, 0x3E, 0x7E, 0x5E, 0x8E, 0xF1, 0xA0, 0xCC, 0xA3,
|
|
247
|
+
0x2A, 0x1D, 0xFB, 0xB6, 0xD6, 0x20, 0xC4, 0x8D, 0x81, 0x65, 0xF5, 0x89,
|
|
248
|
+
0xCB, 0x9D, 0x77, 0xC6, 0x57, 0x43, 0x56, 0x17, 0xD4, 0x40, 0x1A, 0x4D,
|
|
249
|
+
0xC0, 0x63, 0x6C, 0xE3, 0xB7, 0xC8, 0x64, 0x6A, 0x53, 0xAA, 0x38, 0x98,
|
|
250
|
+
0x0C, 0xF4, 0x9B, 0xED, 0x7F, 0x22, 0x76, 0xAF, 0xDD, 0x3A, 0x0B, 0x58,
|
|
251
|
+
0x67, 0x88, 0x06, 0xC3, 0x35, 0x0D, 0x01, 0x8B, 0x8C, 0xC2, 0xE6, 0x5F,
|
|
252
|
+
0x02, 0x24, 0x75, 0x93, 0x66, 0x1E, 0xE5, 0xE2, 0x54, 0xD8, 0x10, 0xCE,
|
|
253
|
+
0x7A, 0xE8, 0x08, 0x2C, 0x12, 0x97, 0x32, 0xAB, 0xB4, 0x27, 0x0A, 0x23,
|
|
254
|
+
0xDF, 0xEF, 0xCA, 0xD9, 0xB8, 0xFA, 0xDC, 0x31, 0x6B, 0xD1, 0xAD, 0x19,
|
|
255
|
+
0x49, 0xBD, 0x51, 0x96, 0xEE, 0xE4, 0xA8, 0x41, 0xDA, 0xFF, 0xCD, 0x55,
|
|
256
|
+
0x86, 0x36, 0xBE, 0x61, 0x52, 0xF8, 0xBB, 0x0E, 0x82, 0x48, 0x69, 0x9A,
|
|
257
|
+
0xE0, 0x47, 0x9E, 0x5C, 0x04, 0x4B, 0x34, 0x15, 0x79, 0x26, 0xA7, 0xDE,
|
|
258
|
+
0x29, 0xAE, 0x92, 0xD7, 0x84, 0xE9, 0xD2, 0xBA, 0x5D, 0xF3, 0xC5, 0xB0,
|
|
259
|
+
0xBF, 0xA4, 0x3B, 0x71, 0x44, 0x46, 0x2B, 0xFC, 0xEB, 0x6F, 0xD5, 0xF6,
|
|
260
|
+
0x14, 0xFE, 0x7C, 0x70, 0x5A, 0x7D, 0xFD, 0x2F, 0x18, 0x83, 0x16, 0xA5,
|
|
261
|
+
0x91, 0x1F, 0x05, 0x95, 0x74, 0xA9, 0xC1, 0x5B, 0x4A, 0x85, 0x6D, 0x13,
|
|
262
|
+
0x07, 0x4F, 0x4E, 0x45, 0xB2, 0x0F, 0xC9, 0x1C, 0xA6, 0xBC, 0xEC, 0x73,
|
|
263
|
+
0x90, 0x7B, 0xCF, 0x59, 0x8F, 0xA1, 0xF9, 0x2D, 0xF2, 0xB1, 0x00, 0x94,
|
|
264
|
+
0x37, 0x9F, 0xD0, 0x2E, 0x9C, 0x6E, 0x28, 0x3F, 0x80, 0xF0, 0x3D, 0xD3,
|
|
265
|
+
0x25, 0x8A, 0xB5, 0xE7, 0x42, 0xB3, 0xC7, 0xEA, 0xF7, 0x4C, 0x11, 0x33,
|
|
266
|
+
0x03, 0xA2, 0xAC, 0x60
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/*
|
|
270
|
+
* Helper for key schedule: r = FO( p, k ) ^ x
|
|
271
|
+
*/
|
|
272
|
+
static void aria_fo_xor(uint32_t r[4], const uint32_t p[4],
|
|
273
|
+
const uint32_t k[4], const uint32_t x[4])
|
|
274
|
+
{
|
|
275
|
+
uint32_t a, b, c, d;
|
|
276
|
+
|
|
277
|
+
a = p[0] ^ k[0];
|
|
278
|
+
b = p[1] ^ k[1];
|
|
279
|
+
c = p[2] ^ k[2];
|
|
280
|
+
d = p[3] ^ k[3];
|
|
281
|
+
|
|
282
|
+
aria_sl(&a, &b, &c, &d, aria_sb1, aria_sb2, aria_is1, aria_is2);
|
|
283
|
+
aria_a(&a, &b, &c, &d);
|
|
284
|
+
|
|
285
|
+
r[0] = a ^ x[0];
|
|
286
|
+
r[1] = b ^ x[1];
|
|
287
|
+
r[2] = c ^ x[2];
|
|
288
|
+
r[3] = d ^ x[3];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/*
|
|
292
|
+
* Helper for key schedule: r = FE( p, k ) ^ x
|
|
293
|
+
*/
|
|
294
|
+
static void aria_fe_xor(uint32_t r[4], const uint32_t p[4],
|
|
295
|
+
const uint32_t k[4], const uint32_t x[4])
|
|
296
|
+
{
|
|
297
|
+
uint32_t a, b, c, d;
|
|
298
|
+
|
|
299
|
+
a = p[0] ^ k[0];
|
|
300
|
+
b = p[1] ^ k[1];
|
|
301
|
+
c = p[2] ^ k[2];
|
|
302
|
+
d = p[3] ^ k[3];
|
|
303
|
+
|
|
304
|
+
aria_sl(&a, &b, &c, &d, aria_is1, aria_is2, aria_sb1, aria_sb2);
|
|
305
|
+
aria_a(&a, &b, &c, &d);
|
|
306
|
+
|
|
307
|
+
r[0] = a ^ x[0];
|
|
308
|
+
r[1] = b ^ x[1];
|
|
309
|
+
r[2] = c ^ x[2];
|
|
310
|
+
r[3] = d ^ x[3];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/*
|
|
314
|
+
* Big endian 128-bit rotation: r = a ^ (b <<< n), used only in key setup.
|
|
315
|
+
*
|
|
316
|
+
* We chose to store bytes into 32-bit words in little-endian format (see
|
|
317
|
+
* MBEDTLS_GET_UINT32_LE / MBEDTLS_PUT_UINT32_LE ) so we need to reverse
|
|
318
|
+
* bytes here.
|
|
319
|
+
*/
|
|
320
|
+
static void aria_rot128(uint32_t r[4], const uint32_t a[4],
|
|
321
|
+
const uint32_t b[4], uint8_t n)
|
|
322
|
+
{
|
|
323
|
+
uint8_t i, j;
|
|
324
|
+
uint32_t t, u;
|
|
325
|
+
|
|
326
|
+
const uint8_t n1 = n % 32; // bit offset
|
|
327
|
+
const uint8_t n2 = n1 ? 32 - n1 : 0; // reverse bit offset
|
|
328
|
+
|
|
329
|
+
j = (n / 32) % 4; // initial word offset
|
|
330
|
+
t = ARIA_P3(b[j]); // big endian
|
|
331
|
+
for (i = 0; i < 4; i++) {
|
|
332
|
+
j = (j + 1) % 4; // get next word, big endian
|
|
333
|
+
u = ARIA_P3(b[j]);
|
|
334
|
+
t <<= n1; // rotate
|
|
335
|
+
t |= u >> n2;
|
|
336
|
+
t = ARIA_P3(t); // back to little endian
|
|
337
|
+
r[i] = a[i] ^ t; // store
|
|
338
|
+
t = u; // move to next word
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/*
|
|
343
|
+
* Set encryption key
|
|
344
|
+
*/
|
|
345
|
+
int mbedtls_aria_setkey_enc(mbedtls_aria_context *ctx,
|
|
346
|
+
const unsigned char *key, unsigned int keybits)
|
|
347
|
+
{
|
|
348
|
+
/* round constant masks */
|
|
349
|
+
const uint32_t rc[3][4] =
|
|
350
|
+
{
|
|
351
|
+
{ 0xB7C17C51, 0x940A2227, 0xE8AB13FE, 0xE06E9AFA },
|
|
352
|
+
{ 0xCC4AB16D, 0x20C8219E, 0xD5B128FF, 0xB0E25DEF },
|
|
353
|
+
{ 0x1D3792DB, 0x70E92621, 0x75972403, 0x0EC9E804 }
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
int i;
|
|
357
|
+
uint32_t w[4][4], *w2;
|
|
358
|
+
|
|
359
|
+
if (keybits != 128 && keybits != 192 && keybits != 256) {
|
|
360
|
+
return MBEDTLS_ERR_ARIA_BAD_INPUT_DATA;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* Copy key to W0 (and potential remainder to W1) */
|
|
364
|
+
w[0][0] = MBEDTLS_GET_UINT32_LE(key, 0);
|
|
365
|
+
w[0][1] = MBEDTLS_GET_UINT32_LE(key, 4);
|
|
366
|
+
w[0][2] = MBEDTLS_GET_UINT32_LE(key, 8);
|
|
367
|
+
w[0][3] = MBEDTLS_GET_UINT32_LE(key, 12);
|
|
368
|
+
|
|
369
|
+
memset(w[1], 0, 16);
|
|
370
|
+
if (keybits >= 192) {
|
|
371
|
+
w[1][0] = MBEDTLS_GET_UINT32_LE(key, 16); // 192 bit key
|
|
372
|
+
w[1][1] = MBEDTLS_GET_UINT32_LE(key, 20);
|
|
373
|
+
}
|
|
374
|
+
if (keybits == 256) {
|
|
375
|
+
w[1][2] = MBEDTLS_GET_UINT32_LE(key, 24); // 256 bit key
|
|
376
|
+
w[1][3] = MBEDTLS_GET_UINT32_LE(key, 28);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
i = (keybits - 128) >> 6; // index: 0, 1, 2
|
|
380
|
+
ctx->nr = 12 + 2 * i; // no. rounds: 12, 14, 16
|
|
381
|
+
|
|
382
|
+
aria_fo_xor(w[1], w[0], rc[i], w[1]); // W1 = FO(W0, CK1) ^ KR
|
|
383
|
+
i = i < 2 ? i + 1 : 0;
|
|
384
|
+
aria_fe_xor(w[2], w[1], rc[i], w[0]); // W2 = FE(W1, CK2) ^ W0
|
|
385
|
+
i = i < 2 ? i + 1 : 0;
|
|
386
|
+
aria_fo_xor(w[3], w[2], rc[i], w[1]); // W3 = FO(W2, CK3) ^ W1
|
|
387
|
+
|
|
388
|
+
for (i = 0; i < 4; i++) { // create round keys
|
|
389
|
+
w2 = w[(i + 1) & 3];
|
|
390
|
+
aria_rot128(ctx->rk[i], w[i], w2, 128 - 19);
|
|
391
|
+
aria_rot128(ctx->rk[i + 4], w[i], w2, 128 - 31);
|
|
392
|
+
aria_rot128(ctx->rk[i + 8], w[i], w2, 61);
|
|
393
|
+
aria_rot128(ctx->rk[i + 12], w[i], w2, 31);
|
|
394
|
+
}
|
|
395
|
+
aria_rot128(ctx->rk[16], w[0], w[1], 19);
|
|
396
|
+
|
|
397
|
+
/* w holds enough info to reconstruct the round keys */
|
|
398
|
+
mbedtls_platform_zeroize(w, sizeof(w));
|
|
399
|
+
|
|
400
|
+
return 0;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/*
|
|
404
|
+
* Set decryption key
|
|
405
|
+
*/
|
|
406
|
+
#if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
|
|
407
|
+
int mbedtls_aria_setkey_dec(mbedtls_aria_context *ctx,
|
|
408
|
+
const unsigned char *key, unsigned int keybits)
|
|
409
|
+
{
|
|
410
|
+
int i, j, k, ret;
|
|
411
|
+
|
|
412
|
+
ret = mbedtls_aria_setkey_enc(ctx, key, keybits);
|
|
413
|
+
if (ret != 0) {
|
|
414
|
+
return ret;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/* flip the order of round keys */
|
|
418
|
+
for (i = 0, j = ctx->nr; i < j; i++, j--) {
|
|
419
|
+
for (k = 0; k < 4; k++) {
|
|
420
|
+
uint32_t t = ctx->rk[i][k];
|
|
421
|
+
ctx->rk[i][k] = ctx->rk[j][k];
|
|
422
|
+
ctx->rk[j][k] = t;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/* apply affine transform to middle keys */
|
|
427
|
+
for (i = 1; i < ctx->nr; i++) {
|
|
428
|
+
aria_a(&ctx->rk[i][0], &ctx->rk[i][1],
|
|
429
|
+
&ctx->rk[i][2], &ctx->rk[i][3]);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return 0;
|
|
433
|
+
}
|
|
434
|
+
#endif /* !MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
|
|
435
|
+
|
|
436
|
+
/*
|
|
437
|
+
* Encrypt a block
|
|
438
|
+
*/
|
|
439
|
+
int mbedtls_aria_crypt_ecb(mbedtls_aria_context *ctx,
|
|
440
|
+
const unsigned char input[MBEDTLS_ARIA_BLOCKSIZE],
|
|
441
|
+
unsigned char output[MBEDTLS_ARIA_BLOCKSIZE])
|
|
442
|
+
{
|
|
443
|
+
int i;
|
|
444
|
+
|
|
445
|
+
uint32_t a, b, c, d;
|
|
446
|
+
|
|
447
|
+
a = MBEDTLS_GET_UINT32_LE(input, 0);
|
|
448
|
+
b = MBEDTLS_GET_UINT32_LE(input, 4);
|
|
449
|
+
c = MBEDTLS_GET_UINT32_LE(input, 8);
|
|
450
|
+
d = MBEDTLS_GET_UINT32_LE(input, 12);
|
|
451
|
+
|
|
452
|
+
i = 0;
|
|
453
|
+
while (1) {
|
|
454
|
+
a ^= ctx->rk[i][0];
|
|
455
|
+
b ^= ctx->rk[i][1];
|
|
456
|
+
c ^= ctx->rk[i][2];
|
|
457
|
+
d ^= ctx->rk[i][3];
|
|
458
|
+
i++;
|
|
459
|
+
|
|
460
|
+
aria_sl(&a, &b, &c, &d, aria_sb1, aria_sb2, aria_is1, aria_is2);
|
|
461
|
+
aria_a(&a, &b, &c, &d);
|
|
462
|
+
|
|
463
|
+
a ^= ctx->rk[i][0];
|
|
464
|
+
b ^= ctx->rk[i][1];
|
|
465
|
+
c ^= ctx->rk[i][2];
|
|
466
|
+
d ^= ctx->rk[i][3];
|
|
467
|
+
i++;
|
|
468
|
+
|
|
469
|
+
aria_sl(&a, &b, &c, &d, aria_is1, aria_is2, aria_sb1, aria_sb2);
|
|
470
|
+
if (i >= ctx->nr) {
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
aria_a(&a, &b, &c, &d);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* final key mixing */
|
|
477
|
+
a ^= ctx->rk[i][0];
|
|
478
|
+
b ^= ctx->rk[i][1];
|
|
479
|
+
c ^= ctx->rk[i][2];
|
|
480
|
+
d ^= ctx->rk[i][3];
|
|
481
|
+
|
|
482
|
+
MBEDTLS_PUT_UINT32_LE(a, output, 0);
|
|
483
|
+
MBEDTLS_PUT_UINT32_LE(b, output, 4);
|
|
484
|
+
MBEDTLS_PUT_UINT32_LE(c, output, 8);
|
|
485
|
+
MBEDTLS_PUT_UINT32_LE(d, output, 12);
|
|
486
|
+
|
|
487
|
+
return 0;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* Initialize context */
|
|
491
|
+
void mbedtls_aria_init(mbedtls_aria_context *ctx)
|
|
492
|
+
{
|
|
493
|
+
memset(ctx, 0, sizeof(mbedtls_aria_context));
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/* Clear context */
|
|
497
|
+
void mbedtls_aria_free(mbedtls_aria_context *ctx)
|
|
498
|
+
{
|
|
499
|
+
if (ctx == NULL) {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
mbedtls_platform_zeroize(ctx, sizeof(mbedtls_aria_context));
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
507
|
+
/*
|
|
508
|
+
* ARIA-CBC buffer encryption/decryption
|
|
509
|
+
*/
|
|
510
|
+
int mbedtls_aria_crypt_cbc(mbedtls_aria_context *ctx,
|
|
511
|
+
int mode,
|
|
512
|
+
size_t length,
|
|
513
|
+
unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
|
|
514
|
+
const unsigned char *input,
|
|
515
|
+
unsigned char *output)
|
|
516
|
+
{
|
|
517
|
+
unsigned char temp[MBEDTLS_ARIA_BLOCKSIZE];
|
|
518
|
+
|
|
519
|
+
if ((mode != MBEDTLS_ARIA_ENCRYPT) && (mode != MBEDTLS_ARIA_DECRYPT)) {
|
|
520
|
+
return MBEDTLS_ERR_ARIA_BAD_INPUT_DATA;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (length % MBEDTLS_ARIA_BLOCKSIZE) {
|
|
524
|
+
return MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (mode == MBEDTLS_ARIA_DECRYPT) {
|
|
528
|
+
while (length > 0) {
|
|
529
|
+
memcpy(temp, input, MBEDTLS_ARIA_BLOCKSIZE);
|
|
530
|
+
mbedtls_aria_crypt_ecb(ctx, input, output);
|
|
531
|
+
|
|
532
|
+
mbedtls_xor(output, output, iv, MBEDTLS_ARIA_BLOCKSIZE);
|
|
533
|
+
|
|
534
|
+
memcpy(iv, temp, MBEDTLS_ARIA_BLOCKSIZE);
|
|
535
|
+
|
|
536
|
+
input += MBEDTLS_ARIA_BLOCKSIZE;
|
|
537
|
+
output += MBEDTLS_ARIA_BLOCKSIZE;
|
|
538
|
+
length -= MBEDTLS_ARIA_BLOCKSIZE;
|
|
539
|
+
}
|
|
540
|
+
} else {
|
|
541
|
+
while (length > 0) {
|
|
542
|
+
mbedtls_xor(output, input, iv, MBEDTLS_ARIA_BLOCKSIZE);
|
|
543
|
+
|
|
544
|
+
mbedtls_aria_crypt_ecb(ctx, output, output);
|
|
545
|
+
memcpy(iv, output, MBEDTLS_ARIA_BLOCKSIZE);
|
|
546
|
+
|
|
547
|
+
input += MBEDTLS_ARIA_BLOCKSIZE;
|
|
548
|
+
output += MBEDTLS_ARIA_BLOCKSIZE;
|
|
549
|
+
length -= MBEDTLS_ARIA_BLOCKSIZE;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return 0;
|
|
554
|
+
}
|
|
555
|
+
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
|
556
|
+
|
|
557
|
+
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
|
558
|
+
/*
|
|
559
|
+
* ARIA-CFB128 buffer encryption/decryption
|
|
560
|
+
*/
|
|
561
|
+
int mbedtls_aria_crypt_cfb128(mbedtls_aria_context *ctx,
|
|
562
|
+
int mode,
|
|
563
|
+
size_t length,
|
|
564
|
+
size_t *iv_off,
|
|
565
|
+
unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE],
|
|
566
|
+
const unsigned char *input,
|
|
567
|
+
unsigned char *output)
|
|
568
|
+
{
|
|
569
|
+
unsigned char c;
|
|
570
|
+
size_t n;
|
|
571
|
+
|
|
572
|
+
if ((mode != MBEDTLS_ARIA_ENCRYPT) && (mode != MBEDTLS_ARIA_DECRYPT)) {
|
|
573
|
+
return MBEDTLS_ERR_ARIA_BAD_INPUT_DATA;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
n = *iv_off;
|
|
577
|
+
|
|
578
|
+
/* An overly large value of n can lead to an unlimited
|
|
579
|
+
* buffer overflow. */
|
|
580
|
+
if (n >= MBEDTLS_ARIA_BLOCKSIZE) {
|
|
581
|
+
return MBEDTLS_ERR_ARIA_BAD_INPUT_DATA;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (mode == MBEDTLS_ARIA_DECRYPT) {
|
|
585
|
+
while (length--) {
|
|
586
|
+
if (n == 0) {
|
|
587
|
+
mbedtls_aria_crypt_ecb(ctx, iv, iv);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
c = *input++;
|
|
591
|
+
*output++ = c ^ iv[n];
|
|
592
|
+
iv[n] = c;
|
|
593
|
+
|
|
594
|
+
n = (n + 1) & 0x0F;
|
|
595
|
+
}
|
|
596
|
+
} else {
|
|
597
|
+
while (length--) {
|
|
598
|
+
if (n == 0) {
|
|
599
|
+
mbedtls_aria_crypt_ecb(ctx, iv, iv);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
iv[n] = *output++ = (unsigned char) (iv[n] ^ *input++);
|
|
603
|
+
|
|
604
|
+
n = (n + 1) & 0x0F;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
*iv_off = n;
|
|
609
|
+
|
|
610
|
+
return 0;
|
|
611
|
+
}
|
|
612
|
+
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
|
613
|
+
|
|
614
|
+
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
|
615
|
+
/*
|
|
616
|
+
* ARIA-CTR buffer encryption/decryption
|
|
617
|
+
*/
|
|
618
|
+
int mbedtls_aria_crypt_ctr(mbedtls_aria_context *ctx,
|
|
619
|
+
size_t length,
|
|
620
|
+
size_t *nc_off,
|
|
621
|
+
unsigned char nonce_counter[MBEDTLS_ARIA_BLOCKSIZE],
|
|
622
|
+
unsigned char stream_block[MBEDTLS_ARIA_BLOCKSIZE],
|
|
623
|
+
const unsigned char *input,
|
|
624
|
+
unsigned char *output)
|
|
625
|
+
{
|
|
626
|
+
int c, i;
|
|
627
|
+
size_t n;
|
|
628
|
+
|
|
629
|
+
n = *nc_off;
|
|
630
|
+
/* An overly large value of n can lead to an unlimited
|
|
631
|
+
* buffer overflow. */
|
|
632
|
+
if (n >= MBEDTLS_ARIA_BLOCKSIZE) {
|
|
633
|
+
return MBEDTLS_ERR_ARIA_BAD_INPUT_DATA;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
while (length--) {
|
|
637
|
+
if (n == 0) {
|
|
638
|
+
mbedtls_aria_crypt_ecb(ctx, nonce_counter,
|
|
639
|
+
stream_block);
|
|
640
|
+
|
|
641
|
+
for (i = MBEDTLS_ARIA_BLOCKSIZE; i > 0; i--) {
|
|
642
|
+
if (++nonce_counter[i - 1] != 0) {
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
c = *input++;
|
|
648
|
+
*output++ = (unsigned char) (c ^ stream_block[n]);
|
|
649
|
+
|
|
650
|
+
n = (n + 1) & 0x0F;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
*nc_off = n;
|
|
654
|
+
|
|
655
|
+
return 0;
|
|
656
|
+
}
|
|
657
|
+
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
|
658
|
+
|
|
659
|
+
#if defined(MBEDTLS_SELF_TEST)
|
|
660
|
+
|
|
661
|
+
/*
|
|
662
|
+
* Basic ARIA ECB test vectors from RFC 5794
|
|
663
|
+
*/
|
|
664
|
+
static const uint8_t aria_test1_ecb_key[32] = // test key
|
|
665
|
+
{
|
|
666
|
+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, // 128 bit
|
|
667
|
+
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
|
668
|
+
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, // 192 bit
|
|
669
|
+
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F // 256 bit
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
static const uint8_t aria_test1_ecb_pt[MBEDTLS_ARIA_BLOCKSIZE] = // plaintext
|
|
673
|
+
{
|
|
674
|
+
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, // same for all
|
|
675
|
+
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF // key sizes
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
static const uint8_t aria_test1_ecb_ct[3][MBEDTLS_ARIA_BLOCKSIZE] = // ciphertext
|
|
679
|
+
{
|
|
680
|
+
{ 0xD7, 0x18, 0xFB, 0xD6, 0xAB, 0x64, 0x4C, 0x73, // 128 bit
|
|
681
|
+
0x9D, 0xA9, 0x5F, 0x3B, 0xE6, 0x45, 0x17, 0x78 },
|
|
682
|
+
{ 0x26, 0x44, 0x9C, 0x18, 0x05, 0xDB, 0xE7, 0xAA, // 192 bit
|
|
683
|
+
0x25, 0xA4, 0x68, 0xCE, 0x26, 0x3A, 0x9E, 0x79 },
|
|
684
|
+
{ 0xF9, 0x2B, 0xD7, 0xC7, 0x9F, 0xB7, 0x2E, 0x2F, // 256 bit
|
|
685
|
+
0x2B, 0x8F, 0x80, 0xC1, 0x97, 0x2D, 0x24, 0xFC }
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
/*
|
|
689
|
+
* Mode tests from "Test Vectors for ARIA" Version 1.0
|
|
690
|
+
* http://210.104.33.10/ARIA/doc/ARIA-testvector-e.pdf
|
|
691
|
+
*/
|
|
692
|
+
#if (defined(MBEDTLS_CIPHER_MODE_CBC) || defined(MBEDTLS_CIPHER_MODE_CFB) || \
|
|
693
|
+
defined(MBEDTLS_CIPHER_MODE_CTR))
|
|
694
|
+
static const uint8_t aria_test2_key[32] =
|
|
695
|
+
{
|
|
696
|
+
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, // 128 bit
|
|
697
|
+
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
|
698
|
+
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, // 192 bit
|
|
699
|
+
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff // 256 bit
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
static const uint8_t aria_test2_pt[48] =
|
|
703
|
+
{
|
|
704
|
+
0x11, 0x11, 0x11, 0x11, 0xaa, 0xaa, 0xaa, 0xaa, // same for all
|
|
705
|
+
0x11, 0x11, 0x11, 0x11, 0xbb, 0xbb, 0xbb, 0xbb,
|
|
706
|
+
0x11, 0x11, 0x11, 0x11, 0xcc, 0xcc, 0xcc, 0xcc,
|
|
707
|
+
0x11, 0x11, 0x11, 0x11, 0xdd, 0xdd, 0xdd, 0xdd,
|
|
708
|
+
0x22, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0xaa,
|
|
709
|
+
0x22, 0x22, 0x22, 0x22, 0xbb, 0xbb, 0xbb, 0xbb,
|
|
710
|
+
};
|
|
711
|
+
#endif
|
|
712
|
+
|
|
713
|
+
#if (defined(MBEDTLS_CIPHER_MODE_CBC) || defined(MBEDTLS_CIPHER_MODE_CFB))
|
|
714
|
+
static const uint8_t aria_test2_iv[MBEDTLS_ARIA_BLOCKSIZE] =
|
|
715
|
+
{
|
|
716
|
+
0x0f, 0x1e, 0x2d, 0x3c, 0x4b, 0x5a, 0x69, 0x78, // same for CBC, CFB
|
|
717
|
+
0x87, 0x96, 0xa5, 0xb4, 0xc3, 0xd2, 0xe1, 0xf0 // CTR has zero IV
|
|
718
|
+
};
|
|
719
|
+
#endif
|
|
720
|
+
|
|
721
|
+
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
722
|
+
static const uint8_t aria_test2_cbc_ct[3][48] = // CBC ciphertext
|
|
723
|
+
{
|
|
724
|
+
{ 0x49, 0xd6, 0x18, 0x60, 0xb1, 0x49, 0x09, 0x10, // 128-bit key
|
|
725
|
+
0x9c, 0xef, 0x0d, 0x22, 0xa9, 0x26, 0x81, 0x34,
|
|
726
|
+
0xfa, 0xdf, 0x9f, 0xb2, 0x31, 0x51, 0xe9, 0x64,
|
|
727
|
+
0x5f, 0xba, 0x75, 0x01, 0x8b, 0xdb, 0x15, 0x38,
|
|
728
|
+
0xb5, 0x33, 0x34, 0x63, 0x4b, 0xbf, 0x7d, 0x4c,
|
|
729
|
+
0xd4, 0xb5, 0x37, 0x70, 0x33, 0x06, 0x0c, 0x15 },
|
|
730
|
+
{ 0xaf, 0xe6, 0xcf, 0x23, 0x97, 0x4b, 0x53, 0x3c, // 192-bit key
|
|
731
|
+
0x67, 0x2a, 0x82, 0x62, 0x64, 0xea, 0x78, 0x5f,
|
|
732
|
+
0x4e, 0x4f, 0x7f, 0x78, 0x0d, 0xc7, 0xf3, 0xf1,
|
|
733
|
+
0xe0, 0x96, 0x2b, 0x80, 0x90, 0x23, 0x86, 0xd5,
|
|
734
|
+
0x14, 0xe9, 0xc3, 0xe7, 0x72, 0x59, 0xde, 0x92,
|
|
735
|
+
0xdd, 0x11, 0x02, 0xff, 0xab, 0x08, 0x6c, 0x1e },
|
|
736
|
+
{ 0x52, 0x3a, 0x8a, 0x80, 0x6a, 0xe6, 0x21, 0xf1, // 256-bit key
|
|
737
|
+
0x55, 0xfd, 0xd2, 0x8d, 0xbc, 0x34, 0xe1, 0xab,
|
|
738
|
+
0x7b, 0x9b, 0x42, 0x43, 0x2a, 0xd8, 0xb2, 0xef,
|
|
739
|
+
0xb9, 0x6e, 0x23, 0xb1, 0x3f, 0x0a, 0x6e, 0x52,
|
|
740
|
+
0xf3, 0x61, 0x85, 0xd5, 0x0a, 0xd0, 0x02, 0xc5,
|
|
741
|
+
0xf6, 0x01, 0xbe, 0xe5, 0x49, 0x3f, 0x11, 0x8b }
|
|
742
|
+
};
|
|
743
|
+
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
|
744
|
+
|
|
745
|
+
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
|
746
|
+
static const uint8_t aria_test2_cfb_ct[3][48] = // CFB ciphertext
|
|
747
|
+
{
|
|
748
|
+
{ 0x37, 0x20, 0xe5, 0x3b, 0xa7, 0xd6, 0x15, 0x38, // 128-bit key
|
|
749
|
+
0x34, 0x06, 0xb0, 0x9f, 0x0a, 0x05, 0xa2, 0x00,
|
|
750
|
+
0xc0, 0x7c, 0x21, 0xe6, 0x37, 0x0f, 0x41, 0x3a,
|
|
751
|
+
0x5d, 0x13, 0x25, 0x00, 0xa6, 0x82, 0x85, 0x01,
|
|
752
|
+
0x7c, 0x61, 0xb4, 0x34, 0xc7, 0xb7, 0xca, 0x96,
|
|
753
|
+
0x85, 0xa5, 0x10, 0x71, 0x86, 0x1e, 0x4d, 0x4b },
|
|
754
|
+
{ 0x41, 0x71, 0xf7, 0x19, 0x2b, 0xf4, 0x49, 0x54, // 192-bit key
|
|
755
|
+
0x94, 0xd2, 0x73, 0x61, 0x29, 0x64, 0x0f, 0x5c,
|
|
756
|
+
0x4d, 0x87, 0xa9, 0xa2, 0x13, 0x66, 0x4c, 0x94,
|
|
757
|
+
0x48, 0x47, 0x7c, 0x6e, 0xcc, 0x20, 0x13, 0x59,
|
|
758
|
+
0x8d, 0x97, 0x66, 0x95, 0x2d, 0xd8, 0xc3, 0x86,
|
|
759
|
+
0x8f, 0x17, 0xe3, 0x6e, 0xf6, 0x6f, 0xd8, 0x4b },
|
|
760
|
+
{ 0x26, 0x83, 0x47, 0x05, 0xb0, 0xf2, 0xc0, 0xe2, // 256-bit key
|
|
761
|
+
0x58, 0x8d, 0x4a, 0x7f, 0x09, 0x00, 0x96, 0x35,
|
|
762
|
+
0xf2, 0x8b, 0xb9, 0x3d, 0x8c, 0x31, 0xf8, 0x70,
|
|
763
|
+
0xec, 0x1e, 0x0b, 0xdb, 0x08, 0x2b, 0x66, 0xfa,
|
|
764
|
+
0x40, 0x2d, 0xd9, 0xc2, 0x02, 0xbe, 0x30, 0x0c,
|
|
765
|
+
0x45, 0x17, 0xd1, 0x96, 0xb1, 0x4d, 0x4c, 0xe1 }
|
|
766
|
+
};
|
|
767
|
+
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
|
768
|
+
|
|
769
|
+
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
|
770
|
+
static const uint8_t aria_test2_ctr_ct[3][48] = // CTR ciphertext
|
|
771
|
+
{
|
|
772
|
+
{ 0xac, 0x5d, 0x7d, 0xe8, 0x05, 0xa0, 0xbf, 0x1c, // 128-bit key
|
|
773
|
+
0x57, 0xc8, 0x54, 0x50, 0x1a, 0xf6, 0x0f, 0xa1,
|
|
774
|
+
0x14, 0x97, 0xe2, 0xa3, 0x45, 0x19, 0xde, 0xa1,
|
|
775
|
+
0x56, 0x9e, 0x91, 0xe5, 0xb5, 0xcc, 0xae, 0x2f,
|
|
776
|
+
0xf3, 0xbf, 0xa1, 0xbf, 0x97, 0x5f, 0x45, 0x71,
|
|
777
|
+
0xf4, 0x8b, 0xe1, 0x91, 0x61, 0x35, 0x46, 0xc3 },
|
|
778
|
+
{ 0x08, 0x62, 0x5c, 0xa8, 0xfe, 0x56, 0x9c, 0x19, // 192-bit key
|
|
779
|
+
0xba, 0x7a, 0xf3, 0x76, 0x0a, 0x6e, 0xd1, 0xce,
|
|
780
|
+
0xf4, 0xd1, 0x99, 0x26, 0x3e, 0x99, 0x9d, 0xde,
|
|
781
|
+
0x14, 0x08, 0x2d, 0xbb, 0xa7, 0x56, 0x0b, 0x79,
|
|
782
|
+
0xa4, 0xc6, 0xb4, 0x56, 0xb8, 0x70, 0x7d, 0xce,
|
|
783
|
+
0x75, 0x1f, 0x98, 0x54, 0xf1, 0x88, 0x93, 0xdf },
|
|
784
|
+
{ 0x30, 0x02, 0x6c, 0x32, 0x96, 0x66, 0x14, 0x17, // 256-bit key
|
|
785
|
+
0x21, 0x17, 0x8b, 0x99, 0xc0, 0xa1, 0xf1, 0xb2,
|
|
786
|
+
0xf0, 0x69, 0x40, 0x25, 0x3f, 0x7b, 0x30, 0x89,
|
|
787
|
+
0xe2, 0xa3, 0x0e, 0xa8, 0x6a, 0xa3, 0xc8, 0x8f,
|
|
788
|
+
0x59, 0x40, 0xf0, 0x5a, 0xd7, 0xee, 0x41, 0xd7,
|
|
789
|
+
0x13, 0x47, 0xbb, 0x72, 0x61, 0xe3, 0x48, 0xf1 }
|
|
790
|
+
};
|
|
791
|
+
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
|
792
|
+
|
|
793
|
+
#define ARIA_SELF_TEST_ASSERT(cond) \
|
|
794
|
+
do { \
|
|
795
|
+
if (cond) { \
|
|
796
|
+
if (verbose) \
|
|
797
|
+
mbedtls_printf("failed\n"); \
|
|
798
|
+
goto exit; \
|
|
799
|
+
} else { \
|
|
800
|
+
if (verbose) \
|
|
801
|
+
mbedtls_printf("passed\n"); \
|
|
802
|
+
} \
|
|
803
|
+
} while (0)
|
|
804
|
+
|
|
805
|
+
/*
|
|
806
|
+
* Checkup routine
|
|
807
|
+
*/
|
|
808
|
+
int mbedtls_aria_self_test(int verbose)
|
|
809
|
+
{
|
|
810
|
+
int i;
|
|
811
|
+
uint8_t blk[MBEDTLS_ARIA_BLOCKSIZE];
|
|
812
|
+
mbedtls_aria_context ctx;
|
|
813
|
+
int ret = 1;
|
|
814
|
+
|
|
815
|
+
#if (defined(MBEDTLS_CIPHER_MODE_CFB) || defined(MBEDTLS_CIPHER_MODE_CTR))
|
|
816
|
+
size_t j;
|
|
817
|
+
#endif
|
|
818
|
+
|
|
819
|
+
#if (defined(MBEDTLS_CIPHER_MODE_CBC) || \
|
|
820
|
+
defined(MBEDTLS_CIPHER_MODE_CFB) || \
|
|
821
|
+
defined(MBEDTLS_CIPHER_MODE_CTR))
|
|
822
|
+
uint8_t buf[48], iv[MBEDTLS_ARIA_BLOCKSIZE];
|
|
823
|
+
#endif
|
|
824
|
+
|
|
825
|
+
mbedtls_aria_init(&ctx);
|
|
826
|
+
|
|
827
|
+
/*
|
|
828
|
+
* Test set 1
|
|
829
|
+
*/
|
|
830
|
+
for (i = 0; i < 3; i++) {
|
|
831
|
+
/* test ECB encryption */
|
|
832
|
+
if (verbose) {
|
|
833
|
+
mbedtls_printf(" ARIA-ECB-%d (enc): ", 128 + 64 * i);
|
|
834
|
+
}
|
|
835
|
+
mbedtls_aria_setkey_enc(&ctx, aria_test1_ecb_key, 128 + 64 * i);
|
|
836
|
+
mbedtls_aria_crypt_ecb(&ctx, aria_test1_ecb_pt, blk);
|
|
837
|
+
ARIA_SELF_TEST_ASSERT(
|
|
838
|
+
memcmp(blk, aria_test1_ecb_ct[i], MBEDTLS_ARIA_BLOCKSIZE)
|
|
839
|
+
!= 0);
|
|
840
|
+
|
|
841
|
+
/* test ECB decryption */
|
|
842
|
+
if (verbose) {
|
|
843
|
+
mbedtls_printf(" ARIA-ECB-%d (dec): ", 128 + 64 * i);
|
|
844
|
+
#if defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
|
|
845
|
+
mbedtls_printf("skipped\n");
|
|
846
|
+
#endif
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
#if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
|
|
850
|
+
mbedtls_aria_setkey_dec(&ctx, aria_test1_ecb_key, 128 + 64 * i);
|
|
851
|
+
mbedtls_aria_crypt_ecb(&ctx, aria_test1_ecb_ct[i], blk);
|
|
852
|
+
ARIA_SELF_TEST_ASSERT(
|
|
853
|
+
memcmp(blk, aria_test1_ecb_pt, MBEDTLS_ARIA_BLOCKSIZE)
|
|
854
|
+
!= 0);
|
|
855
|
+
#endif
|
|
856
|
+
}
|
|
857
|
+
if (verbose) {
|
|
858
|
+
mbedtls_printf("\n");
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/*
|
|
862
|
+
* Test set 2
|
|
863
|
+
*/
|
|
864
|
+
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
|
865
|
+
for (i = 0; i < 3; i++) {
|
|
866
|
+
/* Test CBC encryption */
|
|
867
|
+
if (verbose) {
|
|
868
|
+
mbedtls_printf(" ARIA-CBC-%d (enc): ", 128 + 64 * i);
|
|
869
|
+
}
|
|
870
|
+
mbedtls_aria_setkey_enc(&ctx, aria_test2_key, 128 + 64 * i);
|
|
871
|
+
memcpy(iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE);
|
|
872
|
+
memset(buf, 0x55, sizeof(buf));
|
|
873
|
+
mbedtls_aria_crypt_cbc(&ctx, MBEDTLS_ARIA_ENCRYPT, 48, iv,
|
|
874
|
+
aria_test2_pt, buf);
|
|
875
|
+
ARIA_SELF_TEST_ASSERT(memcmp(buf, aria_test2_cbc_ct[i], 48)
|
|
876
|
+
!= 0);
|
|
877
|
+
|
|
878
|
+
/* Test CBC decryption */
|
|
879
|
+
if (verbose) {
|
|
880
|
+
mbedtls_printf(" ARIA-CBC-%d (dec): ", 128 + 64 * i);
|
|
881
|
+
}
|
|
882
|
+
mbedtls_aria_setkey_dec(&ctx, aria_test2_key, 128 + 64 * i);
|
|
883
|
+
memcpy(iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE);
|
|
884
|
+
memset(buf, 0xAA, sizeof(buf));
|
|
885
|
+
mbedtls_aria_crypt_cbc(&ctx, MBEDTLS_ARIA_DECRYPT, 48, iv,
|
|
886
|
+
aria_test2_cbc_ct[i], buf);
|
|
887
|
+
ARIA_SELF_TEST_ASSERT(memcmp(buf, aria_test2_pt, 48) != 0);
|
|
888
|
+
}
|
|
889
|
+
if (verbose) {
|
|
890
|
+
mbedtls_printf("\n");
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
|
894
|
+
|
|
895
|
+
#if defined(MBEDTLS_CIPHER_MODE_CFB)
|
|
896
|
+
for (i = 0; i < 3; i++) {
|
|
897
|
+
/* Test CFB encryption */
|
|
898
|
+
if (verbose) {
|
|
899
|
+
mbedtls_printf(" ARIA-CFB-%d (enc): ", 128 + 64 * i);
|
|
900
|
+
}
|
|
901
|
+
mbedtls_aria_setkey_enc(&ctx, aria_test2_key, 128 + 64 * i);
|
|
902
|
+
memcpy(iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE);
|
|
903
|
+
memset(buf, 0x55, sizeof(buf));
|
|
904
|
+
j = 0;
|
|
905
|
+
mbedtls_aria_crypt_cfb128(&ctx, MBEDTLS_ARIA_ENCRYPT, 48, &j, iv,
|
|
906
|
+
aria_test2_pt, buf);
|
|
907
|
+
ARIA_SELF_TEST_ASSERT(memcmp(buf, aria_test2_cfb_ct[i], 48) != 0);
|
|
908
|
+
|
|
909
|
+
/* Test CFB decryption */
|
|
910
|
+
if (verbose) {
|
|
911
|
+
mbedtls_printf(" ARIA-CFB-%d (dec): ", 128 + 64 * i);
|
|
912
|
+
}
|
|
913
|
+
mbedtls_aria_setkey_enc(&ctx, aria_test2_key, 128 + 64 * i);
|
|
914
|
+
memcpy(iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE);
|
|
915
|
+
memset(buf, 0xAA, sizeof(buf));
|
|
916
|
+
j = 0;
|
|
917
|
+
mbedtls_aria_crypt_cfb128(&ctx, MBEDTLS_ARIA_DECRYPT, 48, &j,
|
|
918
|
+
iv, aria_test2_cfb_ct[i], buf);
|
|
919
|
+
ARIA_SELF_TEST_ASSERT(memcmp(buf, aria_test2_pt, 48) != 0);
|
|
920
|
+
}
|
|
921
|
+
if (verbose) {
|
|
922
|
+
mbedtls_printf("\n");
|
|
923
|
+
}
|
|
924
|
+
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
|
925
|
+
|
|
926
|
+
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
|
927
|
+
for (i = 0; i < 3; i++) {
|
|
928
|
+
/* Test CTR encryption */
|
|
929
|
+
if (verbose) {
|
|
930
|
+
mbedtls_printf(" ARIA-CTR-%d (enc): ", 128 + 64 * i);
|
|
931
|
+
}
|
|
932
|
+
mbedtls_aria_setkey_enc(&ctx, aria_test2_key, 128 + 64 * i);
|
|
933
|
+
memset(iv, 0, MBEDTLS_ARIA_BLOCKSIZE); // IV = 0
|
|
934
|
+
memset(buf, 0x55, sizeof(buf));
|
|
935
|
+
j = 0;
|
|
936
|
+
mbedtls_aria_crypt_ctr(&ctx, 48, &j, iv, blk,
|
|
937
|
+
aria_test2_pt, buf);
|
|
938
|
+
ARIA_SELF_TEST_ASSERT(memcmp(buf, aria_test2_ctr_ct[i], 48) != 0);
|
|
939
|
+
|
|
940
|
+
/* Test CTR decryption */
|
|
941
|
+
if (verbose) {
|
|
942
|
+
mbedtls_printf(" ARIA-CTR-%d (dec): ", 128 + 64 * i);
|
|
943
|
+
}
|
|
944
|
+
mbedtls_aria_setkey_enc(&ctx, aria_test2_key, 128 + 64 * i);
|
|
945
|
+
memset(iv, 0, MBEDTLS_ARIA_BLOCKSIZE); // IV = 0
|
|
946
|
+
memset(buf, 0xAA, sizeof(buf));
|
|
947
|
+
j = 0;
|
|
948
|
+
mbedtls_aria_crypt_ctr(&ctx, 48, &j, iv, blk,
|
|
949
|
+
aria_test2_ctr_ct[i], buf);
|
|
950
|
+
ARIA_SELF_TEST_ASSERT(memcmp(buf, aria_test2_pt, 48) != 0);
|
|
951
|
+
}
|
|
952
|
+
if (verbose) {
|
|
953
|
+
mbedtls_printf("\n");
|
|
954
|
+
}
|
|
955
|
+
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
|
956
|
+
|
|
957
|
+
ret = 0;
|
|
958
|
+
|
|
959
|
+
exit:
|
|
960
|
+
mbedtls_aria_free(&ctx);
|
|
961
|
+
return ret;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
#endif /* MBEDTLS_SELF_TEST */
|
|
965
|
+
|
|
966
|
+
#endif /* MBEDTLS_ARIA_C */
|