-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from LedgerHQ/develop
Merge develop into master following `B2CA-1642`
- Loading branch information
Showing
325 changed files
with
4,568 additions
and
5,172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
BasedOnStyle: Google | ||
IndentWidth: 4 | ||
--- | ||
Language: Cpp | ||
ColumnLimit: 100 | ||
PointerAlignment: Right | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveMacros: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
SortIncludes: false | ||
SpaceAfterCStyleCast: true | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortFunctionsOnASingleLine: None | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Checklist | ||
<!-- Put an `x` in each box when you have completed the items. --> | ||
- [ ] App update process has been followed <!-- See comment below --> | ||
- [ ] Target branch is `develop` <!-- unless you have a very good reason --> | ||
- [ ] Application version has been bumped <!-- required if your changes are to be deployed --> | ||
|
||
<!-- Make sure you followed the process described in https://developers.ledger.com/docs/embedded-app/maintenance/ before opening your Pull Request. | ||
Don't hesitate to contact us directly on Discord if you have any questions ! https://developers.ledger.com/discord --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Ragger functional tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
build_application: | ||
name: Build application | ||
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1 | ||
with: | ||
upload_app_binaries_artifact: "compiled_app_binaries" | ||
|
||
ragger_tests: | ||
name: Run ragger tests | ||
needs: build_application | ||
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1 | ||
with: | ||
download_app_binaries_artifact: "compiled_app_binaries" | ||
test_dir: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Coding style checks | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
check_linting: | ||
name: Check sources linting | ||
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1 | ||
with: | ||
source: './src' | ||
extensions: 'h,c' | ||
version: 11 | ||
|
||
tests_lint_check: | ||
name: Check tests linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone | ||
uses: actions/checkout@v3 | ||
- run: pip install yapf toml | ||
- name: Yapf source formatting | ||
run: | | ||
yapf test/ --recursive -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Guideline enforcer | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ bin | |
debug | ||
dep | ||
obj | ||
src/glyphs.c | ||
src/glyphs.h | ||
|
||
build | ||
test/__pycache__ | ||
test/snapshots-tmp | ||
scan-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,181 +1,110 @@ | ||
#******************************************************************************* | ||
# Ledger App | ||
# (c) 2017 Ledger | ||
# **************************************************************************** | ||
# Decred Ledger App | ||
# (c) 2023 Ledger SAS. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#******************************************************************************* | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# **************************************************************************** | ||
|
||
ifeq ($(BOLOS_SDK),) | ||
$(error Environment variable BOLOS_SDK is not set) | ||
endif | ||
|
||
include $(BOLOS_SDK)/Makefile.defines | ||
|
||
APP_PATH = "44'/42'" | ||
# All but Decred app use dependency onto the decred app/lib | ||
DEFINES_LIB = USE_LIB_DECRED | ||
######################################## | ||
# Mandatory configuration # | ||
######################################## | ||
|
||
# Enabling DEBUG flag will enable PRINTF and disable optimizations | ||
#DEBUG = 1 | ||
|
||
# Application version | ||
APPVERSION_M= 1 | ||
APPVERSION_N= 3 | ||
APPVERSION_P= 14 | ||
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" | ||
|
||
# Application source files | ||
APP_SOURCE_PATH += src | ||
|
||
APP_LOAD_PARAMS= --curve secp256k1 $(COMMON_LOAD_PARAMS) | ||
# Application icons | ||
ICON_NANOS = nanos_app_$(COIN).gif | ||
ICON_STAX = stax_app_$(COIN).gif | ||
ICON_NANOX = nanox_app_$(COIN).gif | ||
ICON_NANOSP = nanox_app_$(COIN).gif | ||
|
||
APPVERSION_M=1 | ||
APPVERSION_N=3 | ||
APPVERSION_P=13 | ||
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) | ||
APP_LOAD_FLAGS=--appFlags 0x250 --dep Decred:$(APPVERSION) | ||
# Application allowed derivation curves. | ||
CURVE_APP_LOAD_PARAMS = secp256k1 | ||
|
||
# Application allowed derivation paths. | ||
PATH_APP_LOAD_PARAMS = "44'/42'" | ||
|
||
# Setting to allow building variant applications | ||
VARIANT_PARAM = COIN | ||
VARIANT_VALUES = decred decred_testnet | ||
|
||
# simplify for tests | ||
ifndef COIN | ||
COIN=decred | ||
endif | ||
|
||
######################################## | ||
# Application custom permissions # | ||
######################################## | ||
# See SDK `include/appflags.h` for the purpose of each permission | ||
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1 | ||
HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1 | ||
HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1 | ||
|
||
ifeq ($(COIN),decred) | ||
# Decred mainnet | ||
DEFINES += COIN_P2PKH_VERSION=1855 COIN_P2SH_VERSION=1818 COIN_FAMILY=1 COIN_COINID=\"Decred\" COIN_COINID_HEADER=\"DECRED\" COIN_COLOR_HDR=0x5482ff COIN_COLOR_DB=0xB2E8CB COIN_COINID_NAME=\"Decred\" COIN_COINID_SHORT=\"DCR\" COIN_KIND=COIN_KIND_DECRED | ||
APPNAME ="Decred" | ||
APP_LOAD_PARAMS += --path $(APP_PATH) | ||
DEFINES_LIB =# Decred IS the lib | ||
APP_LOAD_FLAGS=--appFlags 0xa50 | ||
DEFINES_LIB = # Decred IS the lib | ||
DEFINES += COIN_P2PKH_VERSION=1855 COIN_P2SH_VERSION=1818 COIN_FAMILY=1 COIN_COINID=\"Decred\" COIN_COINID_HEADER=\"DECRED\" COIN_COLOR_HDR=0x5482ff COIN_COLOR_DB=0xB2E8CB COIN_COINID_NAME=\"Decred\" COIN_COINID_SHORT=\"DCR\" COIN_KIND=COIN_KIND_DECRED | ||
APPNAME = "Decred" | ||
HAVE_APPLICATION_FLAG_LIBRARY = 1 | ||
else ifeq ($(COIN),decred_testnet) | ||
# Decred mainnet | ||
DEFINES += COIN_P2PKH_VERSION=3873 COIN_P2SH_VERSION=3836 COIN_FAMILY=1 COIN_COINID=\"Decred\" COIN_COINID_HEADER=\"DECRED\" COIN_COLOR_HDR=0x5482ff COIN_COLOR_DB=0xB2E8CB COIN_COINID_NAME=\"Decred\" COIN_COINID_SHORT=\"TDCR\" COIN_KIND=COIN_KIND_DECRED_TESTNET | ||
APPNAME ="Decred Test" | ||
APP_LOAD_PARAMS += --path $(APP_PATH) | ||
|
||
# Decred testnet | ||
# All but Decred app use dependency onto the decred app/lib | ||
DEFINES_LIB = USE_LIB_DECRED | ||
DEFINES += COIN_P2PKH_VERSION=3873 COIN_P2SH_VERSION=3836 COIN_FAMILY=1 COIN_COINID=\"Decred\" COIN_COINID_HEADER=\"DECRED\" COIN_COLOR_HDR=0x5482ff COIN_COLOR_DB=0xB2E8CB COIN_COINID_NAME=\"Decred\" COIN_COINID_SHORT=\"TDCR\" COIN_KIND=COIN_KIND_DECRED_TESTNET | ||
APPNAME = "Decred Test" | ||
else | ||
ifeq ($(filter clean,$(MAKECMDGOALS)),) | ||
$(error Unsupported COIN - use decred, decred_testnet) | ||
endif | ||
endif | ||
|
||
APP_LOAD_PARAMS += $(APP_LOAD_FLAGS) | ||
DEFINES += $(DEFINES_LIB) | ||
|
||
ifeq ($(TARGET_NAME),TARGET_BLUE) | ||
ICONNAME=blue_app_$(COIN).gif | ||
else ifeq ($(TARGET_NAME),TARGET_NANOS) | ||
ICONNAME=nanos_app_$(COIN).gif | ||
else | ||
ICONNAME=nanox_app_$(COIN).gif | ||
endif | ||
|
||
################ | ||
# Default rule # | ||
################ | ||
all: default | ||
|
||
############ | ||
# Platform # | ||
############ | ||
DEFINES += $(DEFINES_LIB) TCS_LOADER_PATCH_VERSION=0 | ||
|
||
DEFINES += OS_IO_SEPROXYHAL IO_SEPROXYHAL_BUFFER_SIZE_B=300 | ||
DEFINES += HAVE_BAGL 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 | ||
# Remove warning on custom snprintf implementation usage | ||
CFLAGS += -Wno-format | ||
|
||
# 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") | ||
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL="" | ||
|
||
DEFINES += UNUSED\(x\)=\(void\)x | ||
DEFINES += APPVERSION=\"$(APPVERSION)\" | ||
|
||
|
||
ifeq ($(TARGET_NAME),TARGET_NANOX) | ||
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 | ||
DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE | ||
endif | ||
|
||
ifneq ($(TARGET_NAME),TARGET_NANOS) | ||
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 | ||
DEFINES += HAVE_UX_FLOW | ||
endif | ||
|
||
# Enabling debug PRINTF | ||
DEBUG = 0 | ||
ifneq ($(DEBUG),0) | ||
|
||
ifeq ($(TARGET_NAME),TARGET_NANOS) | ||
DEFINES += HAVE_PRINTF PRINTF=screen_printf | ||
else | ||
DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf | ||
endif | ||
else | ||
DEFINES += PRINTF\(...\)= | ||
endif | ||
|
||
|
||
|
||
############## | ||
# Compiler # | ||
############## | ||
ifneq ($(BOLOS_ENV),) | ||
$(info BOLOS_ENV=$(BOLOS_ENV)) | ||
CLANGPATH := $(BOLOS_ENV)/clang-arm-fropi/bin/ | ||
GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/ | ||
else | ||
$(info BOLOS_ENV is not set: falling back to CLANGPATH and GCCPATH) | ||
endif | ||
ifeq ($(CLANGPATH),) | ||
$(info CLANGPATH is not set: clang will be used from PATH) | ||
endif | ||
ifeq ($(GCCPATH),) | ||
$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH) | ||
endif | ||
|
||
CC := $(CLANGPATH)clang | ||
|
||
#CFLAGS += -O0 | ||
CFLAGS += -O3 -Os | ||
|
||
AS := $(GCCPATH)arm-none-eabi-gcc | ||
|
||
LD := $(GCCPATH)arm-none-eabi-gcc | ||
LDFLAGS += -O3 -Os | ||
LDLIBS += -lm -lgcc -lc | ||
|
||
# import rules to compile glyphs(/pone) | ||
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 | ||
|
||
ifeq ($(TARGET_NAME),TARGET_NANOX) | ||
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl | ||
endif | ||
|
||
load: all | ||
python -m ledgerblue.loadApp $(APP_LOAD_PARAMS) | ||
DEFINES += HAVE_IO_U2F U2F_PROXY_MAGIC=\"BTC\" | ||
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_u2f | ||
|
||
delete: | ||
python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS) | ||
######################################## | ||
# Application communication interfaces # | ||
######################################## | ||
ENABLE_BLUETOOTH = 1 | ||
|
||
# import generic rules from the sdk | ||
include $(BOLOS_SDK)/Makefile.rules | ||
######################################## | ||
# NBGL custom features # | ||
######################################## | ||
ENABLE_NBGL_QRCODE = 1 | ||
|
||
#add dependency on custom makefile filename | ||
dep/%.d: %.c Makefile | ||
# Use only specific files from standard app | ||
DISABLE_STANDARD_APP_FILES = 1 | ||
APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/io.c | ||
INCLUDES_PATH += ${BOLOS_SDK}/lib_standard_app | ||
|
||
listvariants: | ||
@echo VARIANTS COIN decred decred_testnet | ||
include $(BOLOS_SDK)/Makefile.standard_app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Ledger Decred Application | ||
|
||
## Prerequisite | ||
|
||
Be sure to have your environment correctly set up (see [Getting Started](https://developers.ledger.com/docs/nano-app/introduction/)) and [ledgerblue](https://pypi.org/project/ledgerblue/) installed. | ||
|
||
## Compilation | ||
|
||
``` | ||
make DEBUG=1 # compile optionally with PRINTF | ||
make load # load the app on the Nano using ledgerblue | ||
``` |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.