37 #include <boost/thread/mutex.hpp> 38 #include <boost/thread/recursive_mutex.hpp> 46 #ifdef WITH_DEVICE_LEDGER 49 bool apdu_verbose =
true;
52 void set_apdu_verbose(
bool verbose);
63 ABPkeys(
const ABPkeys& keys) ;
64 ABPkeys() {index=0;is_subaddress=
false;}
69 std::vector<ABPkeys> ABP;
71 bool find(
const rct::key& P, ABPkeys& keys)
const;
72 void add(
const ABPkeys& keys);
77 #define BUFFER_SEND_SIZE 262 78 #define BUFFER_RECV_SIZE 262 83 mutable boost::recursive_mutex device_locker;
84 mutable boost::mutex command_locker;
87 hw::io::device_io_hid hw_device;
88 std::string full_name;
89 unsigned int length_send;
90 unsigned char buffer_send[BUFFER_SEND_SIZE];
91 unsigned int length_recv;
92 unsigned char buffer_recv[BUFFER_RECV_SIZE];
97 unsigned int exchange(
unsigned int ok=0x9000,
unsigned int mask=0xFFFF);
98 void reset_buffer(
void);
99 int set_command_header(
unsigned char ins,
unsigned char p1 = 0x00,
unsigned char p2 = 0x00);
100 int set_command_header_noopt(
unsigned char ins,
unsigned char p1 = 0x00,
unsigned char p2 = 0x00);
101 void send_simple(
unsigned char ins,
unsigned char p1 = 0x00);
114 #ifdef DEBUG_HWDEVICE 115 device *controle_device;
122 device_ledger(
const device_ledger &device) = delete ;
123 device_ledger& operator=(
const device_ledger &device) =
delete;
125 explicit operator bool()
const override {
return this->connected(); }
132 bool set_name(
const std::string &
name)
override;
134 const std::string get_name()
const override;
135 bool init(
void)
override;
136 bool release()
override;
137 bool connect(
void)
override;
138 bool disconnect()
override;
139 bool connected(
void)
const;
141 bool set_mode(device_mode mode)
override;
143 device_type get_type()
const override {
return device_type::LEDGER;};
148 void lock(
void)
override;
149 void unlock(
void)
override;
150 bool try_lock(
void)
override;
157 bool generate_chacha_key(
const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds)
override;
165 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;
200 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;
206 bool close_tx(
void)
override;
211 #ifdef DEBUG_HWDEVICE 216 #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:431
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
void ecdhEncode(ecdhTuple &unmasked, const key &sharedSec)
Definition: rctOps.cpp:490
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:1565
static rct::key scalarmultKey(const ge_p3 &P, const rct::key &a)
Definition: bulletproofs.cc:130
Definition: rctTypes.h:125
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
static std::unique_ptr< device_registry > registry
Definition: device.cpp:44
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:82
POD_CLASS public_key
Definition: crypto.h:63
void scalarmultBase(key &aG, const key &a)
Definition: rctOps.cpp:167
Definition: cryptonote_basic.h:400
POD_CLASS hash8
Definition: hash.h:52
void ecdhDecode(ecdhTuple &masked, const key &sharedSec)
Definition: rctOps.cpp:497
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
bool secret_key_to_public_key(const secret_key &sec, public_key &pub)
Definition: crypto.h:182
const char * name
Definition: simplewallet.cpp:319
int rows
Definition: crypto.h:73