From edad008ed1d649eda899aaf8b12ec76f34926c90 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Tue, 21 Nov 2023 14:20:22 +0100 Subject: [PATCH] Fix signature generation for SET_EXTERNAL_PLUGIN in client --- client/src/ledger_app_clients/ethereum/client.py | 2 +- src_features/setExternalPlugin/cmd_setExternalPlugin.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/ledger_app_clients/ethereum/client.py b/client/src/ledger_app_clients/ethereum/client.py index 2ef41ff..6981f86 100644 --- a/client/src/ledger_app_clients/ethereum/client.py +++ b/client/src/ledger_app_clients/ethereum/client.py @@ -222,7 +222,7 @@ class EthAppClient: tmp = self._cmd_builder.set_external_plugin(plugin_name, contract_address, method_selelector, bytes()) # skip APDU header & empty sig - sig = sign_data(Key.SET_PLUGIN, tmp[5:-1]) + sig = sign_data(Key.CAL, tmp[5:]) return self._send(self._cmd_builder.set_external_plugin(plugin_name, contract_address, method_selelector, sig)) def personal_sign(self, path: str, msg: bytes): diff --git a/src_features/setExternalPlugin/cmd_setExternalPlugin.c b/src_features/setExternalPlugin/cmd_setExternalPlugin.c index 4a94356..49e827a 100644 --- a/src_features/setExternalPlugin/cmd_setExternalPlugin.c +++ b/src_features/setExternalPlugin/cmd_setExternalPlugin.c @@ -48,7 +48,9 @@ void handleSetExternalPlugin(uint8_t p1, workBuffer + payload_size, dataLength - payload_size)) { #ifndef HAVE_BYPASS_SIGNATURES - PRINTF("Invalid plugin signature %.*H\n", payload_size, workBuffer); + PRINTF("Invalid plugin signature %.*H\n", + dataLength - payload_size, + workBuffer + payload_size); THROW(0x6A80); #endif }