mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 05:13:25 +01:00
device: made function prototypes consistent with pre-#3303 codebase
This commit is contained in:
parent
a03d34f4e1
commit
c9b38b4765
@ -35,15 +35,11 @@
|
|||||||
namespace crypto {
|
namespace crypto {
|
||||||
|
|
||||||
secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key, bool recover, hw::device &hwdev) {
|
secret_key generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key, bool recover, hw::device &hwdev) {
|
||||||
secret_key rng;
|
return hwdev.generate_keys(pub, sec, recovery_key, recover);
|
||||||
hwdev.generate_keys(pub, sec, recovery_key, recover, rng);
|
|
||||||
return rng;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
secret_key generate_keys(public_key &pub, secret_key &sec, hw::device &hwdev) {
|
secret_key generate_keys(public_key &pub, secret_key &sec, hw::device &hwdev) {
|
||||||
secret_key rng;
|
return hwdev.generate_keys(pub, sec, secret_key(), false);
|
||||||
hwdev.generate_keys(pub, sec, secret_key(), false, rng);
|
|
||||||
return rng;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,9 +185,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
crypto::secret_key get_subaddress_secret_key(const crypto::secret_key& a, const subaddress_index& index, hw::device &hwdev)
|
crypto::secret_key get_subaddress_secret_key(const crypto::secret_key& a, const subaddress_index& index, hw::device &hwdev)
|
||||||
{
|
{
|
||||||
crypto::secret_key m;
|
return hwdev.get_subaddress_secret_key(a, index);
|
||||||
hwdev.get_subaddress_secret_key(a, index, m);
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
@ -232,9 +230,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
std::vector<crypto::public_key> get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, hw::device &hwdev)
|
std::vector<crypto::public_key> get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, hw::device &hwdev)
|
||||||
{
|
{
|
||||||
std::vector<crypto::public_key> pkeys;
|
return hwdev.get_subaddress_spend_public_keys(keys, account, begin, end);
|
||||||
hwdev.get_subaddress_spend_public_keys(keys, account, begin, end, pkeys);
|
|
||||||
return pkeys;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
@ -282,7 +278,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hwdev.get_subaddress_secret_key(ack.m_view_secret_key, received_index, subaddr_sk);
|
subaddr_sk = hwdev.get_subaddress_secret_key(ack.m_view_secret_key, received_index);
|
||||||
hwdev.sc_secret_add(scalar_step2, scalar_step1,subaddr_sk);
|
hwdev.sc_secret_add(scalar_step2, scalar_step1,subaddr_sk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,10 +109,10 @@ namespace hw {
|
|||||||
/* SUB ADDRESS */
|
/* SUB ADDRESS */
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
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;
|
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;
|
||||||
virtual bool get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index, crypto::public_key &D) = 0;
|
virtual crypto::public_key get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index) = 0;
|
||||||
virtual bool get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, std::vector<crypto::public_key> &pkeys) = 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;
|
||||||
virtual bool get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, cryptonote::account_public_address &address) = 0;
|
virtual cryptonote::account_public_address get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) = 0;
|
||||||
virtual bool get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index, crypto::secret_key &sub_sec) = 0;
|
virtual crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) = 0;
|
||||||
|
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
/* DERIVATION & KEY */
|
/* DERIVATION & KEY */
|
||||||
@ -121,7 +121,7 @@ namespace hw {
|
|||||||
virtual bool scalarmultKey(rct::key & aP, const rct::key &P, const rct::key &a) = 0;
|
virtual bool scalarmultKey(rct::key & aP, const rct::key &P, const rct::key &a) = 0;
|
||||||
virtual bool scalarmultBase(rct::key &aG, const rct::key &a) = 0;
|
virtual bool scalarmultBase(rct::key &aG, const rct::key &a) = 0;
|
||||||
virtual bool sc_secret_add( crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b) = 0;
|
virtual bool sc_secret_add( crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b) = 0;
|
||||||
virtual bool generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover, crypto::secret_key &rng) = 0;
|
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 generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) = 0;
|
virtual bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) = 0;
|
||||||
virtual bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res) = 0;
|
virtual bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res) = 0;
|
||||||
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 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;
|
||||||
@ -129,6 +129,21 @@ namespace hw {
|
|||||||
virtual bool secret_key_to_public_key(const crypto::secret_key &sec, crypto::public_key &pub) = 0;
|
virtual bool secret_key_to_public_key(const crypto::secret_key &sec, crypto::public_key &pub) = 0;
|
||||||
virtual bool generate_key_image(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_image &image) = 0;
|
virtual bool generate_key_image(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_image &image) = 0;
|
||||||
|
|
||||||
|
// alternative prototypes available in libringct
|
||||||
|
rct::key scalarmultKey(const rct::key &P, const rct::key &a)
|
||||||
|
{
|
||||||
|
rct::key aP;
|
||||||
|
scalarmultKey(aP, P, a);
|
||||||
|
return aP;
|
||||||
|
}
|
||||||
|
|
||||||
|
rct::key scalarmultBase(const rct::key &a)
|
||||||
|
{
|
||||||
|
rct::key aG;
|
||||||
|
scalarmultBase(aG, a);
|
||||||
|
return aG;
|
||||||
|
}
|
||||||
|
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
/* TRANSACTION */
|
/* TRANSACTION */
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
@ -137,7 +152,12 @@ namespace hw {
|
|||||||
|
|
||||||
virtual bool set_signature_mode(unsigned int sig_mode) = 0;
|
virtual bool set_signature_mode(unsigned int sig_mode) = 0;
|
||||||
|
|
||||||
virtual bool encrypt_payment_id(const crypto::public_key &public_key, const crypto::secret_key &secret_key, crypto::hash8 &payment_id ) = 0;
|
virtual bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) = 0;
|
||||||
|
bool decrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key)
|
||||||
|
{
|
||||||
|
// Encryption and decryption are the same operation (xor with a key)
|
||||||
|
return encrypt_payment_id(payment_id, public_key, secret_key);
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) = 0;
|
virtual bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) = 0;
|
||||||
virtual bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) = 0;
|
virtual bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) = 0;
|
||||||
|
@ -99,24 +99,20 @@ namespace hw {
|
|||||||
return crypto::derive_subaddress_public_key(out_key, derivation, output_index,derived_key);
|
return crypto::derive_subaddress_public_key(out_key, derivation, output_index,derived_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_default::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, crypto::public_key &D) {
|
crypto::public_key device_default::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
|
||||||
D = cryptonote::get_subaddress_spend_public_key(keys,index);
|
return cryptonote::get_subaddress_spend_public_key(keys,index);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_default::get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, std::vector<crypto::public_key> &pkeys) {
|
std::vector<crypto::public_key> device_default::get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end) {
|
||||||
pkeys = cryptonote::get_subaddress_spend_public_keys(keys, account, begin, end);
|
return cryptonote::get_subaddress_spend_public_keys(keys, account, begin, end);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_default::get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, cryptonote::account_public_address &address) {
|
cryptonote::account_public_address device_default::get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
|
||||||
address = cryptonote::get_subaddress(keys,index);
|
return cryptonote::get_subaddress(keys,index);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_default::get_subaddress_secret_key(const crypto::secret_key &a, const cryptonote::subaddress_index &index, crypto::secret_key &m) {
|
crypto::secret_key device_default::get_subaddress_secret_key(const crypto::secret_key &a, const cryptonote::subaddress_index &index) {
|
||||||
m = cryptonote::get_subaddress_secret_key(a,index);
|
return cryptonote::get_subaddress_secret_key(a,index);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
@ -142,9 +138,8 @@ namespace hw {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_default::generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover, crypto::secret_key &rng) {
|
crypto::secret_key device_default::generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover) {
|
||||||
rng = crypto::generate_keys(pub, sec, recovery_key, recover);
|
return crypto::generate_keys(pub, sec, recovery_key, recover);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_default::generate_key_derivation(const crypto::public_key &key1, const crypto::secret_key &key2, crypto::key_derivation &derivation) {
|
bool device_default::generate_key_derivation(const crypto::public_key &key1, const crypto::secret_key &key2, crypto::key_derivation &derivation) {
|
||||||
@ -194,7 +189,7 @@ namespace hw {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_default::encrypt_payment_id(const crypto::public_key &public_key, const crypto::secret_key &secret_key, crypto::hash8 &payment_id ) {
|
bool device_default::encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) {
|
||||||
return cryptonote::encrypt_payment_id(payment_id, public_key, secret_key);
|
return cryptonote::encrypt_payment_id(payment_id, public_key, secret_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,10 +70,10 @@ namespace hw {
|
|||||||
/* SUB ADDRESS */
|
/* SUB ADDRESS */
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
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) override;
|
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) override;
|
||||||
bool get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index, crypto::public_key &D) override;
|
crypto::public_key get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index) override;
|
||||||
bool get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, std::vector<crypto::public_key> &pkeys) override;
|
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;
|
||||||
bool get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, cryptonote::account_public_address &address) override;
|
cryptonote::account_public_address get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) override;
|
||||||
bool get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index, crypto::secret_key &sub_sec) override;
|
crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) override;
|
||||||
|
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
/* DERIVATION & KEY */
|
/* DERIVATION & KEY */
|
||||||
@ -82,7 +82,7 @@ namespace hw {
|
|||||||
bool scalarmultKey(rct::key & aP, const rct::key &P, const rct::key &a) override;
|
bool scalarmultKey(rct::key & aP, const rct::key &P, const rct::key &a) override;
|
||||||
bool scalarmultBase(rct::key &aG, const rct::key &a) override;
|
bool scalarmultBase(rct::key &aG, const rct::key &a) override;
|
||||||
bool sc_secret_add(crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b) override;
|
bool sc_secret_add(crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b) override;
|
||||||
bool generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover, crypto::secret_key &rng) override;
|
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) override;
|
||||||
bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) override;
|
bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) override;
|
||||||
bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res) override;
|
bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res) override;
|
||||||
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) override;
|
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) override;
|
||||||
@ -100,7 +100,7 @@ namespace hw {
|
|||||||
//bool get_additional_key(const bool subaddr, cryptonote::keypair &additional_txkey) override;
|
//bool get_additional_key(const bool subaddr, cryptonote::keypair &additional_txkey) override;
|
||||||
bool set_signature_mode(unsigned int sig_mode) override;
|
bool set_signature_mode(unsigned int sig_mode) override;
|
||||||
|
|
||||||
bool encrypt_payment_id(const crypto::public_key &public_key, const crypto::secret_key &secret_key, crypto::hash8 &payment_id ) override;
|
bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) override;
|
||||||
|
|
||||||
bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) override;
|
bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) override;
|
||||||
bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) override;
|
bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) override;
|
||||||
|
@ -593,7 +593,8 @@ namespace hw {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_ledger::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, crypto::public_key &D) {
|
crypto::public_key device_ledger::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
|
||||||
|
crypto::public_key D;
|
||||||
lock_device();
|
lock_device();
|
||||||
try {
|
try {
|
||||||
int offset =0;
|
int offset =0;
|
||||||
@ -646,21 +647,23 @@ namespace hw {
|
|||||||
unlock_device();
|
unlock_device();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return true;
|
return D;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_ledger::get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, std::vector<crypto::public_key> &pkeys) {
|
std::vector<crypto::public_key> device_ledger::get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end) {
|
||||||
|
std::vector<crypto::public_key> pkeys;
|
||||||
cryptonote::subaddress_index index = {account, begin};
|
cryptonote::subaddress_index index = {account, begin};
|
||||||
crypto::public_key D;
|
crypto::public_key D;
|
||||||
for (uint32_t idx = begin; idx < end; ++idx) {
|
for (uint32_t idx = begin; idx < end; ++idx) {
|
||||||
index.minor = idx;
|
index.minor = idx;
|
||||||
this->get_subaddress_spend_public_key(keys, index, D);
|
D = this->get_subaddress_spend_public_key(keys, index);
|
||||||
pkeys.push_back(D);
|
pkeys.push_back(D);
|
||||||
}
|
}
|
||||||
return true;
|
return pkeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_ledger::get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, cryptonote::account_public_address &address) {
|
cryptonote::account_public_address device_ledger::get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
|
||||||
|
cryptonote::account_public_address address;
|
||||||
lock_device();
|
lock_device();
|
||||||
try {
|
try {
|
||||||
int offset =0;
|
int offset =0;
|
||||||
@ -717,10 +720,11 @@ namespace hw {
|
|||||||
unlock_device();
|
unlock_device();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return true;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_ledger::get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index, crypto::secret_key &sub_sec) {
|
crypto::secret_key device_ledger::get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) {
|
||||||
|
crypto::secret_key sub_sec;
|
||||||
lock_device();
|
lock_device();
|
||||||
try {
|
try {
|
||||||
int offset =0;
|
int offset =0;
|
||||||
@ -771,7 +775,7 @@ namespace hw {
|
|||||||
unlock_device();
|
unlock_device();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return true;
|
return sub_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
@ -979,7 +983,7 @@ namespace hw {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_ledger::generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover, crypto::secret_key &rng) {
|
crypto::secret_key device_ledger::generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover) {
|
||||||
if (recover) {
|
if (recover) {
|
||||||
throw std::runtime_error("device generate key does not support recover");
|
throw std::runtime_error("device generate key does not support recover");
|
||||||
}
|
}
|
||||||
@ -1030,7 +1034,7 @@ namespace hw {
|
|||||||
unlock_device();
|
unlock_device();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return true;
|
return sec;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1457,7 +1461,7 @@ namespace hw {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool device_ledger::encrypt_payment_id(const crypto::public_key &public_key, const crypto::secret_key &secret_key, crypto::hash8 &payment_id) {
|
bool device_ledger::encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) {
|
||||||
lock_device();
|
lock_device();
|
||||||
try {
|
try {
|
||||||
int offset =0;
|
int offset =0;
|
||||||
|
@ -142,10 +142,10 @@ namespace hw {
|
|||||||
/* SUB ADDRESS */
|
/* SUB ADDRESS */
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
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) override;
|
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) override;
|
||||||
bool get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index, crypto::public_key &D) override;
|
crypto::public_key get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index& index) override;
|
||||||
bool get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end, std::vector<crypto::public_key> &pkeys) override;
|
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;
|
||||||
bool get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index, cryptonote::account_public_address &address) override;
|
cryptonote::account_public_address get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) override;
|
||||||
bool get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index, crypto::secret_key &sub_sec) override;
|
crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) override;
|
||||||
|
|
||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
/* DERIVATION & KEY */
|
/* DERIVATION & KEY */
|
||||||
@ -154,7 +154,7 @@ namespace hw {
|
|||||||
bool scalarmultKey(rct::key & aP, const rct::key &P, const rct::key &a) override;
|
bool scalarmultKey(rct::key & aP, const rct::key &P, const rct::key &a) override;
|
||||||
bool scalarmultBase(rct::key &aG, const rct::key &a) override;
|
bool scalarmultBase(rct::key &aG, const rct::key &a) override;
|
||||||
bool sc_secret_add(crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b) override;
|
bool sc_secret_add(crypto::secret_key &r, const crypto::secret_key &a, const crypto::secret_key &b) override;
|
||||||
bool generate_keys(crypto::public_key &pub, crypto::secret_key &sec, const crypto::secret_key& recovery_key, bool recover, crypto::secret_key &rng) override;
|
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) override;
|
||||||
bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) override;
|
bool generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) override;
|
||||||
bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res) override;
|
bool derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res) override;
|
||||||
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) override;
|
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) override;
|
||||||
@ -170,7 +170,7 @@ namespace hw {
|
|||||||
|
|
||||||
bool set_signature_mode(unsigned int sig_mode) override;
|
bool set_signature_mode(unsigned int sig_mode) override;
|
||||||
|
|
||||||
bool encrypt_payment_id(const crypto::public_key &public_key, const crypto::secret_key &secret_key, crypto::hash8 &payment_id ) override;
|
bool encrypt_payment_id(crypto::hash8 &payment_id, const crypto::public_key &public_key, const crypto::secret_key &secret_key) override;
|
||||||
|
|
||||||
bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) override;
|
bool ecdhEncode(rct::ecdhTuple & unmasked, const rct::key & sharedSec) override;
|
||||||
bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) override;
|
bool ecdhDecode(rct::ecdhTuple & masked, const rct::key & sharedSec) override;
|
||||||
|
@ -840,18 +840,14 @@ void wallet2::set_seed_language(const std::string &language)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
cryptonote::account_public_address wallet2::get_subaddress(const cryptonote::subaddress_index& index) const
|
cryptonote::account_public_address wallet2::get_subaddress(const cryptonote::subaddress_index& index) const
|
||||||
{
|
{
|
||||||
cryptonote::account_public_address address;
|
|
||||||
hw::device &hwdev = m_account.get_device();
|
hw::device &hwdev = m_account.get_device();
|
||||||
hwdev.get_subaddress(m_account.get_keys(), index,address);
|
return hwdev.get_subaddress(m_account.get_keys(), index);
|
||||||
return address;
|
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
crypto::public_key wallet2::get_subaddress_spend_public_key(const cryptonote::subaddress_index& index) const
|
crypto::public_key wallet2::get_subaddress_spend_public_key(const cryptonote::subaddress_index& index) const
|
||||||
{
|
{
|
||||||
crypto::public_key D ;
|
|
||||||
hw::device &hwdev = m_account.get_device();
|
hw::device &hwdev = m_account.get_device();
|
||||||
hwdev.get_subaddress_spend_public_key(m_account.get_keys(), index, D);
|
return hwdev.get_subaddress_spend_public_key(m_account.get_keys(), index);
|
||||||
return D;
|
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
std::string wallet2::get_subaddress_as_str(const cryptonote::subaddress_index& index) const
|
std::string wallet2::get_subaddress_as_str(const cryptonote::subaddress_index& index) const
|
||||||
|
Loading…
Reference in New Issue
Block a user