52 #ifndef USE_DEVICE_LEDGER 53 #define USE_DEVICE_LEDGER 1 56 #if !defined(HAVE_HIDAPI) 57 #undef USE_DEVICE_LEDGER 58 #define USE_DEVICE_LEDGER 0 62 #define WITH_DEVICE_LEDGER 68 struct account_public_address;
70 struct subaddress_index;
71 struct tx_destination_entry;
78 throw std::runtime_error(std::string("device function not supported: ")+ std::string(__FUNCTION__) + \ 79 std::string(" (device.hpp line ")+std::to_string(__LINE__)+std::string(").")); \ 93 explicit virtual operator bool()
const = 0;
111 virtual const std::string
get_name()
const = 0;
113 virtual bool init(
void) = 0;
116 virtual bool connect(
void) = 0;
127 virtual void lock(
void) = 0;
128 virtual void unlock(
void) = 0;
199 const bool &need_additional_txkeys,
const std::vector<crypto::secret_key> &additional_tx_keys,
200 std::vector<crypto::public_key> &additional_tx_public_keys,
201 std::vector<rct::key> &amount_keys,
221 std::map<std::string, std::unique_ptr<device>>
registry;
virtual device_type get_type() const =0
virtual bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key)=0
virtual bool secret_key_to_public_key(const crypto::secret_key &sec, crypto::public_key &pub)=0
virtual bool scalarmultKey(rct::key &aP, const rct::key &P, const rct::key &a)=0
static const key H
Definition: rctTypes.h:451
Definition: device.hpp:97
virtual bool verify_keys(const crypto::secret_key &secret_key, const crypto::public_key &public_key)=0
device_registry()
Definition: device.cpp:58
virtual bool generate_chacha_key(const cryptonote::account_keys &keys, crypto::chacha_key &key, uint64_t kdf_rounds)=0
virtual bool sc_secret_add(crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b)=0
virtual rct::key genCommitmentMask(const rct::key &amount_key)=0
device()
Definition: device.hpp:89
POD_CLASS key_derivation
Definition: crypto.h:85
virtual bool mlsag_prepare(const rct::key &H, const rct::key &xx, rct::key &a, rct::key &aG, rct::key &aHP, rct::key &rvII)=0
virtual bool ecdhEncode(rct::ecdhTuple &unmasked, const rct::key &sharedSec, bool short_amount)=0
device_mode
Definition: device.hpp:94
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:69
bool register_device(const std::string &device_name, device *hw_device)
Definition: device.cpp:100
virtual void lock(void)=0
Definition: rctTypes.h:125
bool register_device(const std::string &device_name, device *hw_device)
Definition: device.cpp:66
device & get_device(const std::string &device_descriptor)
Definition: device.cpp:76
virtual void unlock(void)=0
virtual bool set_name(const std::string &name)=0
virtual bool disconnect(void)=0
virtual bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation)=0
device & hwref
Definition: device.hpp:214
std::vector< key > keyV
Definition: rctTypes.h:88
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:224
std::string name
Definition: device.hpp:85
virtual 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)=0
Definition: device.hpp:102
virtual crypto::secret_key generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key &recovery_key=crypto::secret_key(), bool recover=false)=0
virtual bool derive_public_key(const crypto::key_derivation &derivation, const std::size_t output_index, const crypto::public_key &pub, crypto::public_key &derived_pub)=0
device_type
Definition: device.hpp:100
POD_CLASS ec_scalar
Definition: crypto.h:61
virtual bool get_public_address(cryptonote::account_public_address &pubkey)=0
device & get_device(const std::string &device_descriptor)
Definition: device.cpp:95
std::vector< ctkey > ctkeyV
Definition: rctTypes.h:100
Definition: rctTypes.h:78
rct::key scalarmultKey(const rct::key &P, const rct::key &a)
Definition: device.hpp:165
virtual bool derive_subaddress_public_key(const crypto::public_key &pub, const crypto::key_derivation &derivation, const std::size_t output_index, crypto::public_key &derived_pub)=0
int b
Definition: base.py:1
bool decrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key)
Definition: device.hpp:186
Definition: subaddress_index.h:38
virtual 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)=0
Definition: device.hpp:219
virtual bool generate_key_image(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_image &image)=0
Definition: device.cpp:38
virtual bool open_tx(crypto::secret_key &tx_key)=0
virtual bool conceal_derivation(crypto::key_derivation &derivation, const crypto::public_key &tx_pub_key, const std::vector< crypto::public_key > &additional_tx_pub_keys, const crypto::key_derivation &main_derivation, const std::vector< crypto::key_derivation > &additional_derivations)=0
Definition: device.hpp:96
Definition: device.hpp:83
virtual cryptonote::account_public_address get_subaddress(const cryptonote::account_keys &keys, const cryptonote::subaddress_index &index)=0
virtual ~device()
Definition: device.hpp:91
Definition: device.hpp:98
~reset_mode()
Definition: device.hpp:216
virtual bool close_tx(void)=0
POD_CLASS public_key
Definition: crypto.h:63
rct::key scalarmultBase(const rct::key &a)
Definition: device.hpp:172
virtual bool derive_secret_key(const crypto::key_derivation &derivation, const std::size_t output_index, const crypto::secret_key &sec, crypto::secret_key &derived_sec)=0
virtual bool mlsag_hash(const rct::keyV &long_message, rct::key &c)=0
virtual std::vector< crypto::public_key > get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end)=0
Definition: cryptonote_basic.h:400
POD_CLASS hash8
Definition: hash.h:52
virtual bool get_secret_keys(crypto::secret_key &viewkey, crypto::secret_key &spendkey)=0
virtual bool scalarmultBase(rct::key &aG, const rct::key &a)=0
POD_CLASS key_image
Definition: crypto.h:89
virtual bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res)=0
reset_mode(hw::device &dev)
Definition: device.hpp:215
string a
Definition: MakeCryptoOps.py:15
int bool
Definition: stdbool.h:35
Definition: cryptonote_tx_utils.h:74
virtual crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index)=0
Definition: device.hpp:95
Definition: device.hpp:213
virtual bool set_mode(device_mode mode)=0
virtual crypto::public_key get_subaddress_spend_public_key(const cryptonote::account_keys &keys, const cryptonote::subaddress_index &index)=0
virtual bool mlsag_sign(const rct::key &c, const rct::keyV &xx, const rct::keyV &alpha, const size_t rows, const size_t dsRows, rct::keyV &ss)=0
virtual bool connect(void)=0
device(const device &hwdev)
Definition: device.hpp:90
virtual const std::string get_name() const =0
Definition: device.hpp:103
virtual bool try_lock(void)=0
virtual bool init(void)=0
std::map< std::string, std::unique_ptr< device > > registry
Definition: device.hpp:221
int rows
Definition: crypto.h:73
virtual bool ecdhDecode(rct::ecdhTuple &masked, const rct::key &sharedSec, bool short_amount)=0