diff --git a/Makefile b/Makefile index 6e4cb944..1926d4dd 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # **************************************************************************** -# Ledger App Boilerplate +# Ledger Ethereum Plugin Boilerplate # (c) 2023 Ledger SAS. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,118 +15,12 @@ # limitations under the License. # **************************************************************************** -ifeq ($(BOLOS_SDK),) -$(error Environment variable BOLOS_SDK is not set) -endif - -include $(BOLOS_SDK)/Makefile.defines - -######################################## -# Mandatory configuration # -######################################## # EDIT THIS: Application name -# Will be displayed on screen by the Ethereum app APPNAME = "PluginBoilerplate" # Application version APPVERSION_M = 1 APPVERSION_N = 0 APPVERSION_P = 0 -APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" - -# Initialize plugin SDK submodule if needed -ifneq ($(shell git submodule status | grep '^[-+]'),) -$(info INFO: Need to reinitialize git submodules) -$(shell git submodule update --init) -endif - -ifeq ($(ETHEREUM_PLUGIN_SDK),) -ETHEREUM_PLUGIN_SDK=ethereum-plugin-sdk -endif - -# Application source files -APP_SOURCE_PATH += src $(ETHEREUM_PLUGIN_SDK) - -# Application icons following guidelines: -# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon -ICON_ID = $(shell echo -n "$(APPNAME)" | tr " " "_" | tr "[:upper:]" "[:lower:]") -ICON_NANOS = icons/nanos_app_$(ICON_ID).gif -ICON_NANOX = icons/nanox_app_$(ICON_ID).gif -ICON_NANOSP = $(ICON_NANOX) -ICON_STAX = icons/stax_app_$(ICON_ID).gif - -ifeq ($(TARGET_NAME),TARGET_STAX) - DEFINES += ICONGLYPH=C_stax_$(ICON_ID)_64px - DEFINES += ICONBITMAP=C_stax_$(ICON_ID)_64px_bitmap -endif - -# 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 = ` -CURVE_APP_LOAD_PARAMS = secp256k1 - -# 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'/60'" # purpose=coin(44) / coin_type=Testnet(1) - -# Setting to allow building variant applications -# - is the name of the parameter which should be set -# to specify the variant that should be build. -# - 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 -# EDIT THIS: Plugin ticker name -VARIANT_VALUES = pbol - -# 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 -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 - -# To allow custom size declaration -#DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1 - -# Will set all the following disablers -#DISABLE_STANDARD_APP_DEFINES = 1 - -DISABLE_STANDARD_SNPRINTF = 1 -#DISABLE_STANDARD_USB = 1 -DISABLE_STANDARD_WEBUSB = 1 -DISABLE_STANDARD_BAGL_UX_FLOW = 1 -include $(BOLOS_SDK)/Makefile.standard_app +include ethereum-plugin-sdk/standard_plugin.mk diff --git a/fuzzing/CMakeLists.txt b/fuzzing/CMakeLists.txt index 41f2bc95..6abb0b8f 100644 --- a/fuzzing/CMakeLists.txt +++ b/fuzzing/CMakeLists.txt @@ -93,7 +93,7 @@ add_executable(fuzz # Ethereum SDK ${ETH_DIR}/include/eth_internals.c - ${ETH_DIR}/include/utils.c + ${ETH_DIR}/include/plugin_utils.c # cxng ${BOLOS_SDK}/lib_cxng/src/cx_hash.c @@ -106,4 +106,4 @@ add_executable(fuzz ) target_compile_options(fuzz PUBLIC ${COMPILATION_FLAGS}) -target_link_options(fuzz PUBLIC ${COMPILATION_FLAGS}) \ No newline at end of file +target_link_options(fuzz PUBLIC ${COMPILATION_FLAGS}) diff --git a/src/handle_init_contract.c b/src/handle_init_contract.c index 331d854e..bdb15573 100644 --- a/src/handle_init_contract.c +++ b/src/handle_init_contract.c @@ -1,5 +1,5 @@ +#include "plugin_utils.h" #include "plugin.h" -#include "utils.h" // Called once to init. void handle_init_contract(ethPluginInitContract_t *msg) {