Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ledger Review Fixes #3

Merged
merged 69 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8c21657
add stax to sialedger and fix compiler warnings
chris124567 May 10, 2023
4f6a1d0
add nanosp support
chris124567 May 19, 2023
24e98ed
add address verification confirmation screen
chris124567 May 19, 2023
0984b14
add developer to about page
chris124567 May 20, 2023
be1de78
add nanosp icon and fix nanox load parameters
chris124567 May 21, 2023
916971e
fix icon in makefile
chris124567 May 21, 2023
7725dcf
add status screens for all actions and fix address verification status
chris124567 May 30, 2023
cb311be
change transaction signing UI flow to Ledger recommendations
chris124567 Jun 3, 2023
27d0a9b
fix tests
chris124567 Jun 3, 2023
9d76068
use nbgl_useCaseRegularReview instead of nbgl_useCaseForwardOnlyRevie…
chris124567 Jun 7, 2023
29d4480
store transaction elements data in fixed size array
chris124567 Nov 13, 2023
2c188b2
remove displayIndex from struct to save memory, adjust MAX_ELEMS for …
chris124567 Nov 13, 2023
0194144
get back button working on Stax
chris124567 Nov 14, 2023
e4e4562
prefetch transaction on non stax devices
chris124567 Nov 14, 2023
030e1b8
disable txn test as it hangs for unknown reasons
chris124567 Nov 14, 2023
62bb057
fix bug where revisiting final page when calculating txn hash would c…
chris124567 Nov 14, 2023
8bdb8a8
replace deprecated functions with new versions
chris124567 Nov 15, 2023
ef29b28
fix bug where Nano version would crash if signing txns after another …
chris124567 Nov 15, 2023
ad75b1b
fix Stax build warning
chris124567 Nov 15, 2023
18d5125
only store encoded currencies and addresses to save space
chris124567 Nov 16, 2023
a5e69f1
fix cur2dec type cast build warning
chris124567 Nov 16, 2023
19fe48e
use uint8_t for elemType
chris124567 Nov 17, 2023
6d629ac
save 7 bytes in transaction value field
chris124567 Nov 21, 2023
fba1510
fix werkzeug version
chris124567 Nov 22, 2023
ccf7671
update snapshots
chris124567 Nov 22, 2023
7764d44
remove accidentally added formatSC call for Siafund values on Stax
chris124567 Nov 27, 2023
791bbad
Merge pull request #4 from SiaFoundation/make-back-button-work
lukechampine Nov 28, 2023
cc695db
remove UNUSED statement, use new boilerplate Makefile
chris124567 Dec 4, 2023
b398e6b
use nbgl_useCaseReviewStart on Stax for transactions
chris124567 Dec 4, 2023
67ee12c
replace main.c with app_main.c
chris124567 Dec 4, 2023
6535d1d
update version number in tests
chris124567 Dec 4, 2023
c5d4933
add ledger_app.toml
chris124567 Dec 4, 2023
c66a169
fix variant
chris124567 Dec 4, 2023
e13c4d2
makefile fixes
chris124567 Dec 5, 2023
d97fe0d
change hashing UI
chris124567 Dec 5, 2023
03f4311
remove unused variable
chris124567 Dec 5, 2023
7d8e8cd
use new cryptography API
chris124567 Dec 10, 2023
4180797
remove commented out code
chris124567 Dec 10, 2023
d2771e6
remove private key option in deriveSiaKeypair
chris124567 Dec 11, 2023
8b5082e
add asserts for cryptographic function failure
chris124567 Dec 11, 2023
ba7a42e
assertion fixes and use raw buffer for public key
chris124567 Dec 13, 2023
b142ce7
reenable and clean up transaction tests
chris124567 Dec 14, 2023
c1bce62
use recommended labels for transaction elements and hold to sign
chris124567 Dec 15, 2023
707cf19
remove unnecessary defines in makefile
chris124567 Dec 21, 2023
9307d77
remove unnecessary glyphs
chris124567 Dec 21, 2023
e7cb773
use smaller types for blake2b
chris124567 Dec 21, 2023
9a6686f
don't use intermediate buffer if not necessary in blake2b_final
chris124567 Dec 21, 2023
7123e99
update README/Tutorial
chris124567 Dec 21, 2023
ec73490
follow signing guidelines
chris124567 Dec 29, 2023
13ce917
remove not relevant checks
chris124567 Jan 4, 2024
81e2d59
add .clang-format and format
chris124567 Jan 4, 2024
ac19d8c
format
chris124567 Jan 4, 2024
db0b16a
fix flags
chris124567 Jan 4, 2024
6ed3f98
fix formatting again
chris124567 Jan 4, 2024
0b419aa
remove unnecessary initialization code from main
chris124567 Jan 19, 2024
8c5b071
remove unnecessary BAGL defines
chris124567 Jan 19, 2024
556616a
format
chris124567 Jan 19, 2024
b1aeff3
change validate icon
chris124567 Jan 23, 2024
deccf19
rename io_seproxyhal_cancel, remove io_seproxyhal_display(), io_event…
chris124567 Jan 23, 2024
07905da
simplify handlers, rename cancel function, start switch to standard l…
chris124567 Jan 23, 2024
2535e02
use standard io library in all places
chris124567 Jan 23, 2024
e1173ec
fixes for checks
chris124567 Jan 25, 2024
77ccbb2
make sign hash compliant on stax
chris124567 Feb 5, 2024
518d041
remove exceptions everywhere except txn.c (todo)
chris124567 Feb 5, 2024
c0dd6ba
add stax test snapshots
chris124567 Feb 5, 2024
1c0e738
use more complicated test transaction
chris124567 Feb 7, 2024
6e2012b
update snapshots
chris124567 Feb 7, 2024
a5a0b15
update comments
chris124567 Feb 9, 2024
70229e2
remove unnecessary flag
chris124567 Feb 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
40 changes: 0 additions & 40 deletions .github/workflows/coverity.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/documentation_generation.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/misspellings_checks.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/unit_tests.yml

This file was deleted.

202 changes: 94 additions & 108 deletions Makefile
chris124567 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,123 +1,109 @@
#*******************************************************************************
# Ledger App
# (c) 2017 Ledger
# ****************************************************************************
# Ledger App Boilerplate
# (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 #
#########
include $(BOLOS_SDK)/Makefile.defines

APPNAME = Sia
APPVERSION = 0.4.4
ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME=nanos_app_sia.gif
else ifeq ($(TARGET_NAME),TARGET_NANOX)
ICONNAME=nanox_app_sia.gif
else ifeq ($(TARGET_NAME),TARGET_STAX)
ICONNAME=stax_app_sia.gif
endif
########################################
# Mandatory configuration #
########################################
# Application name
APPNAME = "Sia"

# The --path argument here restricts which BIP32 paths the app is allowed to derive.
APP_LOAD_PARAMS = --path "44'/93'" --curve ed25519 $(COMMON_LOAD_PARAMS)
ifeq ($(TARGET_NAME),TARGET_NANOS)
APP_LOAD_PARAMS += --appFlags 0x40
else ifeq ($(TARGET_NAME),TARGET_NANOX)
APP_LOAD_PARAMS += --appFlags 0x40
else ifeq ($(TARGET_NAME), TARGET_STAX)
APP_LOAD_PARAMS += --appFlags 0x240
endif
# Application version
APPVERSION_M = 1
APPVERSION_N = 0
APPVERSION_P = 0
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

# Application source files
APP_SOURCE_PATH += src
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl
ifneq ($(TARGET_NAME),TARGET_STAX)
SDK_SOURCE_PATH += lib_ux
endif

all: default

load: all
python -m ledgerblue.loadApp $(APP_LOAD_PARAMS)

delete:
python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)

############
# Platform #
############

DEFINES += OS_IO_SEPROXYHAL
DEFINES += HAVE_SPRINTF
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=7 IO_HID_EP_LENGTH=64 HAVE_USB_APDU
# Application icons following guidelines:
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
ICON_NANOS = nanos_app_sia.gif
ICON_NANOX = nanox_app_sia.gif
ICON_NANOSP = nanos2_app_sia.gif
ICON_STAX = stax_app_sia.gif

# Application allowed derivation curves.
# Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1
# If your app needs it, you can specify multiple curves by using:
# `CURVE_APP_LOAD_PARAMS = <curve1> <curve2>`
CURVE_APP_LOAD_PARAMS = ed25519

# Application allowed derivation paths.
# You should request a specific path for your app.
# This serve as an isolation mechanism.
# Most application will have to request a path according to the BIP-0044
# and SLIP-0044 standards.
# If your app needs it, you can specify multiple path by using:
# `PATH_APP_LOAD_PARAMS = "44'/1'" "45'/1'"`
PATH_APP_LOAD_PARAMS = "44'/93'"

# Setting to allow building variant applications
# - <VARIANT_PARAM> is the name of the parameter which should be set
# to specify the variant that should be build.
# - <VARIANT_VALUES> a list of variant that can be build using this app code.
# * It must at least contains one value.
# * Values can be the app ticker or anything else but should be unique.
VARIANT_PARAM = COIN
VARIANT_VALUES = sia

# Enabling DEBUG flag will enable PRINTF and disable optimizations
#DEBUG = 1

########################################
# Application custom permissions #
########################################
# See SDK `include/appflags.h` for the purpose of each permission
#HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1
#HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
chris124567 marked this conversation as resolved.
Show resolved Hide resolved
#HAVE_APPLICATION_FLAG_LIBRARY = 1

########################################
# Application communication interfaces #
########################################
ENABLE_BLUETOOTH = 1
#ENABLE_NFC = 1

########################################
# NBGL custom features #
########################################
#ENABLE_NBGL_QRCODE = 1
#ENABLE_NBGL_KEYBOARD = 1
#ENABLE_NBGL_KEYPAD = 1

########################################
# Features disablers #
########################################
# These advanced settings allow to disable some feature that are by
# default enabled in the SDK `Makefile.standard_app`.
#DISABLE_STANDARD_APP_FILES = 1
#DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1 # To allow custom size declaration
#DISABLE_STANDARD_APP_DEFINES = 1 # Will set all the following disablers
#DISABLE_STANDARD_SNPRINTF = 1
#DISABLE_STANDARD_USB = 1
#DISABLE_STANDARD_WEBUSB = 1
#DISABLE_STANDARD_BAGL_UX_FLOW = 1
DEFINES += HAVE_LEGACY_PID
DEFINES += APPNAME=\"$(APPNAME)\"
DEFINES += APPVERSION=\"$(APPVERSION)\"
DEFINES += UNUSED\(x\)=\(void\)x

ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS))
DEFINES += HAVE_BAGL
DEFINES += HAVE_UX_FLOW
endif

### Nano X
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
else ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX))
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
# bluetooth
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000
DEFINES += HAVE_BLE_APDU
# include fonts or ui will be empty
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
endif

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += HAVE_BAGL_ELLIPSIS
DEFINES += BAGL_WIDTH=128 BAGL_HEIGHT=64
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


##############
# Compiler #
##############

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

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

##################
# Dependencies #
##################

# import rules to compile glyphs
include $(BOLOS_SDK)/Makefile.glyphs
# import generic rules from the sdk
include $(BOLOS_SDK)/Makefile.rules

dep/%.d: %.c Makefile

listvariants:
@echo VARIANTS COIN sia
include $(BOLOS_SDK)/Makefile.standard_app
Loading
Loading