Add display address

This commit is contained in:
cslashm 2019-09-28 14:03:51 +02:00
parent d25acd7a1d
commit 34f28a79bc
2 changed files with 24 additions and 1 deletions

View File

@ -197,9 +197,11 @@ namespace hw {
#define INS_RESET 0x02 #define INS_RESET 0x02
#define INS_GET_KEY 0x20 #define INS_GET_KEY 0x20
#define INS_DISPLAY_ADDRESS 0x21
#define INS_PUT_KEY 0x22 #define INS_PUT_KEY 0x22
#define INS_GET_CHACHA8_PREKEY 0x24 #define INS_GET_CHACHA8_PREKEY 0x24
#define INS_VERIFY_KEY 0x26 #define INS_VERIFY_KEY 0x26
#define INS_MANAGE_SEEDWORDS 0x28
#define INS_SECRET_KEY_TO_PUBLIC_KEY 0x30 #define INS_SECRET_KEY_TO_PUBLIC_KEY 0x30
#define INS_GEN_KEY_DERIVATION 0x32 #define INS_GEN_KEY_DERIVATION 0x32
@ -594,6 +596,27 @@ namespace hw {
return true; return true;
} }
void device_ledger::display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) {
AUTO_LOCK_CMD();
int offset = set_command_header_noopt(INS_DISPLAY_ADDRESS, payment_id?1:0);
//index
memmove(this->buffer_send+offset, &index, sizeof(cryptonote::subaddress_index));
offset +=8 ;
//payment ID
if (payment_id) {
memmove(this->buffer_send+offset, (*payment_id).data, 8);
} else {
memset(this->buffer_send+offset, 0, 8);
}
offset +=8;
this->buffer_send[4] = offset-5;
this->length_send = offset;
CHECK_AND_ASSERT_THROW_MES(this->exchange_wait_on_input() == 0, "Timeout/Error on display address.");
}
/* ======================================================================= */ /* ======================================================================= */
/* SUB ADDRESS */ /* SUB ADDRESS */
/* ======================================================================= */ /* ======================================================================= */

View File

@ -199,7 +199,7 @@ namespace hw {
bool get_public_address(cryptonote::account_public_address &pubkey) override; bool get_public_address(cryptonote::account_public_address &pubkey) override;
bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) override; bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) override;
bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) override; bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds) override;
void display_address(const cryptonote::subaddress_index& index, const boost::optional<crypto::hash8> &payment_id) override;
/* ======================================================================= */ /* ======================================================================= */
/* SUB ADDRESS */ /* SUB ADDRESS */