Fix for Ledger protocol v3 (#670)
* update protocol to V3 for Monero App v1.6.0
This commit is contained in:
parent
f00da6ecda
commit
4431d74051
|
@ -17,12 +17,15 @@
|
|||
package com.m2049r.xmrwallet.ledger;
|
||||
|
||||
public enum Instruction {
|
||||
|
||||
INS_NONE(0x00),
|
||||
INS_RESET(0x02),
|
||||
INS_GET_KEY(0x20),
|
||||
INS_DISPLAY_ADDRESS(0x21),
|
||||
INS_PUT_KEY(0x22),
|
||||
INS_GET_CHACHA8_PREKEY(0x24),
|
||||
INS_VERIFY_KEY(0x26),
|
||||
INS_MANAGE_SEEDWORDS(0x28),
|
||||
|
||||
INS_SECRET_KEY_TO_PUBLIC_KEY(0x30),
|
||||
INS_GEN_KEY_DERIVATION(0x32),
|
||||
|
@ -30,6 +33,7 @@ public enum Instruction {
|
|||
INS_DERIVE_PUBLIC_KEY(0x36),
|
||||
INS_DERIVE_SECRET_KEY(0x38),
|
||||
INS_GEN_KEY_IMAGE(0x3A),
|
||||
|
||||
INS_SECRET_KEY_ADD(0x3C),
|
||||
INS_SECRET_KEY_SUB(0x3E),
|
||||
INS_GENERATE_KEYPAIR(0x40),
|
||||
|
@ -45,15 +49,20 @@ public enum Instruction {
|
|||
INS_SET_SIGNATURE_MODE(0x72),
|
||||
INS_GET_ADDITIONAL_KEY(0x74),
|
||||
INS_STEALTH(0x76),
|
||||
INS_GEN_COMMITMENT_MASK(0x77),
|
||||
INS_BLIND(0x78),
|
||||
INS_UNBLIND(0x7A),
|
||||
INS_GEN_TXOUT_KEYS(0x7B),
|
||||
INS_VALIDATE(0x7C),
|
||||
INS_PREFIX_HASH(0x7D),
|
||||
INS_MLSAG(0x7E),
|
||||
INS_CLOSE_TX(0x80),
|
||||
|
||||
INS_GET_RESPONSE(0xc0),
|
||||
INS_GET_TX_PROOF(0xA0),
|
||||
|
||||
INS_UNDEFINED(0xff);
|
||||
INS_GET_RESPONSE(0xC0),
|
||||
|
||||
INS_UNDEFINED(0xFF);
|
||||
|
||||
public static Instruction fromByte(byte n) {
|
||||
switch (n & 0xFF) {
|
||||
|
|
|
@ -42,11 +42,11 @@ public class Ledger {
|
|||
static public final int LOOKAHEAD_SUBADDRESSES = 20;
|
||||
static public final String SUBADDRESS_LOOKAHEAD = LOOKAHEAD_ACCOUNTS + ":" + LOOKAHEAD_SUBADDRESSES;
|
||||
|
||||
private static final byte PROTOCOL_VERSION = 0x02;
|
||||
private static final byte PROTOCOL_VERSION = 0x03;
|
||||
public static final int SW_OK = 0x9000;
|
||||
public static final int SW_INS_NOT_SUPPORTED = 0x6D00;
|
||||
public static final int OK[] = {SW_OK};
|
||||
public static final int MINIMUM_LEDGER_VERSION = (1 << 16) + (3 << 8) + (1); // 1.3.1
|
||||
public static final int MINIMUM_LEDGER_VERSION = (1 << 16) + (6 << 8) + (0); // 1.6.0
|
||||
|
||||
public static UsbDevice findDevice(UsbManager usbManager) {
|
||||
if (!ENABLED) return null;
|
||||
|
|
|
@ -51,6 +51,7 @@ public class LedgerProgressDialog extends ProgressDialog implements Ledger.Liste
|
|||
switch (ins) {
|
||||
case INS_RESET: // ledger may ask for confirmation - maybe a bug?
|
||||
case INS_GET_KEY: // ledger asks for confirmation to send keys
|
||||
case INS_DISPLAY_ADDRESS:
|
||||
setIndeterminate(true);
|
||||
setMessage(getContext().getString(R.string.progress_ledger_confirm));
|
||||
break;
|
||||
|
@ -102,6 +103,11 @@ public class LedgerProgressDialog extends ProgressDialog implements Ledger.Liste
|
|||
setMessage(getContext().getString(R.string.progress_ledger_mlsag));
|
||||
}
|
||||
break;
|
||||
case INS_PREFIX_HASH:
|
||||
if ((apdu[2] != 1) || (apdu[3] != 0)) break;
|
||||
setIndeterminate(true);
|
||||
setMessage(getContext().getString(R.string.progress_ledger_confirm));
|
||||
break;
|
||||
case INS_VALIDATE:
|
||||
if ((apdu[2] != 1) || (apdu[3] != 1)) break;
|
||||
validate = true;
|
||||
|
|
Loading…
Reference in New Issue