Skip to content

Commit

Permalink
Merge pull request #1 from LedgerHQ/backport_changes
Browse files Browse the repository at this point in the history
Backport changes
  • Loading branch information
sgliner-ledger authored Jun 22, 2023
2 parents 44450dd + ba324e7 commit d5f0ac7
Show file tree
Hide file tree
Showing 217 changed files with 1,503 additions and 804 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
name: CI

on: [push, pull_request]
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
- develop


jobs:
job_build:
name: Compilation
strategy:
matrix:
include:
- model: nanos
SDK: "$NANOS_SDK"
- model: nanox
SDK: "$NANOX_SDK"
- model: nanosp
SDK: "$NANOSP_SDK"
- model: stax
SDK: "$STAX_SDK"

runs-on: ubuntu-latest

container:
Expand All @@ -26,6 +47,14 @@ jobs:

job_test:
name: Tests
strategy:
matrix:
include:
- model: nanos
- model: nanox
- model: nanosp
- model: stax

needs: job_build
runs-on: ubuntu-latest

Expand Down Expand Up @@ -58,4 +87,5 @@ jobs:

- name: Run tests
run: |
cd tests && pip install -r requirements.txt && SPECULOS=/speculos/speculos.py pytest
cd tests && pip install -r requirements.txt && SPECULOS=/speculos/speculos.py pytest --model=${{ matrix.model }}
23 changes: 23 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Ensure compliance with Ledger guidelines

# This workflow is mandatory in all applications
# It calls a reusable workflow guidelines_enforcer developed by Ledger's internal developer team.
# The successful completion of the reusable workflow is a mandatory step for an app to be available on the Ledger
# application store.
#
# More information on the guidelines can be found in the repository:
# LedgerHQ/ledger-app-workflows/

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:

jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ bin
debug
dep
obj
src/glyphs.c
src/glyphs.h
*.pyc
.idea
.vscode
build
scan-build/
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.6.6 - 2022-05-11
## [2.1.0](https://github.com/ledgerhq/app-bitcoin/compare/1.6.1...1.6.2) - 2022-09-15

Rename the "bitcoin" target to "bitcoin_legacy".

## [1.6.6] - 2022-05-11

Technical release for the deployment of the legacy app.

Expand Down
67 changes: 38 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,13 @@ $(error Environment variable BOLOS_SDK is not set)
endif
include $(BOLOS_SDK)/Makefile.defines

APP_PATH = ""
# All but bitcoin app use dependency onto the bitcoin app/lib
DEFINES_LIB = USE_LIB_BITCOIN
APP_LOAD_PARAMS= --curve secp256k1 $(COMMON_LOAD_PARAMS)

APPVERSION_M=2
APPVERSION_N=1
APPVERSION_P=3
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

APP_LOAD_FLAGS=--appFlags 0xa50 --dep Bitcoin:$(APPVERSION)

# simplify for tests
ifndef COIN
COIN=zcash
Expand All @@ -43,20 +38,27 @@ DEFINES += BIP44_COIN_TYPE=133 BIP44_COIN_TYPE_2=133 COIN_P2PKH_VERSION=7352 C
# Switch to NU5 over Canopy
DEFINES += COIN_CONSENSUS_BRANCH_ID=0XC2D6D0B4
APPNAME ="Zcash"
APP_LOAD_PARAMS += --path $(APP_PATH)
DEFINES_LIB=# we're not using the lib :)
APP_LOAD_FLAGS=--appFlags 0xa50
APP_LOAD_PARAMS += --path "44'/133'"

ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX))
APP_LOAD_PARAMS += --appFlags 0x200 # APPLICATION_FLAG_BOLOS_SETTINGS
else
APP_LOAD_PARAMS += --appFlags 0x000
endif
else
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(error Only Zcash is supported)
endif
endif

APP_LOAD_PARAMS += $(APP_LOAD_FLAGS)
DEFINES += $(DEFINES_LIB)

ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME=icons/nanos_app_$(COIN).gif
else ifeq ($(TARGET_NAME),TARGET_STAX)
ICONNAME=icons/stax_app_$(COIN).gif
DEFINES += COIN_ICON=C_$(COIN)_64px
DEFINES += COIN_ICON_BITMAP=C_$(COIN)_64px_bitmap
else
ICONNAME=icons/nanox_app_$(COIN).gif
endif
Expand All @@ -71,15 +73,9 @@ all: default
############

DEFINES += OS_IO_SEPROXYHAL IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_BAGL HAVE_SPRINTF HAVE_SNPRINTF_FORMAT_U
DEFINES += HAVE_SPRINTF HAVE_SNPRINTF_FORMAT_U
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 HAVE_USB_APDU
DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_M) LEDGER_MINOR_VERSION=$(APPVERSION_N) LEDGER_PATCH_VERSION=$(APPVERSION_P) TCS_LOADER_PATCH_VERSION=0
DEFINES += HAVE_UX_FLOW
# U2F
DEFINES += HAVE_U2F HAVE_IO_U2F
DEFINES += U2F_PROXY_MAGIC=\"BTC\"
DEFINES += USB_SEGMENT_SIZE=64
DEFINES += BLE_SEGMENT_SIZE=32 #max MTU, min 20

#WEBUSB_URL = www.ledgerwallet.com
#DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=$(shell echo -n $(WEBUSB_URL) | wc -c) WEBUSB_URL=$(shell echo -n $(WEBUSB_URL) | sed -e "s/./\\\'\0\\\',/g")
Expand All @@ -90,24 +86,31 @@ DEFINES += APPVERSION=\"$(APPVERSION)\"

DEFINES += BLAKE_SDK

ifeq ($(TARGET_NAME),TARGET_NANOX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX))
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000
DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE
endif

ifeq ($(TARGET_NAME),TARGET_STAX)
DEFINES += NBGL_QRCODE
else
DEFINES += HAVE_BAGL HAVE_UX_FLOW
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_GLO096
DEFINES += BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
endif
endif

ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_WALLET_ID_SDK
else
DEFINES += HAVE_GLO096
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
endif

# Enabling debug PRINTF
DEBUG:=0
DEBUG ?= 0
ifneq ($(DEBUG),0)
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_PRINTF PRINTF=screen_printf
Expand Down Expand Up @@ -150,11 +153,17 @@ LDLIBS += -lm -lgcc -lc
include $(BOLOS_SDK)/Makefile.glyphs

### variables processed by the common makefile.rules of the SDK to grab source files and include dirs
APP_SOURCE_PATH += src
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_u2f qrcode
SDK_SOURCE_PATH += lib_ux
APP_SOURCE_PATH += src

APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/format.c
INCLUDES_PATH += ${BOLOS_SDK}

SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_u2f
ifneq ($(TARGET_NAME),TARGET_STAX)
SDK_SOURCE_PATH += lib_ux
endif

ifeq ($(TARGET_NAME),TARGET_NANOX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX))
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
endif

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ledger-app-btc
Bitcoin wallet application for Ledger Nano S and Nano X, up to version 1.6.5.

This is currently only used in order to support and maintain altcoins cloned from Bitcoin. The last stable version of the app as it was used for Bitcoin is kept in the branch [legacy-1.6.6](https://github.com/LedgerHQ/app-bitcoin/tree/legacy-1.6.6) for future reference.

Versions starting from 2.0.0 are at https://github.com/LedgerHQ/app-bitcoin-new.

Ledger Blue is not maintained anymore, but the app can still be compiled for this target using the branch `blue-final-release`.
Expand Down
Binary file removed glyphs/blue_badge_bitcoin.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_bitcoin_cash.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_bitcoin_gold.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_bitcoin_testnet.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_dash.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_digibyte.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_dogecoin.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_komodo.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_lbry.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_litecoin.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_peercoin.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_pivx.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_qtum.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_ravencoin.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_resistance.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_stealth.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_stratis.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_transaction.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_vertcoin.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_viacoin.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_warning.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_xrhodium.gif
Binary file not shown.
Binary file removed glyphs/blue_badge_zcash.gif
Binary file not shown.
Binary file removed glyphs/blue_icon_toggle_reset.gif
Binary file not shown.
Binary file removed glyphs/blue_icon_toggle_set.gif
Binary file not shown.
Binary file removed glyphs/icon_back.gif
Diff not rendered.
Binary file removed glyphs/icon_certificate.gif
Diff not rendered.
Binary file removed glyphs/icon_coggle.gif
Diff not rendered.
Binary file removed glyphs/icon_crossmark.gif
Diff not rendered.
Binary file removed glyphs/icon_dashboard.gif
Diff not rendered.
Binary file removed glyphs/icon_dashboard_x.gif
Diff not rendered.
Binary file removed glyphs/icon_down.gif
Diff not rendered.
Binary file removed glyphs/icon_eye.gif
Diff not rendered.
Binary file removed glyphs/icon_left.gif
Diff not rendered.
Binary file removed glyphs/icon_right.gif
Diff not rendered.
Binary file removed glyphs/icon_up.gif
Diff not rendered.
Binary file removed glyphs/icon_validate_14.gif
Diff not rendered.
Binary file removed glyphs/icon_warning.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_bitcoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_bitcoin_cash.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_bitcoin_gold.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_bitcoin_private.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_bitcoin_testnet.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_dash.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_digibyte.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_dogecoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_komodo.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_lbry.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_litecoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_nix.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_peercoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_pivx.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_qtum.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_ravencoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_resistance.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_stealth.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_stratis.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_vertcoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_viacoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_xrhodium.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_xsn.gif
Diff not rendered.
Binary file modified glyphs/nanos_badge_zcash.gif
Binary file removed glyphs/nanos_badge_zcoin.gif
Diff not rendered.
Binary file removed glyphs/nanos_badge_zencash.gif
Diff not rendered.
Binary file removed glyphs/nanos_icon_back.gif
Diff not rendered.
Binary file removed glyphs/nanos_icon_dashboard.gif
Diff not rendered.
Binary file added glyphs/zcash.gif
Binary file added glyphs/zcash_64px.gif
Binary file removed icons/bitcoin.png
Diff not rendered.
Binary file removed icons/bitcoin_cash.png
Diff not rendered.
Binary file removed icons/bitcoin_gold.png
Diff not rendered.
Binary file removed icons/bitcoin_private.png
Diff not rendered.
Binary file removed icons/bitcoin_testnet.png
Diff not rendered.
Binary file removed icons/blue_app_bitcoin.gif
Diff not rendered.
Binary file removed icons/blue_app_bitcoin_cash.gif
Diff not rendered.
Binary file removed icons/blue_app_bitcoin_gold.gif
Diff not rendered.
Binary file removed icons/blue_app_bitcoin_private.gif
Diff not rendered.
Binary file removed icons/blue_app_bitcoin_testnet.gif
Diff not rendered.
Binary file removed icons/blue_app_dash.gif
Diff not rendered.
Binary file removed icons/blue_app_digibyte.gif
Diff not rendered.
Binary file removed icons/blue_app_dogecoin.gif
Diff not rendered.
Binary file removed icons/blue_app_firo.gif
Diff not rendered.
Binary file removed icons/blue_app_gamecredits.gif
Diff not rendered.
Binary file removed icons/blue_app_horizen.gif
Diff not rendered.
Binary file removed icons/blue_app_komodo.gif
Diff not rendered.
Binary file removed icons/blue_app_lbry.gif
Diff not rendered.
Binary file removed icons/blue_app_litecoin.gif
Diff not rendered.
Binary file removed icons/blue_app_nix.gif
Diff not rendered.
Binary file removed icons/blue_app_peercoin.gif
Diff not rendered.
Binary file removed icons/blue_app_pivx.gif
Diff not rendered.
Binary file removed icons/blue_app_qtum.gif
Diff not rendered.
Binary file removed icons/blue_app_ravencoin.gif
Diff not rendered.
Binary file removed icons/blue_app_resistance.gif
Diff not rendered.
Binary file removed icons/blue_app_stealth.gif
Diff not rendered.
Binary file removed icons/blue_app_stratis.gif
Diff not rendered.
Binary file removed icons/blue_app_vertcoin.gif
Diff not rendered.
Binary file removed icons/blue_app_viacoin.gif
Diff not rendered.
Binary file removed icons/blue_app_xrhodium.gif
Diff not rendered.
Binary file removed icons/blue_app_xsn.gif
Diff not rendered.
Binary file removed icons/blue_app_zcash.gif
Diff not rendered.
Binary file removed icons/blue_app_zclassic.gif
Diff not rendered.
Binary file removed icons/dash.png
Diff not rendered.
Binary file removed icons/digibyte.png
Diff not rendered.
Binary file removed icons/dogecoin.png
Diff not rendered.
Binary file removed icons/firo.png
Diff not rendered.
Binary file removed icons/gamecredits.png
Diff not rendered.
Binary file removed icons/horizen.png
Diff not rendered.
Binary file removed icons/komodo.png
Diff not rendered.
Binary file removed icons/lbry.png
Diff not rendered.
Binary file removed icons/litecoin.png
Diff not rendered.
Binary file removed icons/nanos_app_bitcoin.gif
Diff not rendered.
Binary file removed icons/nanos_app_bitcoin_cash.gif
Diff not rendered.
Binary file removed icons/nanos_app_bitcoin_gold.gif
Diff not rendered.
Binary file removed icons/nanos_app_bitcoin_private.gif
Diff not rendered.
Binary file removed icons/nanos_app_bitcoin_testnet.gif
Diff not rendered.
Binary file removed icons/nanos_app_dash.gif
Diff not rendered.
Binary file removed icons/nanos_app_digibyte.gif
Diff not rendered.
Binary file removed icons/nanos_app_dogecoin.gif
Diff not rendered.
Binary file removed icons/nanos_app_firo.gif
Diff not rendered.
Binary file removed icons/nanos_app_gamecredits.gif
Diff not rendered.
Binary file removed icons/nanos_app_horizen.gif
Diff not rendered.
Binary file removed icons/nanos_app_hydra.gif
Diff not rendered.
Binary file removed icons/nanos_app_hydra_testnet.gif
Diff not rendered.
Binary file removed icons/nanos_app_komodo.gif
Diff not rendered.
Binary file removed icons/nanos_app_lbry.gif
Diff not rendered.
Binary file removed icons/nanos_app_litecoin.gif
Diff not rendered.
Binary file removed icons/nanos_app_nix.gif
Diff not rendered.
Binary file removed icons/nanos_app_peercoin.gif
Diff not rendered.
Binary file removed icons/nanos_app_pivx.gif
Diff not rendered.
Binary file removed icons/nanos_app_qtum.gif
Diff not rendered.
Binary file removed icons/nanos_app_ravencoin.gif
Diff not rendered.
Binary file removed icons/nanos_app_resistance.gif
Diff not rendered.
Binary file removed icons/nanos_app_stealth.gif
Diff not rendered.
Binary file removed icons/nanos_app_stratis.gif
Diff not rendered.
Binary file removed icons/nanos_app_vertcoin.gif
Diff not rendered.
Binary file removed icons/nanos_app_viacoin.gif
Diff not rendered.
Binary file removed icons/nanos_app_xrhodium.gif
Diff not rendered.
Binary file removed icons/nanos_app_xsn.gif
Diff not rendered.
Binary file modified icons/nanos_app_zcash.gif
Binary file removed icons/nanos_app_zclassic.gif
Diff not rendered.
Binary file removed icons/nanox_app_bitcoin.gif
Diff not rendered.
Binary file removed icons/nanox_app_bitcoin_cash.gif
Diff not rendered.
Binary file removed icons/nanox_app_bitcoin_gold.gif
Diff not rendered.
Binary file removed icons/nanox_app_bitcoin_private.gif
Diff not rendered.
Binary file removed icons/nanox_app_bitcoin_testnet.gif
Diff not rendered.
Binary file removed icons/nanox_app_dash.gif
Diff not rendered.
Binary file removed icons/nanox_app_digibyte.gif
Diff not rendered.
Binary file removed icons/nanox_app_dogecoin.gif
Diff not rendered.
Binary file removed icons/nanox_app_firo.gif
Diff not rendered.
Binary file removed icons/nanox_app_gamecredits.gif
Diff not rendered.
Binary file removed icons/nanox_app_horizen.gif
Diff not rendered.
Binary file removed icons/nanox_app_hydra.gif
Diff not rendered.
Binary file removed icons/nanox_app_hydra_testnet.gif
Diff not rendered.
Binary file removed icons/nanox_app_komodo.gif
Diff not rendered.
Binary file removed icons/nanox_app_lbry.gif
Diff not rendered.
Binary file removed icons/nanox_app_litecoin.gif
Diff not rendered.
Binary file removed icons/nanox_app_nix.gif
Diff not rendered.
Binary file removed icons/nanox_app_peercoin.gif
Diff not rendered.
Binary file removed icons/nanox_app_pivx.gif
Diff not rendered.
Binary file removed icons/nanox_app_qtum.gif
Diff not rendered.
Binary file removed icons/nanox_app_ravencoin.gif
Diff not rendered.
Binary file removed icons/nanox_app_stealth.gif
Diff not rendered.
Binary file removed icons/nanox_app_stratis.gif
Diff not rendered.
Binary file removed icons/nanox_app_vertcoin.gif
Diff not rendered.
Binary file removed icons/nanox_app_viacoin.gif
Diff not rendered.
Binary file removed icons/nanox_app_xrhodium.gif
Diff not rendered.
Binary file removed icons/nanox_app_xsn.gif
Diff not rendered.
Binary file removed icons/nanox_app_zclassic.gif
Diff not rendered.
Binary file removed icons/nix.png
Diff not rendered.
Binary file removed icons/peercoin.png
Diff not rendered.
Binary file removed icons/pivx.png
Diff not rendered.
Binary file removed icons/qtum.png
Diff not rendered.
Binary file removed icons/ravencoin.png
Diff not rendered.
Binary file removed icons/resistance.png
Diff not rendered.
Binary file added icons/stax_app_zcash.gif
Binary file removed icons/stealth.png
Diff not rendered.
Binary file removed icons/stratis.png
Diff not rendered.
Binary file removed icons/vertcoin.png
Diff not rendered.
Binary file removed icons/viacoin.png
Diff not rendered.
Binary file removed icons/xrhodium.png
Diff not rendered.
Binary file removed icons/xsn.png
Diff not rendered.
Binary file removed icons/zclassic.png
Diff not rendered.
1 change: 1 addition & 0 deletions include/btchip.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "stdlib.h"
#include "stdbool.h"
#include "string.h"

#define L_DEBUG_NOPREFIX(x)

Expand Down
25 changes: 25 additions & 0 deletions include/btchip_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#include "cx.h"
#include "btchip_secure_value.h"
#include "btchip_filesystem_tx.h"
#ifdef HAVE_NBGL
#include "nbgl_types.h"
#endif // HAVE_NBGL


#define MAX_OUTPUT_TO_CHECK 100
#define MAX_COIN_ID 13
Expand Down Expand Up @@ -300,6 +304,27 @@ typedef enum btchip_coin_kind_e {
COIN_KIND_HYDRA
} btchip_coin_kind_t;

typedef struct btchip_altcoin_config_s {
unsigned short bip44_coin_type;
unsigned short bip44_coin_type2;
unsigned short p2pkh_version;
unsigned short p2sh_version;
unsigned char family;
#ifdef HAVE_NBGL
unsigned char img_raw[1024];
nbgl_icon_details_t img_nbgl;
#endif // HAVE_NBGL
char coinid[14]; // used coind id for message signature prefix
char name[16]; // for ux displays
char name_short[6]; // for unit in ux displays
char native_segwit_prefix_val[5];
const char* native_segwit_prefix; // null if no segwit prefix
unsigned int forkid;
unsigned int zcash_consensus_branch_id;
btchip_coin_kind_t kind;
unsigned int flags;
} btchip_altcoin_config_t;

void btchip_context_init(void);

#endif
6 changes: 3 additions & 3 deletions src/btchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void handleGetWalletId(volatile unsigned short *tx) {
// pubkey -> sha512
cx_hash_sha512(pub.W, sizeof(pub.W), t, sizeof(t));
// ! cookie !
os_memmove(G_io_apdu_buffer, t, 64);
memmove(G_io_apdu_buffer, t, 64);
btchip_context_D.sw = 0x9000;
*tx = 64;
}
Expand Down Expand Up @@ -145,7 +145,7 @@ void app_dispatch(void) {
}

void app_main(void) {
os_memset(G_io_apdu_buffer, 0, 255); // paranoia
memset(G_io_apdu_buffer, 0, 255); // paranoia

// Process the incoming APDUs

Expand All @@ -154,7 +154,7 @@ void app_main(void) {
btchip_context_D.io_flags = 0;
for (;;) {

// os_memset(G_io_apdu_buffer, 0, 255); // paranoia
// memset(G_io_apdu_buffer, 0, 255); // paranoia

if (btchip_context_D.called_from_swap && vars.swap_data.should_exit) {
btchip_context_D.io_flags |= IO_RETURN_AFTER_TX;
Expand Down
24 changes: 12 additions & 12 deletions src/btchip_apdu_get_coin_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ unsigned short btchip_apdu_get_coin_version() {
return BTCHIP_SW_CONDITIONS_OF_USE_NOT_SATISFIED;
}

G_io_apdu_buffer[offset++] = COIN_P2PKH_VERSION >> 8;
G_io_apdu_buffer[offset++] = COIN_P2PKH_VERSION;
G_io_apdu_buffer[offset++] = COIN_P2SH_VERSION >> 8;
G_io_apdu_buffer[offset++] = COIN_P2SH_VERSION;
uint16_t p2pkh_version = COIN_P2PKH_VERSION;
uint16_t p2sh_version = COIN_P2SH_VERSION;
G_io_apdu_buffer[offset++] = p2pkh_version >> 8;
G_io_apdu_buffer[offset++] = p2pkh_version;
G_io_apdu_buffer[offset++] = p2sh_version >> 8;
G_io_apdu_buffer[offset++] = p2sh_version;
G_io_apdu_buffer[offset++] = COIN_FAMILY;
G_io_apdu_buffer[offset++] = sizeof(COIN_COINID) - 1;
os_memmove(G_io_apdu_buffer + offset, COIN_COINID,
sizeof(COIN_COINID) - 1);
offset += sizeof(COIN_COINID) - 1;
G_io_apdu_buffer[offset++] = sizeof(COIN_COINID_SHORT) - 1;
os_memmove(G_io_apdu_buffer + offset, COIN_COINID_SHORT,
sizeof(COIN_COINID_SHORT) - 1);
offset += sizeof(COIN_COINID_SHORT) - 1;
G_io_apdu_buffer[offset++] = strlen(COIN_COINID);
memmove(G_io_apdu_buffer + offset, COIN_COINID, strlen(COIN_COINID));
offset += strlen(COIN_COINID);
G_io_apdu_buffer[offset++] = strlen(COIN_COINID_SHORT);
memmove(G_io_apdu_buffer + offset, COIN_COINID_SHORT, strlen(COIN_COINID_SHORT));
offset += strlen(COIN_COINID_SHORT);
btchip_context_D.outLength = offset;

return BTCHIP_SW_OK;
Expand Down
4 changes: 2 additions & 2 deletions src/btchip_apdu_get_trusted_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ unsigned short btchip_apdu_get_trusted_input() {
if (!btchip_context_D.NU5Transaction) {
cx_hash_sha256(G_io_apdu_buffer + TRUSTED_INPUT_SIZE, 32, G_io_apdu_buffer + 4, 32);
} else {
os_memmove(G_io_apdu_buffer + 4, G_io_apdu_buffer + TRUSTED_INPUT_SIZE, 32);
memmove(G_io_apdu_buffer + 4, G_io_apdu_buffer + TRUSTED_INPUT_SIZE, 32);
}

btchip_write_u32_le(G_io_apdu_buffer + 4 + 32,
btchip_context_D.transactionTargetInput);
os_memmove(G_io_apdu_buffer + 4 + 32 + 4,
memmove(G_io_apdu_buffer + 4 + 32 + 4,
btchip_context_D.transactionContext.transactionAmount, 8);

cx_hmac_sha256((uint8_t *)N_btchip.bkp.trustedinput_key,
Expand Down
Loading

0 comments on commit d5f0ac7

Please sign in to comment.