Skip to content
Merged
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
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@ APPVERSION_P = 0
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-dev

# Application source files
APP_SOURCE_PATH += src src_features src_plugins
ifeq ($(TARGET_NAME),TARGET_NANOS)
APP_SOURCE_PATH += src_bagl
else
APP_SOURCE_PATH += src_nbgl
endif
APP_SOURCE_PATH += src src_features src_plugins src_nbgl
APP_SOURCE_FILES += $(filter-out ./ethereum-plugin-sdk/src/main.c, $(wildcard ./ethereum-plugin-sdk/src/*.c))
INCLUDES_PATH += ./ethereum-plugin-sdk/src

Expand All @@ -62,7 +57,6 @@ endif

# Application icons following guidelines:
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
ICON_NANOS = icons/nanos_app_chain_$(CHAIN_ID).gif
ICON_NANOX = icons/nanox_app_chain_$(CHAIN_ID).gif
ICON_NANOSP = icons/nanox_app_chain_$(CHAIN_ID).gif
ICON_STAX = icons/stax_app_chain_$(CHAIN_ID).gif
Expand Down Expand Up @@ -132,9 +126,7 @@ endif
ENABLE_BLUETOOTH = 1
ENABLE_SWAP = 1
#ENABLE_NFC = 1
ifneq ($(TARGET_NAME),TARGET_NANOS)
ENABLE_NBGL_FOR_NANO_DEVICES = 1
endif

########################################
# NBGL custom features #
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,18 @@ pip install -r tests/ragger/requirements.txt

Then you can:

Run the functional tests (here for nanos but available for any device once you have built the binaries):
Run the functional tests (here for flex but available for any device once you have built the binaries):

```shell
pytest tests/ragger/ --tb=short -v --device nanos
pytest tests/ragger/ --tb=short -v --device flex
```

Please see the corresponding ducomentation [USAGE](tests/ragger/usage.md)

Or run your app directly with Speculos

```shell
speculos --model nanos build/nanos/bin/app.elf
speculos build/flex/bin/app.elf
```

#### macOS / Windows
Expand Down
4 changes: 1 addition & 3 deletions client/src/ledger_app_clients/ethereum/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ def __init__(self, client: BackendInterface):
self._firmware = client.firmware
self._cmd_builder = CommandBuilder()
self._pki_client: Optional[PKIClient] = None
if self._firmware != Firmware.NANOS:
# LedgerPKI not supported on Nanos
self._pki_client = PKIClient(self._client)
self._pki_client = PKIClient(self._client)

def _exchange_async(self, payload: bytes):
return self._client.exchange_async_raw(payload)
Expand Down
11 changes: 1 addition & 10 deletions client/src/ledger_app_clients/ethereum/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ class SettingID(Enum):

def get_device_settings(firmware: Firmware) -> list[SettingID]:
"""Get the list of settings available on the device"""
if firmware == Firmware.NANOS:
return [
SettingID.BLIND_SIGNING,
SettingID.NONCE,
SettingID.DEBUG_DATA,
]
if firmware.is_nano:
return [
SettingID.BLIND_SIGNING,
Expand Down Expand Up @@ -95,10 +89,7 @@ def get_settings_moves(firmware: Firmware,
settings = get_device_settings(firmware)
# Assume the app is on the 1st page of Settings
if firmware.is_nano:
moves += [NavInsID.RIGHT_CLICK]
if firmware == Firmware.NANOS:
moves += [NavInsID.RIGHT_CLICK]
moves += [NavInsID.BOTH_CLICK]
moves += [NavInsID.RIGHT_CLICK, NavInsID.BOTH_CLICK]
for setting in settings:
if setting in to_toggle:
moves += [NavInsID.BOTH_CLICK]
Expand Down
Binary file removed icons/nanos_app_chain_1.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_108.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_1284.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_1285.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_1313114.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_1620.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_1666600000.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_19.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_1987.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_2.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_200625.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_20531812.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_237.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_24484.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_246.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_246529.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_248.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_269.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_2894.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_30.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_31.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_31102.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_3125659152.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_336.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_4689.gif
Binary file not shown.
Binary file removed icons/nanos_app_chain_50.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_592.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_60.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_61.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_64.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_76.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_7762959.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_78.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_8.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_820.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_846000.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_88.gif
Diff not rendered.
Binary file removed icons/nanos_app_chain_888.gif
Diff not rendered.
61 changes: 14 additions & 47 deletions makefile_conf/features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,14 @@ ifneq ($(SET_PLUGIN_TEST_KEY),0)
endif

# NFTs
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_NFT_SUPPORT
NFT_TEST_KEY ?= 0
ifneq ($(NFT_TEST_KEY),0)
DEFINES += HAVE_NFT_TEST_KEY
endif
NFT_STAGING_KEY ?= 0
ifneq ($(NFT_STAGING_KEY),0)
# Key used by the staging backend
DEFINES += HAVE_NFT_STAGING_KEY
endif
endif

# Dynamic memory allocator
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_DYN_MEM_ALLOC
endif

# EIP-712
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_EIP712_FULL_SUPPORT
NFT_TEST_KEY ?= 0
ifneq ($(NFT_TEST_KEY),0)
DEFINES += HAVE_NFT_TEST_KEY
endif

ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_ENUM_VALUE
DEFINES += HAVE_GENERIC_TX_PARSER
NFT_STAGING_KEY ?= 0
ifneq ($(NFT_STAGING_KEY),0)
# Key used by the staging backend
DEFINES += HAVE_NFT_STAGING_KEY
endif

# CryptoAssetsList key
Expand All @@ -54,35 +36,20 @@ ifneq ($(CAL_STAGING_KEY),0)
endif

# ENS
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_TRUSTED_NAME
TRUSTED_NAME_TEST_KEY ?= 0
ifneq ($(TRUSTED_NAME_TEST_KEY),0)
DEFINES += HAVE_TRUSTED_NAME_TEST_KEY
endif
endif

# Dynamic networks
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_DYNAMIC_NETWORKS
TRUSTED_NAME_TEST_KEY ?= 0
ifneq ($(TRUSTED_NAME_TEST_KEY),0)
DEFINES += HAVE_TRUSTED_NAME_TEST_KEY
endif

# Web3 Checks
# Transaction Checks
# TODO: remove this check once the web3 checks are implemented on all targets
# ifneq ($(TARGET_NAME),TARGET_NANOS)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
DEFINES += HAVE_WEB3_CHECKS
endif

# EIP 7702
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_EIP7702
DEFINES += HAVE_EIP7702_WHITELIST

EIP7702_TEST_WHITELIST ?= 0
ifneq ($(EIP7702_TEST_WHITELIST),0)
DEFINES += HAVE_EIP7702_WHITELIST_TEST
endif
EIP7702_TEST_WHITELIST ?= 0
ifneq ($(EIP7702_TEST_WHITELIST),0)
DEFINES += HAVE_EIP7702_WHITELIST_TEST
endif

# Check features incompatibilities
Expand Down
5 changes: 1 addition & 4 deletions src/apdu_constants.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef _APDU_CONSTANTS_H_
#define _APDU_CONSTANTS_H_
#pragma once

#include "offsets.h"
#include "shared_context.h"
Expand Down Expand Up @@ -116,5 +115,3 @@ uint16_t handleGetEth2PublicKey(uint8_t p1,
#endif

extern uint16_t apdu_response_code;

#endif // _APDU_CONSTANTS_H_
5 changes: 1 addition & 4 deletions src/chainConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
* limitations under the License.
********************************************************************************/

#ifndef _CHAIN_CONFIG_H_
#define _CHAIN_CONFIG_H_
#pragma once

#include "asset_info.h"

Expand All @@ -26,5 +25,3 @@ typedef struct chain_config_s {
} chain_config_t;

#define ETHEREUM_MAINNET_CHAINID 1

#endif // _CHAIN_CONFIG_H_
9 changes: 1 addition & 8 deletions src/common_ui.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef _COMMON_UI_H_
#define _COMMON_UI_H_
#pragma once

#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -34,11 +33,5 @@ bool ui_gcs(void);
// EIP-7702
void ui_sign_7702_auth(void);
void ui_sign_7702_revocation(void);
#ifdef HAVE_EIP7702
void ui_error_no_7702(void);
#ifdef HAVE_EIP7702_WHITELIST
void ui_error_no_7702_whitelist(void);
#endif // HAVE_EIP7702_WHITELIST
#endif // HAVE_EIP7702

#endif // _COMMON_UI_H_
4 changes: 0 additions & 4 deletions src/eth_plugin_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress,

PRINTF("Selector %.*H\n", 4, init->selector);
switch (pluginType) {
#ifdef HAVE_NFT_SUPPORT
case ERC1155:
case ERC721:
#endif // HAVE_NFT_SUPPORT
case EXTERNAL:
PRINTF("eth_plugin_perform_init_default\n");
eth_plugin_perform_init_default(contractAddress, init);
Expand Down Expand Up @@ -285,7 +283,6 @@ eth_plugin_result_t eth_plugin_call(int method, void *parameter) {
swap_with_calldata_plugin_call(method, parameter);
break;
}
#ifdef HAVE_NFT_SUPPORT
case ERC721: {
erc721_plugin_call(method, parameter);
break;
Expand All @@ -294,7 +291,6 @@ eth_plugin_result_t eth_plugin_call(int method, void *parameter) {
erc1155_plugin_call(method, parameter);
break;
}
#endif // HAVE_NFT_SUPPORT
case OLD_INTERNAL: {
// Perform the call
for (i = 0;; i++) {
Expand Down
5 changes: 1 addition & 4 deletions src/eth_plugin_handler.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef _ETH_PLUGIN_HANDLER_H_
#define _ETH_PLUGIN_HANDLER_H_
#pragma once

#include "eth_plugin_interface.h"

Expand Down Expand Up @@ -32,5 +31,3 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress,
ethPluginInitContract_t *init);
// NULL for cached address, or base contract address
eth_plugin_result_t eth_plugin_call(int method, void *parameter);

#endif // _ETH_PLUGIN_HANDLER_H_
5 changes: 1 addition & 4 deletions src/handle_check_address.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#ifndef _HANDLE_CHECK_ADDRESS_H_
#define _HANDLE_CHECK_ADDRESS_H_
#pragma once

#include "swap_lib_calls.h"
#include "chainConfig.h"

uint16_t handle_check_address(check_address_parameters_t* check_address_params,
chain_config_t* chain_config);

#endif // _HANDLE_CHECK_ADDRESS_H_
5 changes: 1 addition & 4 deletions src/handle_get_printable_amount.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#ifndef _HANDLE_GET_PRINTABLE_AMOUNT_H_
#define _HANDLE_GET_PRINTABLE_AMOUNT_H_
#pragma once

#include "swap_lib_calls.h"
#include "chainConfig.h"

uint16_t handle_get_printable_amount(get_printable_amount_parameters_t* get_printable_amount_params,
chain_config_t* config);

#endif // _HANDLE_GET_PRINTABLE_AMOUNT_H_
4 changes: 1 addition & 3 deletions src/handle_swap_sign_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#include "shared_context.h"
#include "network.h"
#include "cmd_setPlugin.h"
#ifdef HAVE_NBGL
#include "nbgl_use_case.h"
#endif // HAVE_NBGL

// Standard or crosschain swap type
swap_mode_t G_swap_mode;
Expand Down Expand Up @@ -159,7 +157,7 @@ void __attribute__((noreturn)) handle_swap_sign_transaction(const chain_config_t

#ifdef SCREEN_SIZE_WALLET
nbgl_useCaseSpinner("Signing");
#endif // HAVE_NBGL
#endif // SCREEN_SIZE_WALLET

app_main();

Expand Down
5 changes: 1 addition & 4 deletions src/hash_bytes.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#ifndef HASH_BYTES_H_
#define HASH_BYTES_H_
#pragma once

#include <stdint.h>
#include "cx.h"

void hash_nbytes(const uint8_t *const bytes_ptr, size_t n, cx_hash_t *hash_ctx);
void hash_byte(uint8_t byte, cx_hash_t *hash_ctx);

#endif // HASH_BYTES_H_
9 changes: 1 addition & 8 deletions src/ledger_pki.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,21 @@ int check_signature_with_pubkey(const char *tag,
const uint8_t bufLen,
const uint8_t *PubKey,
const uint8_t keyLen,
#ifdef HAVE_LEDGER_PKI
const uint8_t keyUsageExp,
#endif
uint8_t *signature,
const uint8_t sigLen) {
UNUSED(tag);
cx_ecfp_public_key_t verif_key = {0};
cx_err_t error = CX_INTERNAL_ERROR;
#ifdef HAVE_LEDGER_PKI
uint8_t key_usage = 0;
size_t trusted_name_len = 0;
uint8_t trusted_name[CERTIFICATE_TRUSTED_NAME_MAXLEN] = {0};
cx_ecfp_384_public_key_t public_key = {0};
#endif

PRINTF(
"[%s] "
"=======================================================================================\n",
tag);
#ifdef HAVE_LEDGER_PKI
error = os_pki_get_info(&key_usage, trusted_name, &trusted_name_len, &public_key);
if ((error == 0) && (key_usage == keyUsageExp)) {
PRINTF("[%s] Certificate '%s' loaded for usage 0x%x (%s)\n",
Expand All @@ -57,9 +52,7 @@ int check_signature_with_pubkey(const char *tag,
goto end;
#endif
}
} else
#endif
{
} else {
PRINTF("[%s] ********** No certificate loaded. Using legacy path **********\n", tag);
CX_CHECK(cx_ecfp_init_public_key_no_throw(CX_CURVE_256K1, PubKey, keyLen, &verif_key));
if (!cx_ecdsa_verify_no_throw(&verif_key, buffer, bufLen, signature, sigLen)) {
Expand Down
Loading
Loading