aboutsummaryrefslogtreecommitdiff
path: root/src/device/device_ledger.hpp
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2020-02-07 14:20:38 +0000
committerxiphon <xiphon@protonmail.com>2020-02-08 01:46:39 +0000
commit29b7cd1351d0f2c749d33744d4401cccc5145809 (patch)
tree65f4048df9cd19ba3311240fd07a63298b85f9cb /src/device/device_ledger.hpp
parentMerge pull request #6145 (diff)
downloadmonero-29b7cd1351d0f2c749d33744d4401cccc5145809.tar.xz
device_ledger: include status code name in error message
Diffstat (limited to '')
-rw-r--r--src/device/device_ledger.hpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp
index 05a26143a..e3e30fba8 100644
--- a/src/device/device_ledger.hpp
+++ b/src/device/device_ledger.hpp
@@ -58,6 +58,46 @@ namespace hw {
#ifdef WITH_DEVICE_LEDGER
+ // Origin: https://github.com/LedgerHQ/ledger-app-monero/blob/master/src/monero_types.h
+ #define SW_BYTES_REMAINING_00 0x6100
+ #define SW_WARNING_STATE_UNCHANGED 0x6200
+ #define SW_STATE_TERMINATED 0x6285
+ #define SW_MORE_DATA_AVAILABLE 0x6310
+ #define SW_WRONG_LENGTH 0x6700
+ #define SW_LOGICAL_CHANNEL_NOT_SUPPORTED 0x6881
+ #define SW_SECURE_MESSAGING_NOT_SUPPORTED 0x6882
+ #define SW_LAST_COMMAND_EXPECTED 0x6883
+ #define SW_COMMAND_CHAINING_NOT_SUPPORTED 0x6884
+ #define SW_SECURITY_LOAD_KEY 0x6900
+ #define SW_SECURITY_COMMITMENT_CONTROL 0x6911
+ #define SW_SECURITY_AMOUNT_CHAIN_CONTROL 0x6912
+ #define SW_SECURITY_COMMITMENT_CHAIN_CONTROL 0x6913
+ #define SW_SECURITY_OUTKEYS_CHAIN_CONTROL 0x6914
+ #define SW_SECURITY_MAXOUTPUT_REACHED 0x6915
+ #define SW_SECURITY_TRUSTED_INPUT 0x6916
+ #define SW_CLIENT_NOT_SUPPORTED 0x6930
+ #define SW_SECURITY_STATUS_NOT_SATISFIED 0x6982
+ #define SW_FILE_INVALID 0x6983
+ #define SW_PIN_BLOCKED 0x6983
+ #define SW_DATA_INVALID 0x6984
+ #define SW_CONDITIONS_NOT_SATISFIED 0x6985
+ #define SW_COMMAND_NOT_ALLOWED 0x6986
+ #define SW_APPLET_SELECT_FAILED 0x6999
+ #define SW_WRONG_DATA 0x6a80
+ #define SW_FUNC_NOT_SUPPORTED 0x6a81
+ #define SW_FILE_NOT_FOUND 0x6a82
+ #define SW_RECORD_NOT_FOUND 0x6a83
+ #define SW_FILE_FULL 0x6a84
+ #define SW_INCORRECT_P1P2 0x6a86
+ #define SW_REFERENCED_DATA_NOT_FOUND 0x6a88
+ #define SW_WRONG_P1P2 0x6b00
+ #define SW_CORRECT_LENGTH_00 0x6c00
+ #define SW_INS_NOT_SUPPORTED 0x6d00
+ #define SW_CLA_NOT_SUPPORTED 0x6e00
+ #define SW_UNKNOWN 0x6f00
+ #define SW_OK 0x9000
+ #define SW_ALGORITHM_UNSUPPORTED 0x9484
+
namespace {
bool apdu_verbose =true;
}
@@ -128,8 +168,8 @@ namespace hw {
unsigned int id;
void logCMD(void);
void logRESP(void);
- unsigned int exchange(unsigned int ok=0x9000, unsigned int mask=0xFFFF);
- unsigned int exchange_wait_on_input(unsigned int ok=0x9000, unsigned int mask=0xFFFF);
+ unsigned int exchange(unsigned int ok=SW_OK, unsigned int mask=0xFFFF);
+ unsigned int exchange_wait_on_input(unsigned int ok=SW_OK, unsigned int mask=0xFFFF);
void reset_buffer(void);
int set_command_header(unsigned char ins, unsigned char p1 = 0x00, unsigned char p2 = 0x00);
int set_command_header_noopt(unsigned char ins, unsigned char p1 = 0x00, unsigned char p2 = 0x00);