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

Stax #119

Merged
merged 17 commits into from
May 31, 2023
Merged

Stax #119

Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and run functional tests using ragger through reusable workflow

# This workflow will build the app and then run functional tests using the Ragger framework upon Speculos emulation.
# It calls a reusable workflow developed by Ledger's internal developer team to build the application and upload the
# resulting binaries.
# It then calls another reusable workflow to run the Ragger tests on the compiled application binary.
#
# While this workflow is optional, having functional testing on your application is mandatory and this workflow and
# tooling environment is meant to be easy to use and adapt after forking your 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"
flags: "DEBUG=1"

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"
test_dir: tests
91 changes: 0 additions & 91 deletions .github/workflows/ci-workflow.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/codeql-workflow.yml

This file was deleted.

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
26 changes: 15 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ include $(BOLOS_SDK)/Makefile.defines
APP_LOAD_PARAMS= --path "2147483692/2147483776" --curve secp256k1 $(COMMON_LOAD_PARAMS) --appFlags 0x240
APPNAME = "Monero"

ifeq ($(TARGET_NAME),TARGET_BLUE)
ICONNAME = images/icon_monero_blue.gif
else ifeq ($(TARGET_NAME),TARGET_NANOS)
ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME = images/icon_monero.gif
else ifeq ($(TARGET_NAME),TARGET_STAX)
ICONNAME = images/icon_monero_stax.gif
else
ICONNAME = images/icon_monero_nanox.gif
endif
Expand All @@ -40,7 +40,7 @@ endif

APPVERSION_M=1
APPVERSION_N=8
APPVERSION_P=1
APPVERSION_P=2

APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)
SPECVERSION="1.0"
Expand All @@ -53,8 +53,9 @@ DEFINES += SPEC_VERSION=$(SPECVERSION)

ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += UI_NANO_S
else ifeq ($(TARGET_NAME),TARGET_BLUE)
DEFINES += UI_BLUE
else ifeq ($(TARGET_NAME),TARGET_STAX)
DEFINES += UI_STAX
DEFINES += NBGL_QRCODE
else
DEFINES += UI_NANO_X
TARGET_UI := FLOW
Expand All @@ -77,7 +78,7 @@ DEFINES += NO_CONSENT
endif

DEFINES += OS_IO_SEPROXYHAL
DEFINES += HAVE_BAGL HAVE_SPRINTF
DEFINES += HAVE_SPRINTF
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 HAVE_USB_APDU
DEFINES += CUSTOM_IO_APDU_BUFFER_SIZE=\(255+5+64\)
DEFINES += HAVE_LEGACY_PID
Expand All @@ -89,22 +90,25 @@ DEFINES += HAVE_IO_U2F HAVE_U2F
DEFINES += UNUSED\(x\)=\(void\)x
DEFINES += APPVERSION=\"$(APPVERSION)\"

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_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
DEFINES += HAVE_BAGL
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_GLO096
ifneq ($(TARGET_NAME),TARGET_STAX)
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_GLO096
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_UI),FLOW)
DEFINES += HAVE_UX_FLOW
Expand All @@ -122,6 +126,7 @@ ifneq ($(DEBUG),0)
DEFINES += PLINE="PRINTF(\"FILE:%s..LINE:%d\n\",__FILE__,__LINE__)"
# Debug options
DEFINES += DEBUG_HWDEVICE
DEFINES += BYPASS_COMMITMENT_FOR_TESTS
DEFINES += IODUMMYCRYPT # or IONOCRYPT
# Stagenet network by default
DEFINES += MONERO_BETA
Expand Down Expand Up @@ -175,11 +180,10 @@ ifeq ($(TARGET_UI),FLOW)
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


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

Expand Down
Binary file added glyphs/Monero_64px.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 images/icon_monero_stax.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions src/monero_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ int monero_apdu_close_tx(void);

void ui_init(void);
void ui_menu_lock_display(void);
void ui_menu_main_display(unsigned int value);
void ui_menu_info_display(unsigned int value);
void ui_menu_info_display2(unsigned int value, char *line1, char *line2);
void ui_menu_main_display(void);
void ui_menu_show_security_error(void);
void ui_menu_show_tx_aborted(void);
void ui_export_viewkey_display(unsigned int value);
void ui_menu_any_pubaddr_display(unsigned int value, unsigned char *pub_view,
unsigned char *pub_spend, unsigned char is_subbadress,
unsigned char *paymanetID);
void ui_menu_pubaddr_display(unsigned int value);

unsigned int ui_menu_transaction_start(void);
unsigned int ui_menu_transaction_signed(void);
/* ----------------------------------------------------------------------- */
/* --- MISC ---- */
/* ----------------------------------------------------------------------- */
Expand All @@ -122,11 +124,15 @@ int monero_abort_tx(void);
int monero_unblind(unsigned char *v, unsigned char *k, unsigned char *AKout,
unsigned int short_amount);
void ui_menu_validation_display(unsigned int value);
void ui_menu_validation_display_last(unsigned int value);
void ui_menu_fee_validation_display(unsigned int value);
void ui_menu_change_validation_display(unsigned int value);
void ui_menu_change_validation_display_last(unsigned int value);
void ui_menu_timelock_validation_display(unsigned int value);

void ui_menu_opentx_display(unsigned int value);

void display_account(void);
/* ----------------------------------------------------------------------- */
/* --- KEYS & ADDRESS ---- */
/* ----------------------------------------------------------------------- */
Expand Down
2 changes: 1 addition & 1 deletion src/monero_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int check_potocol() {
break;
}
// unknown protocol or hot protocol switch is not allowed
// FALL THROUGH
__attribute__((fallthrough));

default:
return SW_PROTOCOL_NOT_SUPPORTED;
Expand Down
2 changes: 1 addition & 1 deletion src/monero_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,6 @@ void monero_lock_and_throw(int sw) {
G_monero_vstate.protocol_barrier = PROTOCOL_LOCKED;
snprintf(G_monero_vstate.ux_info1, sizeof(G_monero_vstate.ux_info1), "Security Err");
snprintf(G_monero_vstate.ux_info2, sizeof(G_monero_vstate.ux_info2), "%x", sw);
ui_menu_info_display(0);
ui_menu_show_security_error();
THROW(sw);
}
2 changes: 1 addition & 1 deletion src/monero_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ int monero_apdu_get_key() {
}
break;

#if DEBUG_HWDEVICE
#ifdef DEBUG_HWDEVICE
// get info
case 3: {
unsigned int path[5];
Expand Down
Loading