Skip to content

Commit

Permalink
Merge pull request #22 from LedgerHQ/develop
Browse files Browse the repository at this point in the history
Release 1.2.3
  • Loading branch information
lpascal-ledger authored May 23, 2024
2 parents 0cdc70a + ef798e7 commit 43bc057
Show file tree
Hide file tree
Showing 100 changed files with 5,091 additions and 7,328 deletions.
20 changes: 20 additions & 0 deletions .clang-format
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
---
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
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 -->
58 changes: 58 additions & 0 deletions .github/workflows/build_tests_and_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build, test (unit, functional) and scan the application

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

jobs:
build_application:
name: Build application using the reusable workflow
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 using the reusable workflow
needs: build_application
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: compiled_app_binaries
run_for_devices: '["stax"]'

unittesting:
name: C unit testing
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Install cmocka
run: |
sudo apt update
sudo apt install libcmocka-dev lcov
- name: Compile the tests
run: |
cd tests/unit/
rm -rf build/
cmake -B build -H.
make -C build
- name: Run the tests
run: |
cd tests/unit/
CTEST_OUTPUT_ON_FAILURE=1 make -C build test
- name: Generate code coverage
run: |
cd tests/unit/
lcov --directory . -b "$(realpath build/)" --capture --initial -o coverage.base
lcov --rc lcov_branch_coverage=1 --directory . -b "$(realpath build/)" --capture -o coverage.capture
lcov --directory . -b "$(realpath build/)" --add-tracefile coverage.base --add-tracefile coverage.capture -o coverage.info
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info
genhtml coverage.info -o coverage
- uses: actions/upload-artifact@v3
with:
name: code-coverage
path: tests/unit/coverage
51 changes: 51 additions & 0 deletions .github/workflows/codeql-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "CodeQL"

on:
push:
branches:
- master
- develop
pull_request:
# Excluded path: add the paths you want to ignore instead of deleting the workflow
paths-ignore:
- '.github/workflows/*.yml'
- 'tests/*'

jobs:
analyse:
name: Analyse
strategy:
fail-fast: false
matrix:
include:
- SDK: "$NANOS_SDK"
name: nanos
- SDK: "$NANOX_SDK"
name: nanox
- SDK: "$NANOSP_SDK"
name: nanos2
- SDK: "$STAX_SDK"
name: stax
#'cpp' covers C and C++
language: [ 'cpp' ]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest

steps:
- name: Clone
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: security-and-quality

# CodeQL will create the database during the compilation
- name: Build
run: |
make BOLOS_SDK=${{ matrix.SDK }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
15 changes: 15 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Ensure compliance with Ledger guidelines

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
42 changes: 42 additions & 0 deletions .github/workflows/lint-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code style check

on:
workflow_dispatch:
push:
branches:
- master
pull_request:
paths-ignore:
- '.github/workflows/*.yml'
- 'tests/*'

jobs:
job_lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Clone
uses: actions/checkout@v2

- name: Lint
uses: DoozyX/[email protected]
with:
source: 'src'
extensions: 'h,c'
clangFormatVersion: 11

misspell:
name: Check misspellings
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check misspellings
uses: codespell-project/actions-codespell@master
with:
builtin: clear,rare
check_filenames: true
ignore_words_list: ontop
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Compilation of Ledger's app
src/glyphs.c
src/glyphs.h
bin/
debug/
dep/
obj/
elfs/
build/
*.elf

# Unit tests and code coverage
tests/unit/coverage/
tests/unit/coverage.info


# Editors
.idea/
*~

# Python
*.pyc[cod]
*.egg
__pycache__/
*.egg-info/
.eggs/
.python-version
*-tmp/

# Doxygen
doc/html
doc/latex
103 changes: 61 additions & 42 deletions Makefile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,94 +18,113 @@
ifeq ($(BOLOS_SDK),)
$(error Environment variable BOLOS_SDK is not set)
endif

include $(BOLOS_SDK)/Makefile.defines

all: default

# Main app configuration

APPNAME = "Recovery Check"
APPVERSION = 1.0.7
APP_LOAD_PARAMS = --appFlags 0x210 $(COMMON_LOAD_PARAMS) --apdu --curve secp256k1 --path ""
APPVERSION_M = 1
APPVERSION_N = 2
APPVERSION_P = 3
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

APP_LOAD_PARAMS = --appFlags 0x10 $(COMMON_LOAD_PARAMS) --curve secp256k1 --path ""

ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME=nanos_app_recovery_check.gif
ifeq ($(TARGET_NAME), TARGET_NANOS)
ICONNAME=icons/nanos_app_recovery_check.gif
else ifeq ($(TARGET_NAME), TARGET_STAX)
ICONNAME=icons/stax_recovery_check_32px.gif
else
ICONNAME=nanox_app_recovery_check.gif
ICONNAME=icons/nanox_app_recovery_check.gif
endif

# Build configuration

DEFINES += APPVERSION=\"$(APPVERSION)\"
DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_M)
DEFINES += LEDGER_MINOR_VERSION=$(APPVERSION_N)
DEFINES += LEDGER_PATCH_VERSION=$(APPVERSION_P)
DEFINES += OS_IO_SEPROXYHAL
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""

DEFINES += OS_IO_SEPROXYHAL IO_SEPROXYHAL_BUFFER_SIZE_B=128
DEFINES += HAVE_BAGL HAVE_SPRINTF
DEFINES += BOLOS_APP_ICON_SIZE_B=\(9+32\)
#DEFINES += HAVE_ELECTRUM
DEFINES += IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64
DEFINES += HAVE_SPRINTF

DEFINES += HAVE_UX_FLOW

ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_GLO096 HAVE_BOLOS_UX
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_KEYBOARD_UX
ifneq ($(TARGET_NAME), TARGET_STAX)
$(info Using BAGL)
DEFINES += HAVE_BAGL HAVE_UX_FLOW
else
$(info Using NBGL)
DEFINES += NBGL_KEYBOARD
endif

ifeq ($(TARGET_NAME), TARGET_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
ifneq ($(TARGET_NAME), TARGET_STAX)
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
DEFINES += HAVE_KEYBOARD_UX
endif
endif

# Enabling debug PRINTF
DEBUG = 0
ifneq ($(DEBUG),0)

DEFINES += HAVE_BOLOS_NOT_SHUFFLED_RESTORE

ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_PRINTF PRINTF=screen_printf
else
DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf
endif
ifneq ($(DEBUG), 0)
$(info DEBUG enabled)
DEFINES += HAVE_IO_USB HAVE_USB_APDU
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl
DEFINES += HAVE_PRINTF
ifeq ($(TARGET_NAME), TARGET_NANOS)
DEFINES += PRINTF=screen_printf
else
DEFINES += PRINTF=mcu_usb_printf
endif
else
DEFINES += PRINTF\(...\)=
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/
$(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)
$(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)
$(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)
$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH)
endif

CC := $(CLANGPATH)clang
CFLAGS += -O3 -Os

CFLAGS += -Wshadow -Wformat
AS := $(GCCPATH)arm-none-eabi-gcc
AFLAGS +=

LD := $(GCCPATH)arm-none-eabi-gcc
LDFLAGS += -O3 -Os
LDLIBS += -lm -lgcc -lc

# import rules to compile glyphs(/pone)
include $(BOLOS_SDK)/Makefile.glyphs

APP_SOURCE_PATH += src src_ux_common
APP_SOURCE_PATH += src

ifneq ($(TARGET_NAME),TARGET_NANOS)
SDK_SOURCE_PATH += lib_ux
ifneq ($(TARGET_NAME), TARGET_NANOS)
ifneq ($(TARGET_NAME), TARGET_STAX)
SDK_SOURCE_PATH += lib_ux
endif
endif

# Main rules
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Nano S app to check seed backup

This application invites the user to type his seed on his Nano S, this seed is compared against the onboarded seed, and user is informed wether both seeds are matching or not
This application invites the user to type his seed on his Nano S, this seed is compared against the onboarded seed, and user is informed whether both seeds are matching or not
Binary file modified glyphs/icon_bat_ovl_charging.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glyphs/stax_recovery_check_64px.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added icons/stax_recovery_check_32px.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 43bc057

Please sign in to comment.