37 #include <boost/thread/mutex.hpp> 38 #include <boost/thread/recursive_mutex.hpp> 44 void register_all(std::map<std::string, std::unique_ptr<device>> ®istry);
46 #ifdef WITH_DEVICE_LEDGER 49 bool apdu_verbose =
true;
52 void set_apdu_verbose(
bool verbose);
59 bool is_change_address;
64 ABPkeys(
const rct::key& A,
const rct::key&
B,
const bool is_subaddr,
bool is_subaddress,
bool is_change_address,
size_t index,
const rct::key& P,
const rct::key& AK);
65 ABPkeys(
const ABPkeys& keys) ;
66 ABPkeys() {index=0;is_subaddress=
false;is_subaddress=
false;is_change_address=
false;}
71 std::vector<ABPkeys> ABP;
73 bool find(
const rct::key& P, ABPkeys& keys)
const;
74 void add(
const ABPkeys& keys);
79 #define BUFFER_SEND_SIZE 262 80 #define BUFFER_RECV_SIZE 262 85 mutable boost::recursive_mutex device_locker;
86 mutable boost::mutex command_locker;
89 hw::io::device_io_hid hw_device;
90 std::string full_name;
91 unsigned int length_send;
92 unsigned char buffer_send[BUFFER_SEND_SIZE];
93 unsigned int length_recv;
94 unsigned char buffer_recv[BUFFER_RECV_SIZE];
99 unsigned int exchange(
unsigned int ok=0x9000,
unsigned int mask=0xFFFF);
100 void reset_buffer(
void);
101 int set_command_header(
unsigned char ins,
unsigned char p1 = 0x00,
unsigned char p2 = 0x00);
102 int set_command_header_noopt(
unsigned char ins,
unsigned char p1 = 0x00,
unsigned char p2 = 0x00);
103 void send_simple(
unsigned char ins,
unsigned char p1 = 0x00);
111 const bool need_additional,
const size_t real_output_index,
118 #ifdef DEBUG_HWDEVICE 119 device *controle_device;
126 device_ledger(
const device_ledger &device) = delete ;
127 device_ledger& operator=(
const device_ledger &device) =
delete;
129 explicit operator bool()
const override {
return this->connected(); }
136 bool set_name(
const std::string &
name)
override;
138 const std::string get_name()
const override;
139 bool init(
void)
override;
140 bool release()
override;
141 bool connect(
void)
override;
142 bool disconnect()
override;
143 bool connected(
void)
const;
145 bool set_mode(device_mode mode)
override;
147 device_type get_type()
const override {
return device_type::LEDGER;};
152 void lock(
void)
override;
153 void unlock(
void)
override;
154 bool try_lock(
void)
override;
161 bool generate_chacha_key(
const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds)
override;
169 std::vector<crypto::public_key> get_subaddress_spend_public_keys(
const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end)
override;
204 const bool &need_additional_txkeys,
const std::vector<crypto::secret_key> &additional_tx_keys,
205 std::vector<crypto::public_key> &additional_tx_public_keys,
206 std::vector<rct::key> &amount_keys,
209 bool mlsag_prehash(
const std::string &blob,
size_t inputs_size,
size_t outputs_size,
const rct::keyV &hashes,
const rct::ctkeyV &outPk,
rct::key &prehash)
override;
215 bool close_tx(
void)
override;
220 #ifdef DEBUG_HWDEVICE 225 #endif //WITH_DEVICE_LEDGER void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
Definition: crypto.h:199
static const key H
Definition: rctTypes.h:451
void derive_secret_key(const key_derivation &derivation, std::size_t output_index, const secret_key &base, secret_key &derived_key)
Definition: crypto.h:202
static void init(std::string cache_filename)
Definition: blockchain_blackball.cpp:223
list B
Definition: base.py:26
POD_CLASS key_derivation
Definition: crypto.h:85
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:69
void register_all(std::map< std::string, std::unique_ptr< device >> ®istry)
Definition: device_ledger.cpp:1761
static rct::key scalarmultKey(const ge_p3 &P, const rct::key &a)
Definition: bulletproofs.cc:130
Definition: rctTypes.h:125
void ecdhEncode(ecdhTuple &unmasked, const key &sharedSec, bool v2)
Definition: rctOps.cpp:514
key genCommitmentMask(const key &sk)
Definition: rctOps.cpp:504
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
Definition: crypto.h:192
std::vector< key > keyV
Definition: rctTypes.h:88
void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image)
Definition: crypto.h:236
static void add(ge_p3 &p3, const ge_cached &other)
Definition: multiexp.cc:124
cryptonote::simple_wallet sw
Definition: simplewallet.cpp:82
POD_CLASS ec_scalar
Definition: crypto.h:61
bool derive_subaddress_public_key(const public_key &out_key, const key_derivation &derivation, std::size_t output_index, public_key &result)
Definition: crypto.h:206
std::vector< ctkey > ctkeyV
Definition: rctTypes.h:100
Definition: rctTypes.h:78
int b
Definition: base.py:1
Definition: subaddress_index.h:38
secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key &recovery_key=secret_key(), bool recover=false)
Definition: crypto.h:170
Definition: device.cpp:38
Definition: device.hpp:83
POD_CLASS public_key
Definition: crypto.h:63
void ecdhDecode(ecdhTuple &masked, const key &sharedSec, bool v2)
Definition: rctOps.cpp:529
void scalarmultBase(key &aG, const key &a)
Definition: rctOps.cpp:167
Definition: cryptonote_basic.h:400
POD_CLASS hash8
Definition: hash.h:52
POD_CLASS key_image
Definition: crypto.h:89
bool derive_public_key(const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
Definition: crypto.h:195
string a
Definition: MakeCryptoOps.py:15
int bool
Definition: stdbool.h:35
Definition: cryptonote_tx_utils.h:74
bool generate_output_ephemeral_keys(const size_t tx_version, const cryptonote::account_keys &sender_account_keys, const crypto::public_key &txkey_pub, const crypto::secret_key &tx_key, const cryptonote::tx_destination_entry &dst_entr, const boost::optional< cryptonote::account_public_address > &change_addr, const size_t output_index, const bool &need_additional_txkeys, const std::vector< crypto::secret_key > &additional_tx_keys, std::vector< crypto::public_key > &additional_tx_public_keys, std::vector< rct::key > &amount_keys, crypto::public_key &out_eph_public_key)
bool secret_key_to_public_key(const secret_key &sec, public_key &pub)
Definition: crypto.h:182
const char * name
Definition: simplewallet.cpp:284
int rows
Definition: crypto.h:73