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;
77 throw std::runtime_error(std::string("device function not supported: ")+ std::string(__FUNCTION__) + \ 78 std::string(" (device.hpp line ")+std::to_string(__LINE__)+std::string(").")); \ 92 explicit virtual operator bool()
const = 0;
110 virtual const std::string
get_name()
const = 0;
112 virtual bool init(
void) = 0;
115 virtual bool connect(
void) = 0;
126 virtual void lock(
void) = 0;
127 virtual void unlock(
void) = 0;
215 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:431
Definition: device.hpp:96
virtual bool verify_keys(const crypto::secret_key &secret_key, const crypto::public_key &public_key)=0
device_registry()
Definition: device.cpp:46
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
device()
Definition: device.hpp:88
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
device_mode
Definition: device.hpp:93
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:90
virtual void lock(void)=0
Definition: rctTypes.h:125
bool register_device(const std::string &device_name, device *hw_device)
Definition: device.cpp:53
device & get_device(const std::string &device_descriptor)
Definition: device.cpp:63
virtual void unlock(void)=0
virtual bool ecdhDecode(rct::ecdhTuple &masked, const rct::key &sharedSec)=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:208
std::vector< key > keyV
Definition: rctTypes.h:88
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:224
virtual bool add_output_key_mapping(const crypto::public_key &Aout, const crypto::public_key &Bout, const bool is_subaddress, const size_t real_output_index, const rct::key &amount_key, const crypto::public_key &out_eph_public_key)=0
std::string name
Definition: device.hpp:84
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:101
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:99
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:82
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:164
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:185
Definition: subaddress_index.h:38
Definition: device.hpp:213
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:95
Definition: device.hpp:82
virtual cryptonote::account_public_address get_subaddress(const cryptonote::account_keys &keys, const cryptonote::subaddress_index &index)=0
virtual ~device()
Definition: device.hpp:90
Definition: device.hpp:97
~reset_mode()
Definition: device.hpp:210
virtual bool close_tx(void)=0
POD_CLASS public_key
Definition: crypto.h:63
rct::key scalarmultBase(const rct::key &a)
Definition: device.hpp:171
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:209
string a
Definition: MakeCryptoOps.py:15
int bool
Definition: stdbool.h:35
virtual crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index)=0
Definition: device.hpp:94
Definition: device.hpp:207
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:89
virtual const std::string get_name() const =0
Definition: device.hpp:102
virtual bool try_lock(void)=0
virtual bool init(void)=0
virtual bool ecdhEncode(rct::ecdhTuple &unmasked, const rct::key &sharedSec)=0
std::map< std::string, std::unique_ptr< device > > registry
Definition: device.hpp:215
int rows
Definition: crypto.h:73