From 12b97d91db2040bfa97ad611ed475455b7884fc2 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Mon, 4 Jul 2022 15:05:07 +0200 Subject: [PATCH] Added a global apdu response code variable --- src/apdu_constants.h | 11 +++++++++++ src/main.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/apdu_constants.h b/src/apdu_constants.h index 5bf1753..aeb2986 100644 --- a/src/apdu_constants.h +++ b/src/apdu_constants.h @@ -34,6 +34,15 @@ #define COMMON_CLA 0xB0 #define COMMON_INS_GET_WALLET_ID 0x04 +#define APDU_RESPONSE_OK 0x9000 +#define APDU_RESPONSE_INVALID_DATA 0x6a80 +#define APDU_RESPONSE_INSUFFICIENT_MEMORY 0x6a84 +#define APDU_RESPONSE_INVALID_INS 0x6d00 +#define APDU_RESPONSE_INVALID_P1_P2 0x6b00 +#define APDU_RESPONSE_CONDITION_NOT_SATISFIED 0x6985 +#define APDU_RESPONSE_REF_DATA_NOT_USABLE 0x6a88 + + #ifdef HAVE_STARKWARE #define STARKWARE_CLA 0xF0 @@ -180,4 +189,6 @@ bool handle_eip712_sign(const uint8_t *const apdu_buf); bool handle_eip712_filtering(const uint8_t *const apdu_buf); #endif // HAVE_EIP712_FULL_SUPPORT +extern uint16_t apdu_response_code; + #endif // _APDU_CONSTANTS_H_ diff --git a/src/main.c b/src/main.c index 61baf06..708f2bf 100644 --- a/src/main.c +++ b/src/main.c @@ -50,6 +50,7 @@ strings_t strings; cx_sha3_t global_sha3; uint8_t appState; +uint16_t apdu_response_code; bool called_from_swap; pluginType_t pluginType; #ifdef HAVE_STARKWARE @@ -70,7 +71,7 @@ const internalStorage_t N_storage_real; chain_config_t *chainConfig; void reset_app_context() { - // PRINTF("!!RESET_APP_CONTEXT\n"); + //PRINTF("!!RESET_APP_CONTEXT\n"); appState = APP_STATE_IDLE; called_from_swap = false; pluginType = OLD_INTERNAL;