Skip to content

Commit

Permalink
Merge pull request #510 from LedgerHQ/fix/apa/standard_plugin_variant
Browse files Browse the repository at this point in the history
Fix standard plugin variant + null-check on parameters
  • Loading branch information
apaillier-ledger authored Dec 7, 2023
2 parents 0c263ca + cce3852 commit 97f17b2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src_plugin_sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
| :rotating_light: | Breaks build |
| :warning: | Breaks compatibility with app |

## [latest](/) - 2023/12/06
## [latest](/) - 2023/12/07

### Fixed

* standard\_plugin build ([this PR on the SDK](https://github.com/LedgerHQ/ledger-secure-sdk/pull/473) had broken it)
* Broken variant auto-setting in the standard\_plugin Makefile
* Missing null-check on parameters received by the plugins

### Changed

Expand Down
48 changes: 26 additions & 22 deletions src_plugin_sdk/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,32 @@ static void call_app_ethereum() {

// Function to dispatch calls from the ethereum app.
static void dispatch_call(int message, void *parameters) {
switch (message) {
case ETH_PLUGIN_INIT_CONTRACT:
handle_init_contract(parameters);
break;
case ETH_PLUGIN_PROVIDE_PARAMETER:
handle_provide_parameter(parameters);
break;
case ETH_PLUGIN_FINALIZE:
handle_finalize(parameters);
break;
case ETH_PLUGIN_PROVIDE_INFO:
handle_provide_token(parameters);
break;
case ETH_PLUGIN_QUERY_CONTRACT_ID:
handle_query_contract_id(parameters);
break;
case ETH_PLUGIN_QUERY_CONTRACT_UI:
handle_query_contract_ui(parameters);
break;
default:
PRINTF("Unhandled message %d\n", message);
break;
if (parameters != NULL) {
switch (message) {
case ETH_PLUGIN_INIT_CONTRACT:
handle_init_contract(parameters);
break;
case ETH_PLUGIN_PROVIDE_PARAMETER:
handle_provide_parameter(parameters);
break;
case ETH_PLUGIN_FINALIZE:
handle_finalize(parameters);
break;
case ETH_PLUGIN_PROVIDE_INFO:
handle_provide_token(parameters);
break;
case ETH_PLUGIN_QUERY_CONTRACT_ID:
handle_query_contract_id(parameters);
break;
case ETH_PLUGIN_QUERY_CONTRACT_UI:
handle_query_contract_ui(parameters);
break;
default:
PRINTF("Unhandled message %d\n", message);
break;
}
} else {
PRINTF("Received null parameters\n");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src_plugin_sdk/standard_plugin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CURVE_APP_LOAD_PARAMS = secp256k1
PATH_APP_LOAD_PARAMS ?= "44'/60'"

VARIANT_PARAM = COIN
VARIANTS_VALUES ?= $(NORMAL_NAME)
VARIANT_VALUES ?= $(NORMAL_NAME)

HAVE_APPLICATION_FLAG_LIBRARY = 1

Expand Down

0 comments on commit 97f17b2

Please sign in to comment.