diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eb7ae6..7a94a2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.1] - 2026-03-23 + +### Added + +- Apex P poring (Ledger Nano Gen 5) +- Derivation Path Hardening: + - New master key fingerprint syscall use, `HAVE_APPLICATION_FLAG_DERIVE_MASTER` is removed + - BIP-32 derivation paths is reinforced using wildcard syntax (`m/*/`) + ## [0.1.0] - 2025-03-13 ### Added diff --git a/Makefile b/Makefile index 21da376..86f4c45 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ # Application version APPVERSION_M = 0 APPVERSION_N = 1 -APPVERSION_P = 0 +APPVERSION_P = 1 APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" APPDEVELOPPER="Ledger" @@ -63,5 +63,6 @@ ICON_NANOX = icons/nanox_app_core.gif ICON_NANOSP = icons/nanox_app_core.gif ICON_STAX = icons/stax_app_core.gif ICON_FLEX = icons/flex_app_core.gif +ICON_APEX_P = icons/apex_p_app_core.png include bitcoin_app_base/Makefile diff --git a/bitcoin_app_base b/bitcoin_app_base index 9ac4d34..3831f1b 160000 --- a/bitcoin_app_base +++ b/bitcoin_app_base @@ -1 +1 @@ -Subproject commit 9ac4d34dd43d0a0c393f53bf56cfe946c1e00ff0 +Subproject commit 3831f1b15073477c73ffc27c86b53a7b48d4db28 diff --git a/glyphs/App_48px.png b/glyphs/App_48px.png new file mode 100644 index 0000000..8848bd1 Binary files /dev/null and b/glyphs/App_48px.png differ diff --git a/icons/apex_p_app_core.png b/icons/apex_p_app_core.png new file mode 100644 index 0000000..8454c89 Binary files /dev/null and b/icons/apex_p_app_core.png differ diff --git a/ledger_app.toml b/ledger_app.toml index 927ce17..d2cedc2 100644 --- a/ledger_app.toml +++ b/ledger_app.toml @@ -1,7 +1,7 @@ [app] build_directory = "./" sdk = "C" -devices = ["nanox", "nanos+", "flex", "stax"] +devices = ["nanox", "nanos+", "flex", "stax", "apex_p"] [tests] pytest_directory = "./tests/" diff --git a/src/core.c b/src/core.c index 02a6565..4377c99 100644 --- a/src/core.c +++ b/src/core.c @@ -3,25 +3,28 @@ #include #include +/* Local headers */ #include "core.h" #include "debug.h" -#include "../bitcoin_app_base/src/crypto.h" -#include "../bitcoin_app_base/src/common/script.h" -#include "../bitcoin_app_base/src/common/read.h" -#include "../bitcoin_app_base/src/common/write.h" - +/* SDK headers */ #include "cx.h" #include "ledger_assert.h" +#include "read.h" +#include "write.h" + +/* Baseapp branch headers */ +#include "../bitcoin_app_base/src/crypto.h" +#include "../bitcoin_app_base/src/common/script.h" #define EXPECTED_PAYLOAD_LEN \ 80 // SAT+(4)+ VERSION(1) + CHAIN_ID(2) + DELEGATOR(20) + VALIDATOR(20) + FEE(1) + REDEEM(32) #define SUPPORTED_VERSION 1 -static bool get_core_compressed_pubkey(const uint32_t bip32_path[], - uint8_t bip32_path_len, - uint8_t out_pubkey[static 33]) { +static cx_err_t get_core_compressed_pubkey(const uint32_t bip32_path[], + uint8_t bip32_path_len, + uint8_t out_pubkey[static 33]) { uint8_t chaincode[32]; return crypto_get_compressed_pubkey_at_path(bip32_path, bip32_path_len, out_pubkey, chaincode); @@ -31,7 +34,7 @@ static bool get_core_pubkey_hash160(const uint32_t bip32_path[], uint8_t bip32_path_len, uint8_t out_hash160[static 20]) { uint8_t pubkey[33]; - if (!get_core_compressed_pubkey(bip32_path, bip32_path_len, pubkey)) { + if (CX_OK != get_core_compressed_pubkey(bip32_path, bip32_path_len, pubkey)) { return false; } crypto_hash160(pubkey, 33, out_hash160); @@ -201,4 +204,4 @@ void format_address(const uint8_t *buffer, size_t buffer_len, char *out, size_t out_len -= 2; buffer_to_hex(buffer, buffer_len, out, out_len); -} \ No newline at end of file +} diff --git a/tests/snapshots/apex_p/test_sign_restake_tx_0_0/00000.png b/tests/snapshots/apex_p/test_sign_restake_tx_0_0/00000.png new file mode 100644 index 0000000..0d7a3e9 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_restake_tx_0_0/00000.png differ diff --git a/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00000.png b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00000.png new file mode 100644 index 0000000..0a8ca19 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00000.png differ diff --git a/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00001.png b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00001.png new file mode 100644 index 0000000..aacba3f Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00001.png differ diff --git a/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00002.png b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00002.png new file mode 100644 index 0000000..5074029 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00002.png differ diff --git a/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00003.png b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00003.png new file mode 100644 index 0000000..934e20d Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_restake_tx_0_1/00003.png differ diff --git a/tests/snapshots/apex_p/test_sign_stake_tx_0_0/00000.png b/tests/snapshots/apex_p/test_sign_stake_tx_0_0/00000.png new file mode 100644 index 0000000..0d7a3e9 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_stake_tx_0_0/00000.png differ diff --git a/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00000.png b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00000.png new file mode 100644 index 0000000..0a8ca19 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00000.png differ diff --git a/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00001.png b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00001.png new file mode 100644 index 0000000..cd513cd Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00001.png differ diff --git a/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00002.png b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00002.png new file mode 100644 index 0000000..5074029 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00002.png differ diff --git a/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00003.png b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00003.png new file mode 100644 index 0000000..934e20d Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_stake_tx_0_1/00003.png differ diff --git a/tests/snapshots/apex_p/test_sign_unstake_tx_0_0/00000.png b/tests/snapshots/apex_p/test_sign_unstake_tx_0_0/00000.png new file mode 100644 index 0000000..50d3a2c Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_unstake_tx_0_0/00000.png differ diff --git a/tests/snapshots/apex_p/test_sign_unstake_tx_0_1/00000.png b/tests/snapshots/apex_p/test_sign_unstake_tx_0_1/00000.png new file mode 100644 index 0000000..6b8bff5 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_unstake_tx_0_1/00000.png differ diff --git a/tests/snapshots/apex_p/test_sign_unstake_tx_0_1/00001.png b/tests/snapshots/apex_p/test_sign_unstake_tx_0_1/00001.png new file mode 100644 index 0000000..61c2046 Binary files /dev/null and b/tests/snapshots/apex_p/test_sign_unstake_tx_0_1/00001.png differ diff --git a/tests/snapshots/flex/test_sign_restake_tx_0_0/00000.png b/tests/snapshots/flex/test_sign_restake_tx_0_0/00000.png index 77bef68..689a1c0 100644 Binary files a/tests/snapshots/flex/test_sign_restake_tx_0_0/00000.png and b/tests/snapshots/flex/test_sign_restake_tx_0_0/00000.png differ diff --git a/tests/snapshots/flex/test_sign_restake_tx_0_1/00000.png b/tests/snapshots/flex/test_sign_restake_tx_0_1/00000.png index 5365b9b..7767c35 100644 Binary files a/tests/snapshots/flex/test_sign_restake_tx_0_1/00000.png and b/tests/snapshots/flex/test_sign_restake_tx_0_1/00000.png differ diff --git a/tests/snapshots/flex/test_sign_restake_tx_0_1/00001.png b/tests/snapshots/flex/test_sign_restake_tx_0_1/00001.png index 8147ff2..b31dd35 100644 Binary files a/tests/snapshots/flex/test_sign_restake_tx_0_1/00001.png and b/tests/snapshots/flex/test_sign_restake_tx_0_1/00001.png differ diff --git a/tests/snapshots/flex/test_sign_restake_tx_0_1/00002.png b/tests/snapshots/flex/test_sign_restake_tx_0_1/00002.png index bfa1a97..bca8bb9 100644 Binary files a/tests/snapshots/flex/test_sign_restake_tx_0_1/00002.png and b/tests/snapshots/flex/test_sign_restake_tx_0_1/00002.png differ diff --git a/tests/snapshots/flex/test_sign_restake_tx_0_1/00003.png b/tests/snapshots/flex/test_sign_restake_tx_0_1/00003.png index 38de651..0f764e2 100644 Binary files a/tests/snapshots/flex/test_sign_restake_tx_0_1/00003.png and b/tests/snapshots/flex/test_sign_restake_tx_0_1/00003.png differ diff --git a/tests/snapshots/flex/test_sign_stake_tx_0_0/00000.png b/tests/snapshots/flex/test_sign_stake_tx_0_0/00000.png index 77bef68..689a1c0 100644 Binary files a/tests/snapshots/flex/test_sign_stake_tx_0_0/00000.png and b/tests/snapshots/flex/test_sign_stake_tx_0_0/00000.png differ diff --git a/tests/snapshots/flex/test_sign_stake_tx_0_1/00000.png b/tests/snapshots/flex/test_sign_stake_tx_0_1/00000.png index 5365b9b..7767c35 100644 Binary files a/tests/snapshots/flex/test_sign_stake_tx_0_1/00000.png and b/tests/snapshots/flex/test_sign_stake_tx_0_1/00000.png differ diff --git a/tests/snapshots/flex/test_sign_stake_tx_0_1/00001.png b/tests/snapshots/flex/test_sign_stake_tx_0_1/00001.png index 959fd03..0846d94 100644 Binary files a/tests/snapshots/flex/test_sign_stake_tx_0_1/00001.png and b/tests/snapshots/flex/test_sign_stake_tx_0_1/00001.png differ diff --git a/tests/snapshots/flex/test_sign_stake_tx_0_1/00002.png b/tests/snapshots/flex/test_sign_stake_tx_0_1/00002.png index bfa1a97..bca8bb9 100644 Binary files a/tests/snapshots/flex/test_sign_stake_tx_0_1/00002.png and b/tests/snapshots/flex/test_sign_stake_tx_0_1/00002.png differ diff --git a/tests/snapshots/flex/test_sign_stake_tx_0_1/00003.png b/tests/snapshots/flex/test_sign_stake_tx_0_1/00003.png index 38de651..0f764e2 100644 Binary files a/tests/snapshots/flex/test_sign_stake_tx_0_1/00003.png and b/tests/snapshots/flex/test_sign_stake_tx_0_1/00003.png differ diff --git a/tests/snapshots/flex/test_sign_unstake_tx_0_0/00000.png b/tests/snapshots/flex/test_sign_unstake_tx_0_0/00000.png index db777f5..b0de43d 100644 Binary files a/tests/snapshots/flex/test_sign_unstake_tx_0_0/00000.png and b/tests/snapshots/flex/test_sign_unstake_tx_0_0/00000.png differ diff --git a/tests/snapshots/flex/test_sign_unstake_tx_0_1/00000.png b/tests/snapshots/flex/test_sign_unstake_tx_0_1/00000.png index 8abc217..7ece8d5 100644 Binary files a/tests/snapshots/flex/test_sign_unstake_tx_0_1/00000.png and b/tests/snapshots/flex/test_sign_unstake_tx_0_1/00000.png differ diff --git a/tests/snapshots/flex/test_sign_unstake_tx_0_1/00001.png b/tests/snapshots/flex/test_sign_unstake_tx_0_1/00001.png index 3e45251..8a91d55 100644 Binary files a/tests/snapshots/flex/test_sign_unstake_tx_0_1/00001.png and b/tests/snapshots/flex/test_sign_unstake_tx_0_1/00001.png differ diff --git a/tests/snapshots/stax/test_sign_restake_tx_0_1/00003.png b/tests/snapshots/stax/test_sign_restake_tx_0_1/00003.png index ae04fbc..4dad351 100644 Binary files a/tests/snapshots/stax/test_sign_restake_tx_0_1/00003.png and b/tests/snapshots/stax/test_sign_restake_tx_0_1/00003.png differ diff --git a/tests/snapshots/stax/test_sign_stake_tx_0_1/00003.png b/tests/snapshots/stax/test_sign_stake_tx_0_1/00003.png index ae04fbc..4dad351 100644 Binary files a/tests/snapshots/stax/test_sign_stake_tx_0_1/00003.png and b/tests/snapshots/stax/test_sign_stake_tx_0_1/00003.png differ diff --git a/tests/snapshots/stax/test_sign_unstake_tx_0_1/00001.png b/tests/snapshots/stax/test_sign_unstake_tx_0_1/00001.png index c9e72db..1c463ce 100644 Binary files a/tests/snapshots/stax/test_sign_unstake_tx_0_1/00001.png and b/tests/snapshots/stax/test_sign_unstake_tx_0_1/00001.png differ