diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 70ebd77..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: "CodeQL" - -on: - workflow_dispatch: - push: - pull_request: - branches: - - main - - develop - - master # for safety reasons - - dev # for safety reasons - -jobs: - analyse: - name: Analyse - if: github.event.repository.private == false - strategy: - matrix: - sdk: ["$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK"] - runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }} - container: - image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest - - steps: - - name: Clone - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: cpp - queries: security-and-quality - - - name: Build - run: | - make -j BOLOS_SDK=${{ matrix.sdk }} - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index b4a73fb..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Lint and format 💅 - -on: - workflow_dispatch: - push: - pull_request: - branches: - - main - - develop - - master # for safety reasons - - dev # for safety reasons - -jobs: - lint: - runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }} - container: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Add missing deps - env: - DEBIAN_FRONTEND: noninteractive - run: | - apt-get update - apt-get install -y bear sudo - - name: Generate compilation database - run: bear -- make -j BOLOS_SDK="$NANOSP_SDK" - - name: Setup python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Lint and format 💅 - uses: cpp-linter/cpp-linter-action@v2 - id: linter - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - file-annotations: true - files-changed-only: false - ignore: "app/build|cmake|deps|fuzz|tests" - step-summary: true - style: file # uses .clang-format - thread-comments: true - tidy-checks: "" # use only .clang-tidy checks - - name: Fail if errors - if: steps.linter.outputs.checks-failed > 0 - run: | - echo "Linter or formatter failed!" - exit 1 diff --git a/.gitmodules b/.gitmodules index d83af2c..57b783a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "js"] path = js url = https://github.com/Zondax/ledger-ironfish-js +[submodule "deps/ledger-rust"] + path = deps/ledger-rust + url = https://github.com/Zondax/ledger-rust diff --git a/Makefile b/Makefile index 116f0c1..6faa3bc 100644 --- a/Makefile +++ b/Makefile @@ -41,3 +41,10 @@ test_all: PRODUCTION_BUILD=1 make make zemu_install make zemu_test + +all: + @$(MAKE) clean + @$(MAKE) buildS + @$(MAKE) buildX + @$(MAKE) buildS2 + @$(MAKE) buildST \ No newline at end of file diff --git a/app/Makefile b/app/Makefile index 7e568b9..707dd8f 100755 --- a/app/Makefile +++ b/app/Makefile @@ -83,7 +83,7 @@ RUST_TARGET:=thumbv6m-none-eabi .PHONY: rust rust: - cd rust && RUSTC_BOOTSTRAP=1 CARGO_HOME="$(CURDIR)/rust/.cargo" cargo build --target $(RUST_TARGET) --release + cd rust && RUSTC_BOOTSTRAP=1 CARGO_HOME="$(CURDIR)/rust/.cargo" TARGET_NAME=$(TARGET_NAME) cargo build --target $(RUST_TARGET) --release .PHONY: rust_clean rust_clean: diff --git a/app/Makefile.version b/app/Makefile.version index 7ea8201..c1c7e1f 100644 --- a/app/Makefile.version +++ b/app/Makefile.version @@ -1,6 +1,6 @@ # This is the major version APPVERSION_M=0 # This is the minor version -APPVERSION_N=0 +APPVERSION_N=1 # This is the patch version -APPVERSION_P=12 +APPVERSION_P=0 diff --git a/app/rust/.cargo/config.toml b/app/rust/.cargo/config.toml index 90cae2f..31762f9 100644 --- a/app/rust/.cargo/config.toml +++ b/app/rust/.cargo/config.toml @@ -1,5 +1,3 @@ -[build] - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] rustflags = [ "--emit", "asm", @@ -8,6 +6,26 @@ rustflags = [ "-C", "link-arg=-Tlink.ld", "-C", "inline-threshold=0" ] + +# rustflags required in order to bolos-sys won't compile. Required in this project to use lazy_static +# - rustflags = ["-Ctarget-feature=-crt-static"] +# Reference: https://github.com/rust-lang/rust-bindgen/issues/2360#issuecomment-1595909134 +[host] +rustflags = ["-Ctarget-feature=-crt-static"] + +# Needed for the embedded alloc feature, which enables the global alloc using the stack memory +# Come from this example to use ironfish-frost on ledger devices +# - build-std=["alloc"] +# - build-std-features=["compiler-builtins-mem"] +# Reference: https://github.com/iron-fish/ironfish-frost-ledger/tree/ad03ed83b5f2ebf4f494ae260fa1cf81c4599d58 +# ----- +# These two flags need to be true, otherwise bolos-sys crate won't compile. Required in this project to use lazy_static +# - target-applies-to-host = true +# - host-config = true +# Reference: https://github.com/rust-lang/rust-bindgen/issues/2360#issuecomment-1595909134 [unstable] -build-std=["core"] -build-std-features=["panic_immediate_abort"] +build-std=["core", "alloc"] +build-std-features=["panic_immediate_abort", "compiler-builtins-mem"] +target-applies-to-host = true +host-config = true + diff --git a/app/rust/.gitignore b/app/rust/.gitignore index 2f7896d..fda301b 100644 --- a/app/rust/.gitignore +++ b/app/rust/.gitignore @@ -1 +1,3 @@ target/ +.cargo/git +.cargo/registry \ No newline at end of file diff --git a/app/rust/Cargo.lock b/app/rust/Cargo.lock index 61621b6..c64669f 100644 --- a/app/rust/Cargo.lock +++ b/app/rust/Cargo.lock @@ -2,6 +2,99 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "arrayref" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bindgen" +version = "0.66.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.72", + "which", +] + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + [[package]] name = "bitvec" version = "1.0.1" @@ -14,6 +107,46 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake2" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "bls12_381" version = "0.8.0" @@ -21,94 +154,1658 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" dependencies = [ "ff", - "rand_core", + "rand_core 0.6.4", "subtle", ] [[package]] -name = "ff" -version = "0.13.0" +name = "bolos" +version = "0.1.0" +dependencies = [ + "bolos-derive", + "bolos-impl", + "bolos-mock", + "cfg-if", + "crc", + "educe", + "no-std-compat", + "zemu-sys", + "zeroize", +] + +[[package]] +name = "bolos-common" +version = "0.1.0" +dependencies = [ + "no-std-compat", +] + +[[package]] +name = "bolos-derive" +version = "0.1.0" +dependencies = [ + "convert_case", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bolos-impl" +version = "0.1.0" +dependencies = [ + "bolos-common", + "bolos-sys", + "cfg-if", + "enumflags2", + "no-std-compat", + "zemu-sys", + "zeroize", +] + +[[package]] +name = "bolos-mock" +version = "0.1.0" +dependencies = [ + "blake2", + "bolos-common", + "cfg-if", + "ed25519-dalek 1.0.1", + "enumflags2", + "hmac 0.11.0", + "k256", + "p256", + "rand 0.7.3", + "rand 0.8.5", + "rand_chacha 0.2.2", + "rand_chacha 0.3.1", + "ripemd", + "sha2 0.9.9", + "tiny-keccak", +] + +[[package]] +name = "bolos-sys" +version = "0.1.0" +dependencies = [ + "bindgen", + "cfg-if", + "zeroize", +] + +[[package]] +name = "build_const" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "const-crc32-nostd" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808ac43170e95b11dd23d78aa9eaac5bea45776a602955552c4e833f3f0f823d" + +[[package]] +name = "const-default" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +dependencies = [ + "build_const", +] + +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "rand_core", + "generic-array", + "rand_core 0.6.4", "subtle", + "zeroize", ] [[package]] -name = "funty" -version = "2.0.0" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "typenum", +] [[package]] -name = "group" -version = "0.13.0" +name = "crypto-mac" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "ff", - "rand_core", + "generic-array", "subtle", ] [[package]] -name = "jubjub" -version = "0.10.0" +name = "crypto-mac" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8499f7a74008aafbecb2a2e608a3e13e4dd3e84df198b604451efe93f2de6e61" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ - "bitvec", - "bls12_381", - "ff", - "group", - "rand_core", + "generic-array", "subtle", ] [[package]] -name = "panic-halt" -version = "0.2.0" +name = "cty" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] -name = "radium" -version = "0.7.0" +name = "curve25519-dalek" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] [[package]] -name = "rand_core" -version = "0.6.4" +name = "curve25519-dalek" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] [[package]] -name = "rslib" -version = "0.1.0" +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ - "jubjub", - "panic-halt", + "proc-macro2", + "quote", + "syn 2.0.72", ] [[package]] -name = "subtle" -version = "2.5.0" +name = "debugless-unwrap" +version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "f400d0750c0c069e8493f2256cb4da6f604b6d2eeb69a0ca8863acde352f8400" [[package]] -name = "tap" +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "derive-getters" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6433aac097572ea8ccc60b3f2e756c661c9aeed9225cdd4d0cb119cb7ff6ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "document-features" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +dependencies = [ + "litrs", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature 2.2.0", + "spki", +] + +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature 2.2.0", +] + +[[package]] +name = "ed25519-dalek" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519 1.5.3", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] [[package]] -name = "wyz" -version = "0.5.1" +name = "ed25519-dalek" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ - "tap", + "curve25519-dalek 4.1.3", + "ed25519 2.2.3", + "rand_core 0.6.4", + "serde", + "sha2 0.10.8", + "subtle", + "zeroize", +] + +[[package]] +name = "educe" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pem-rfc7468", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "enum-ordinalize" +version = "3.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "enumflags2" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "frost-core" +version = "2.0.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed1383227a6606aacf5df9a17ff57824c6971a0ab225b69b911bec0ba7bbb869" +dependencies = [ + "byteorder", + "const-crc32-nostd", + "debugless-unwrap", + "derive-getters", + "document-features", + "hex", + "itertools", + "postcard", + "rand_core 0.6.4", + "serde", + "serdect", + "thiserror-nostd-notrait", + "visibility", + "zeroize", +] + +[[package]] +name = "frost-rerandomized" +version = "2.0.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb14a6054f9ce5aa4912c60c11392d42c43acec8295ee1df1f67a9d0b7a73ee" +dependencies = [ + "derive-getters", + "document-features", + "frost-core", + "hex", + "rand_core 0.6.4", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "heapless" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version", + "serde", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ironfish-frost" +version = "0.1.0" +source = "git+https://github.com/iron-fish/ironfish-frost.git?branch=no-std#ddfbe110e584e3e49cc0a68fbb8af5c92994fcd4" +dependencies = [ + "chacha20", + "chacha20poly1305", + "ed25519-dalek 2.1.1", + "rand_core 0.6.4", + "reddsa", + "siphasher", + "x25519-dalek", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "jubjub" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8499f7a74008aafbecb2a2e608a3e13e4dd3e84df198b604451efe93f2de6e61" +dependencies = [ + "bitvec", + "bls12_381", + "ff", + "group", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.8", + "signature 2.2.0", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "linked_list_allocator" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "no-std-compat" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2 0.10.8", +] + +[[package]] +name = "panic-halt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" + +[[package]] +name = "pasta_curves" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e57598f73cc7e1b2ac63c79c517b31a0877cd7c402cdcaa311b5208de7a095" +dependencies = [ + "ff", + "group", + "rand 0.8.5", + "static_assertions", + "subtle", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "heapless", + "serde", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.72", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.1" +source = "git+https://github.com/iron-fish/radium?rev=674c8faf1e74f931a58671f70586e6435353e9b6#674c8faf1e74f931a58671f70586e6435353e9b6" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.15", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "reddsa" +version = "0.5.1" +source = "git+https://github.com/ZcashFoundation/reddsa.git?rev=9ac52c5c60e454b0032d78a22c05fb79aae1d51e#9ac52c5c60e454b0032d78a22c05fb79aae1d51e" +dependencies = [ + "blake2b_simd", + "byteorder", + "frost-rerandomized", + "group", + "hex", + "jubjub", + "pasta_curves", + "rand_core 0.6.4", +] + +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "rlsf" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222fb240c3286247ecdee6fa5341e7cdad0ffdf8e7e401d9937f2d58482a20bf" +dependencies = [ + "cfg-if", + "const-default", + "libc", + "svgbobdoc", +] + +[[package]] +name = "rslib" +version = "0.1.0" +dependencies = [ + "bolos", + "const-default", + "critical-section", + "getrandom 0.2.15", + "ironfish-frost", + "jubjub", + "linked_list_allocator", + "panic-halt", + "rlsf", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.205" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.205" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "serdect" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +dependencies = [ + "base16ct", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "svgbobdoc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50" +dependencies = [ + "base64", + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-width", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "thiserror-nostd-notrait" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8444e638022c44d2a9337031dee8acb732bcc7fbf52ac654edc236b26408b61" +dependencies = [ + "thiserror-nostd-notrait-impl", +] + +[[package]] +name = "thiserror-nostd-notrait-impl" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585e5ef40a784ce60b49c67d762110688d211d395d39e096be204535cf64590e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "visibility" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3fd98999db9227cf28e59d83e1f120f42bc233d4b152e8fab9bc87d5bb1e0f8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek 4.1.3", + "rand_core 0.6.4", +] + +[[package]] +name = "zemu-sys" +version = "0.1.0" +dependencies = [ + "arrayvec", + "bolos-derive", + "bolos-sys", + "cfg-if", + "cty", + "itoa", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", ] diff --git a/app/rust/Cargo.toml b/app/rust/Cargo.toml index b60bd4f..5293c77 100644 --- a/app/rust/Cargo.toml +++ b/app/rust/Cargo.toml @@ -14,6 +14,19 @@ crate-type = ["staticlib"] [dependencies] jubjub = { version = "0.10.0", default-features = false } +critical-section = { version = "1.1.2" } + +linked_list_allocator = { version = "0.10.5", default-features = false } +rlsf = { version = "0.2.1", default-features = false, optional = true } +const-default = { version = "1.0.0", default-features = false, optional = true } + +# bolos and bolos-common are required to use lazy-static +bolos = { path = "../../deps/ledger-rust/bolos" } + +# Taken from https://github.com/iron-fish/ironfish-frost-ledger/tree/ad03ed83b5f2ebf4f494ae260fa1cf81c4599d58 +ironfish-frost = { git = "https://github.com/iron-fish/ironfish-frost.git", branch = "no-std", default-features = false, features = ["dkg"]} +getrandom = { version = "0.2", features = ["custom"] } + [target.thumbv6m-none-eabi.dev-dependencies] panic-halt = "0.2.0" @@ -35,3 +48,10 @@ panic = "abort" default = [] # use when compiling this crate as a lib for the cpp_tests suite cpp_tests = [] + + +# From https://github.com/iron-fish/ironfish-frost-ledger/tree/ad03ed83b5f2ebf4f494ae260fa1cf81c4599d58 +# TODO: This change shouldn't be necessary, the ledger targets clearly define atomics as only supporting 32 not 64 (as seen in /opt/rustup/toolchains/1.75.0-aarch64-unknown-linux-musl/lib/rustlib/nanosplus/target.json) +# solve why this is happening rather than using modified radium +[patch.crates-io] +radium = { git = "https://github.com/iron-fish/radium", rev = "674c8faf1e74f931a58671f70586e6435353e9b6" } \ No newline at end of file diff --git a/app/rust/include/rslib.h b/app/rust/include/rslib.h index 4d8277e..7a08b1e 100644 --- a/app/rust/include/rslib.h +++ b/app/rust/include/rslib.h @@ -16,6 +16,9 @@ parser_error_t randomizeKey(const uint8_t key[KEY_LENGTH], const uint8_t randomn parser_error_t compute_sbar(const uint8_t s[KEY_LENGTH], const uint8_t r[KEY_LENGTH], const uint8_t rsk[KEY_LENGTH], uint8_t sbar[32]); +// Required to initialize a heap for alloc into the stack memory (necessary for alloc feature on embedded devices) +parser_error_t heap_init(); + #ifdef __cplusplus } #endif diff --git a/app/rust/src/heap.rs b/app/rust/src/heap.rs new file mode 100644 index 0000000..9809b17 --- /dev/null +++ b/app/rust/src/heap.rs @@ -0,0 +1,128 @@ +// Code taken from +// https://github.com/Zondax/embedded-alloc +// https://crates.io/crates/embedded-alloc/0.5.1 + +// LLHeap with PIC on RefCell +// This was required to PIC the RefCell on the Heap struct. Otherwise, the app will fail with segmentation fault. + +use core::alloc::{GlobalAlloc, Layout}; +use core::cell::RefCell; +use core::ptr::{self, NonNull}; + +use critical_section::Mutex; +use linked_list_allocator::Heap as LLHeap; + +use bolos::{pic::PIC}; + +/// A linked list first fit heap. +pub struct Heap { + heap: Mutex>>, +} + +impl Heap { + /// Create a new UNINITIALIZED heap allocator + /// + /// You must initialize this heap using the + /// [`init`](Self::init) method before using the allocator. + pub const fn empty() -> Heap { + Heap { + heap: Mutex::new(PIC::new(RefCell::new(LLHeap::empty()))), + } + } + + /// Initializes the heap + /// + /// This function must be called BEFORE you run any code that makes use of the + /// allocator. + /// + /// `start_addr` is the address where the heap will be located. + /// + /// `size` is the size of the heap in bytes. + /// + /// Note that: + /// + /// - The heap grows "upwards", towards larger addresses. Thus `start_addr` will + /// be the smallest address used. + /// + /// - The largest address used is `start_addr + size - 1`, so if `start_addr` is + /// `0x1000` and `size` is `0x30000` then the allocator won't use memory at + /// addresses `0x31000` and larger. + /// + /// # Safety + /// + /// Obey these or Bad Stuff will happen. + /// + /// - This function must be called exactly ONCE. + /// - `size > 0` + pub unsafe fn init(&self, start_addr: usize, size: usize) { + critical_section::with(|cs| { + self.heap + .borrow(cs) + .borrow_mut() + .init(start_addr as *mut u8, size); + }); + } + + /// Returns an estimate of the amount of bytes in use. + pub fn used(&self) -> usize { + critical_section::with(|cs| self.heap.borrow(cs).borrow_mut().used()) + } + + /// Returns an estimate of the amount of bytes available. + pub fn free(&self) -> usize { + critical_section::with(|cs| self.heap.borrow(cs).borrow_mut().free()) + } + + fn alloc(&self, layout: Layout) -> Option> { + critical_section::with(|cs| { + self.heap + .borrow(cs) + .borrow_mut() + .allocate_first_fit(layout) + .ok() + }) + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + critical_section::with(|cs| { + self.heap + .borrow(cs) + .borrow_mut() + .deallocate(NonNull::new_unchecked(ptr), layout) + }); + } +} + +unsafe impl GlobalAlloc for Heap { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + self.alloc(layout) + .map_or(ptr::null_mut(), |allocation| allocation.as_ptr()) + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + self.dealloc(ptr, layout); + } +} + +#[cfg(feature = "allocator_api")] +mod allocator_api { + use super::*; + use core::alloc::{AllocError, Allocator}; + + unsafe impl Allocator for Heap { + fn allocate(&self, layout: Layout) -> Result, AllocError> { + match layout.size() { + 0 => Ok(NonNull::slice_from_raw_parts(layout.dangling(), 0)), + size => self.alloc(layout).map_or(Err(AllocError), |allocation| { + Ok(NonNull::slice_from_raw_parts(allocation, size)) + }), + } + } + + unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { + if layout.size() != 0 { + self.dealloc(ptr.as_ptr(), layout); + } + } + } +} \ No newline at end of file diff --git a/app/rust/src/lib.rs b/app/rust/src/lib.rs index dfd4a28..52a7720 100644 --- a/app/rust/src/lib.rs +++ b/app/rust/src/lib.rs @@ -21,9 +21,35 @@ use core::panic::PanicInfo; use constants::{SPENDING_KEY_GENERATOR}; mod constants; +mod heap; use jubjub::{Fr, AffinePoint, ExtendedPoint}; +use heap::Heap; +use critical_section::RawRestoreState; +use core::mem::MaybeUninit; + +use bolos::{lazy_static, pic::PIC}; + +// TODO increase this whenever dkg features are set as rust feature. Nano S device won't have this feature enabled +// TODO For now, if this is bigger, nano s build will fail. +const HEAP_SIZE :usize = 100; + +#[global_allocator] +static HEAP: Heap = Heap::empty(); + +#[lazy_static] +static mut BUFFER: [u8;HEAP_SIZE] = [0u8;HEAP_SIZE]; + +struct CriticalSection; +critical_section::set_impl!(CriticalSection); + +/// Default empty implementation as we don't have concurrency. +unsafe impl critical_section::Impl for CriticalSection { + unsafe fn acquire() -> RawRestoreState {} + unsafe fn release(_restore_state: RawRestoreState) {} +} + // ParserError should mirror parser_error_t from parser_common. // At the moment, just implement OK or Error #[repr(C)] @@ -40,6 +66,15 @@ pub enum ConstantKey { PublicKeyGenerator, } +/// Initializes the heap memory for the global allocator. +/// +/// The heap is stored in the stack, and has a fixed size. +/// This method is called just before [sample_main]. +#[no_mangle] +pub extern "C" fn heap_init() -> ParserError { + unsafe { HEAP.init(BUFFER.as_mut_ptr() as usize, HEAP_SIZE) }; + ParserError::ParserOk +} #[no_mangle] pub extern "C" fn from_bytes_wide(input: &[u8; 64], output: &mut [u8; 32]) -> ParserError { let result = Fr::from_bytes_wide(input).to_bytes(); @@ -90,7 +125,7 @@ pub extern "C" fn compute_sbar( s: &[u8; 32], r: &[u8; 32], rsk: &[u8; 32], s } -#[cfg(not(test))] +#[cfg(not(feature = "cpp_tests"))] #[panic_handler] fn panic(_info: &PanicInfo) -> ! { loop {} @@ -98,7 +133,7 @@ fn panic(_info: &PanicInfo) -> ! { fn debug(_msg: &str) {} -#[cfg(test)] +#[cfg(feature = "cpp_tests")] mod tests { use super::*; extern crate std; diff --git a/app/src/apdu_handler.c b/app/src/apdu_handler.c index c7e68b3..6537562 100644 --- a/app/src/apdu_handler.c +++ b/app/src/apdu_handler.c @@ -29,8 +29,10 @@ #include "view.h" #include "view_internal.h" #include "zxmacros.h" +#include "rslib.h" static bool tx_initialized = false; +static bool heap_initialized = false; void extractHDPath(uint32_t rx, uint32_t offset) { tx_initialized = false; @@ -183,6 +185,11 @@ void handleApdu(volatile uint32_t *flags, volatile uint32_t *tx, uint32_t rx) { THROW(APDU_CODE_WRONG_LENGTH); } + if(!heap_initialized){ + heap_initialized = true; + heap_init(); + } + switch (G_io_apdu_buffer[OFFSET_INS]) { case INS_GET_VERSION: { handle_getversion(flags, tx); diff --git a/deps/ledger-rust b/deps/ledger-rust new file mode 160000 index 0000000..d840e1a --- /dev/null +++ b/deps/ledger-rust @@ -0,0 +1 @@ +Subproject commit d840e1a4e6124a4844a4a84220d5ee0e5cf3d29b diff --git a/deps/ledger-zxlib b/deps/ledger-zxlib index 987aba1..4b60244 160000 --- a/deps/ledger-zxlib +++ b/deps/ledger-zxlib @@ -1 +1 @@ -Subproject commit 987aba18d3ea66b79e584c71a42d4e39b07cec4f +Subproject commit 4b60244c489e6d4e0e48a7f38272dadd24415ef6 diff --git a/tests_zemu/package.json b/tests_zemu/package.json index f03ee42..a675371 100644 --- a/tests_zemu/package.json +++ b/tests_zemu/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@zondax/ledger-ironfish": "../js", - "@zondax/zemu": "^0.49.0" + "@zondax/zemu": "^0.50.2" }, "devDependencies": { "@ledgerhq/hw-transport-node-hid": "^6.28.6", diff --git a/tests_zemu/snapshots/s-blind_sign/00000.png b/tests_zemu/snapshots/s-blind_sign/00000.png new file mode 100644 index 0000000..24426ad Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign/00000.png differ diff --git a/tests_zemu/snapshots/s-blind_sign/00001.png b/tests_zemu/snapshots/s-blind_sign/00001.png new file mode 100644 index 0000000..19e84b8 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign/00001.png differ diff --git a/tests_zemu/snapshots/s-blind_sign/00002.png b/tests_zemu/snapshots/s-blind_sign/00002.png new file mode 100644 index 0000000..831e7db Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign/00002.png differ diff --git a/tests_zemu/snapshots/s-blind_sign/00003.png b/tests_zemu/snapshots/s-blind_sign/00003.png new file mode 100644 index 0000000..c472099 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign/00003.png differ diff --git a/tests_zemu/snapshots/s-blind_sign/00004.png b/tests_zemu/snapshots/s-blind_sign/00004.png new file mode 100644 index 0000000..673dff5 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign/00004.png differ diff --git a/tests_zemu/snapshots/s-blind_sign/00005.png b/tests_zemu/snapshots/s-blind_sign/00005.png new file mode 100644 index 0000000..d070539 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign/00005.png differ diff --git a/tests_zemu/snapshots/s-ft_test/00001.png b/tests_zemu/snapshots/s-blind_sign/00006.png similarity index 100% rename from tests_zemu/snapshots/s-ft_test/00001.png rename to tests_zemu/snapshots/s-blind_sign/00006.png diff --git a/tests_zemu/snapshots/s-blind_sign2/00000.png b/tests_zemu/snapshots/s-blind_sign2/00000.png new file mode 100644 index 0000000..24426ad Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign2/00000.png differ diff --git a/tests_zemu/snapshots/s-blind_sign2/00001.png b/tests_zemu/snapshots/s-blind_sign2/00001.png new file mode 100644 index 0000000..c177343 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign2/00001.png differ diff --git a/tests_zemu/snapshots/s-blind_sign2/00002.png b/tests_zemu/snapshots/s-blind_sign2/00002.png new file mode 100644 index 0000000..dc50e53 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign2/00002.png differ diff --git a/tests_zemu/snapshots/s-blind_sign2/00003.png b/tests_zemu/snapshots/s-blind_sign2/00003.png new file mode 100644 index 0000000..cb00b00 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign2/00003.png differ diff --git a/tests_zemu/snapshots/s-blind_sign2/00004.png b/tests_zemu/snapshots/s-blind_sign2/00004.png new file mode 100644 index 0000000..60e3020 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign2/00004.png differ diff --git a/tests_zemu/snapshots/s-blind_sign2/00005.png b/tests_zemu/snapshots/s-blind_sign2/00005.png new file mode 100644 index 0000000..1039e85 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign2/00005.png differ diff --git a/tests_zemu/snapshots/s-blind_sign2/00006.png b/tests_zemu/snapshots/s-blind_sign2/00006.png new file mode 100644 index 0000000..006c26a Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign2/00006.png differ diff --git a/tests_zemu/snapshots/s-blind_sign3/00000.png b/tests_zemu/snapshots/s-blind_sign3/00000.png new file mode 100644 index 0000000..aea7417 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign3/00000.png differ diff --git a/tests_zemu/snapshots/s-blind_sign3/00001.png b/tests_zemu/snapshots/s-blind_sign3/00001.png new file mode 100644 index 0000000..5b3dca8 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign3/00001.png differ diff --git a/tests_zemu/snapshots/s-blind_sign3/00002.png b/tests_zemu/snapshots/s-blind_sign3/00002.png new file mode 100644 index 0000000..efd66d5 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign3/00002.png differ diff --git a/tests_zemu/snapshots/s-blind_sign3/00003.png b/tests_zemu/snapshots/s-blind_sign3/00003.png new file mode 100644 index 0000000..cb00b00 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign3/00003.png differ diff --git a/tests_zemu/snapshots/s-blind_sign3/00004.png b/tests_zemu/snapshots/s-blind_sign3/00004.png new file mode 100644 index 0000000..ef19512 Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign3/00004.png differ diff --git a/tests_zemu/snapshots/s-blind_sign3/00005.png b/tests_zemu/snapshots/s-blind_sign3/00005.png new file mode 100644 index 0000000..8b3832f Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign3/00005.png differ diff --git a/tests_zemu/snapshots/s-blind_sign3/00006.png b/tests_zemu/snapshots/s-blind_sign3/00006.png new file mode 100644 index 0000000..006c26a Binary files /dev/null and b/tests_zemu/snapshots/s-blind_sign3/00006.png differ diff --git a/tests_zemu/snapshots/s-ft_test/00000.png b/tests_zemu/snapshots/s-ft_test/00000.png deleted file mode 100644 index 0c4db56..0000000 Binary files a/tests_zemu/snapshots/s-ft_test/00000.png and /dev/null differ diff --git a/tests_zemu/snapshots/s-ft_test/00002.png b/tests_zemu/snapshots/s-ft_test/00002.png deleted file mode 100644 index f8089f4..0000000 Binary files a/tests_zemu/snapshots/s-ft_test/00002.png and /dev/null differ diff --git a/tests_zemu/snapshots/s-mainmenu/00004.png b/tests_zemu/snapshots/s-mainmenu/00004.png index fa8c857..87096df 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00004.png and b/tests_zemu/snapshots/s-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/s-mainmenu/00010.png b/tests_zemu/snapshots/s-mainmenu/00010.png index fa8c857..87096df 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00010.png and b/tests_zemu/snapshots/s-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00004.png b/tests_zemu/snapshots/sp-mainmenu/00004.png index a5f8360..ae17e04 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00004.png and b/tests_zemu/snapshots/sp-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00010.png b/tests_zemu/snapshots/sp-mainmenu/00010.png index a5f8360..ae17e04 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00010.png and b/tests_zemu/snapshots/sp-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/st-blind_sign/00000.png b/tests_zemu/snapshots/st-blind_sign/00000.png index 8d5b94a..330b744 100644 Binary files a/tests_zemu/snapshots/st-blind_sign/00000.png and b/tests_zemu/snapshots/st-blind_sign/00000.png differ diff --git a/tests_zemu/snapshots/st-blind_sign/00001.png b/tests_zemu/snapshots/st-blind_sign/00001.png index d1376e9..81d6f64 100644 Binary files a/tests_zemu/snapshots/st-blind_sign/00001.png and b/tests_zemu/snapshots/st-blind_sign/00001.png differ diff --git a/tests_zemu/snapshots/st-blind_sign/00002.png b/tests_zemu/snapshots/st-blind_sign/00002.png index 3d8b21d..1be0fe7 100644 Binary files a/tests_zemu/snapshots/st-blind_sign/00002.png and b/tests_zemu/snapshots/st-blind_sign/00002.png differ diff --git a/tests_zemu/snapshots/st-blind_sign/00003.png b/tests_zemu/snapshots/st-blind_sign/00003.png index 72e2863..6306494 100644 Binary files a/tests_zemu/snapshots/st-blind_sign/00003.png and b/tests_zemu/snapshots/st-blind_sign/00003.png differ diff --git a/tests_zemu/snapshots/st-blind_sign/00004.png b/tests_zemu/snapshots/st-blind_sign/00004.png index 59536c9..d42efca 100644 Binary files a/tests_zemu/snapshots/st-blind_sign/00004.png and b/tests_zemu/snapshots/st-blind_sign/00004.png differ diff --git a/tests_zemu/snapshots/st-blind_sign2/00000.png b/tests_zemu/snapshots/st-blind_sign2/00000.png index 8d5b94a..330b744 100644 Binary files a/tests_zemu/snapshots/st-blind_sign2/00000.png and b/tests_zemu/snapshots/st-blind_sign2/00000.png differ diff --git a/tests_zemu/snapshots/st-blind_sign2/00001.png b/tests_zemu/snapshots/st-blind_sign2/00001.png index 00e2359..08c9a0f 100644 Binary files a/tests_zemu/snapshots/st-blind_sign2/00001.png and b/tests_zemu/snapshots/st-blind_sign2/00001.png differ diff --git a/tests_zemu/snapshots/st-blind_sign2/00002.png b/tests_zemu/snapshots/st-blind_sign2/00002.png index 77d6630..481acf8 100644 Binary files a/tests_zemu/snapshots/st-blind_sign2/00002.png and b/tests_zemu/snapshots/st-blind_sign2/00002.png differ diff --git a/tests_zemu/snapshots/st-blind_sign2/00003.png b/tests_zemu/snapshots/st-blind_sign2/00003.png index 72e2863..6306494 100644 Binary files a/tests_zemu/snapshots/st-blind_sign2/00003.png and b/tests_zemu/snapshots/st-blind_sign2/00003.png differ diff --git a/tests_zemu/snapshots/st-blind_sign2/00004.png b/tests_zemu/snapshots/st-blind_sign2/00004.png index 59536c9..d42efca 100644 Binary files a/tests_zemu/snapshots/st-blind_sign2/00004.png and b/tests_zemu/snapshots/st-blind_sign2/00004.png differ diff --git a/tests_zemu/snapshots/st-blind_sign3/00000.png b/tests_zemu/snapshots/st-blind_sign3/00000.png index 8d5b94a..330b744 100644 Binary files a/tests_zemu/snapshots/st-blind_sign3/00000.png and b/tests_zemu/snapshots/st-blind_sign3/00000.png differ diff --git a/tests_zemu/snapshots/st-blind_sign3/00001.png b/tests_zemu/snapshots/st-blind_sign3/00001.png index ab2b514..f49b8dc 100644 Binary files a/tests_zemu/snapshots/st-blind_sign3/00001.png and b/tests_zemu/snapshots/st-blind_sign3/00001.png differ diff --git a/tests_zemu/snapshots/st-blind_sign3/00002.png b/tests_zemu/snapshots/st-blind_sign3/00002.png index e8762df..e02cd51 100644 Binary files a/tests_zemu/snapshots/st-blind_sign3/00002.png and b/tests_zemu/snapshots/st-blind_sign3/00002.png differ diff --git a/tests_zemu/snapshots/st-blind_sign3/00003.png b/tests_zemu/snapshots/st-blind_sign3/00003.png index 72e2863..6306494 100644 Binary files a/tests_zemu/snapshots/st-blind_sign3/00003.png and b/tests_zemu/snapshots/st-blind_sign3/00003.png differ diff --git a/tests_zemu/snapshots/st-blind_sign3/00004.png b/tests_zemu/snapshots/st-blind_sign3/00004.png index 59536c9..d42efca 100644 Binary files a/tests_zemu/snapshots/st-blind_sign3/00004.png and b/tests_zemu/snapshots/st-blind_sign3/00004.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00000.png b/tests_zemu/snapshots/st-mainmenu/00000.png index 59536c9..d42efca 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00000.png and b/tests_zemu/snapshots/st-mainmenu/00000.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00001.png b/tests_zemu/snapshots/st-mainmenu/00001.png index 67fba67..5f60b4d 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00001.png and b/tests_zemu/snapshots/st-mainmenu/00001.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00002.png b/tests_zemu/snapshots/st-mainmenu/00002.png index 31242c9..82a1ef4 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00002.png and b/tests_zemu/snapshots/st-mainmenu/00002.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00003.png b/tests_zemu/snapshots/st-mainmenu/00003.png index 25b99bc..5f60b4d 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00003.png and b/tests_zemu/snapshots/st-mainmenu/00003.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00004.png b/tests_zemu/snapshots/st-mainmenu/00004.png index 31242c9..f16eedd 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00004.png and b/tests_zemu/snapshots/st-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00005.png b/tests_zemu/snapshots/st-mainmenu/00005.png index 59536c9..3dadf80 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00005.png and b/tests_zemu/snapshots/st-mainmenu/00005.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00006.png b/tests_zemu/snapshots/st-mainmenu/00006.png new file mode 100644 index 0000000..d42efca Binary files /dev/null and b/tests_zemu/snapshots/st-mainmenu/00006.png differ diff --git a/tests_zemu/snapshots/st-show_address/00000.png b/tests_zemu/snapshots/st-show_address/00000.png index 0759918..ab57d9c 100644 Binary files a/tests_zemu/snapshots/st-show_address/00000.png and b/tests_zemu/snapshots/st-show_address/00000.png differ diff --git a/tests_zemu/snapshots/st-show_address/00001.png b/tests_zemu/snapshots/st-show_address/00001.png index 7b13043..cb8fbca 100644 Binary files a/tests_zemu/snapshots/st-show_address/00001.png and b/tests_zemu/snapshots/st-show_address/00001.png differ diff --git a/tests_zemu/snapshots/st-show_address/00002.png b/tests_zemu/snapshots/st-show_address/00002.png index 97f0747..58a343e 100644 Binary files a/tests_zemu/snapshots/st-show_address/00002.png and b/tests_zemu/snapshots/st-show_address/00002.png differ diff --git a/tests_zemu/snapshots/st-show_address/00003.png b/tests_zemu/snapshots/st-show_address/00003.png index 59536c9..d42efca 100644 Binary files a/tests_zemu/snapshots/st-show_address/00003.png and b/tests_zemu/snapshots/st-show_address/00003.png differ diff --git a/tests_zemu/snapshots/st-show_address_reject/00000.png b/tests_zemu/snapshots/st-show_address_reject/00000.png index 0759918..ab57d9c 100644 Binary files a/tests_zemu/snapshots/st-show_address_reject/00000.png and b/tests_zemu/snapshots/st-show_address_reject/00000.png differ diff --git a/tests_zemu/snapshots/st-show_address_reject/00001.png b/tests_zemu/snapshots/st-show_address_reject/00001.png index 7b13043..cb8fbca 100644 Binary files a/tests_zemu/snapshots/st-show_address_reject/00001.png and b/tests_zemu/snapshots/st-show_address_reject/00001.png differ diff --git a/tests_zemu/snapshots/st-show_address_reject/00002.png b/tests_zemu/snapshots/st-show_address_reject/00002.png index 8c5f472..94c91bb 100644 Binary files a/tests_zemu/snapshots/st-show_address_reject/00002.png and b/tests_zemu/snapshots/st-show_address_reject/00002.png differ diff --git a/tests_zemu/snapshots/st-show_address_reject/00003.png b/tests_zemu/snapshots/st-show_address_reject/00003.png index 59536c9..d42efca 100644 Binary files a/tests_zemu/snapshots/st-show_address_reject/00003.png and b/tests_zemu/snapshots/st-show_address_reject/00003.png differ diff --git a/tests_zemu/snapshots/st-show_viewkey/00000.png b/tests_zemu/snapshots/st-show_viewkey/00000.png index 8d5b94a..330b744 100644 Binary files a/tests_zemu/snapshots/st-show_viewkey/00000.png and b/tests_zemu/snapshots/st-show_viewkey/00000.png differ diff --git a/tests_zemu/snapshots/st-show_viewkey/00001.png b/tests_zemu/snapshots/st-show_viewkey/00001.png index 071a8f4..928c579 100644 Binary files a/tests_zemu/snapshots/st-show_viewkey/00001.png and b/tests_zemu/snapshots/st-show_viewkey/00001.png differ diff --git a/tests_zemu/snapshots/st-show_viewkey/00002.png b/tests_zemu/snapshots/st-show_viewkey/00002.png index dddd075..e2e9660 100644 Binary files a/tests_zemu/snapshots/st-show_viewkey/00002.png and b/tests_zemu/snapshots/st-show_viewkey/00002.png differ diff --git a/tests_zemu/snapshots/st-show_viewkey/00003.png b/tests_zemu/snapshots/st-show_viewkey/00003.png index 276d214..6306494 100644 Binary files a/tests_zemu/snapshots/st-show_viewkey/00003.png and b/tests_zemu/snapshots/st-show_viewkey/00003.png differ diff --git a/tests_zemu/snapshots/st-show_viewkey/00004.png b/tests_zemu/snapshots/st-show_viewkey/00004.png index 5c5e439..d42efca 100644 Binary files a/tests_zemu/snapshots/st-show_viewkey/00004.png and b/tests_zemu/snapshots/st-show_viewkey/00004.png differ diff --git a/tests_zemu/snapshots/st-show_viewkey/00005.png b/tests_zemu/snapshots/st-show_viewkey/00005.png deleted file mode 100644 index 59536c9..0000000 Binary files a/tests_zemu/snapshots/st-show_viewkey/00005.png and /dev/null differ diff --git a/tests_zemu/snapshots/x-mainmenu/00004.png b/tests_zemu/snapshots/x-mainmenu/00004.png index a5f8360..ae17e04 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00004.png and b/tests_zemu/snapshots/x-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/x-mainmenu/00010.png b/tests_zemu/snapshots/x-mainmenu/00010.png index a5f8360..ae17e04 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00010.png and b/tests_zemu/snapshots/x-mainmenu/00010.png differ diff --git a/tests_zemu/tests/common.ts b/tests_zemu/tests/common.ts index 18195c0..60e577d 100644 --- a/tests_zemu/tests/common.ts +++ b/tests_zemu/tests/common.ts @@ -10,7 +10,9 @@ const APP_PATH_SP = resolve('../app/output/app_s2.elf') const APP_PATH_ST = resolve('../app/output/app_stax.elf') export const models: IDeviceModel[] = [ - // { name: 'nanos', prefix: 'S', path: APP_PATH_S }, + // TODO investigate why nano s is disabled + // On blind signing tests, it fails with "19:59:04.695:seproxyhal: received tag SE_POWER_OFF, exiting" when approving the tx (signing) + //{ name: 'nanos', prefix: 'S', path: APP_PATH_S }, { name: 'nanox', prefix: 'X', path: APP_PATH_X }, { name: 'nanosp', prefix: 'SP', path: APP_PATH_SP }, { name: 'stax', prefix: 'ST', path: APP_PATH_ST },