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

Fix standard plugin variant + null-check on parameters #510

Merged
merged 3 commits into from
Dec 7, 2023
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
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
Loading