with all security checks in place, the code is now accepting protocol_tx outputs as valid in-wallet; only the asset_type is misreported now

This commit is contained in:
Some Random Crypto Guy
2023-11-27 23:06:35 +00:00
parent be8e0f7327
commit ccdbfbe397
16 changed files with 586 additions and 842 deletions
+13 -12
View File
@@ -120,8 +120,8 @@ namespace hw {
/* SUB ADDRESS */
/* ======================================================================= */
bool device_default::derive_subaddress_public_key(const crypto::public_key &out_key, const crypto::key_derivation &derivation, const std::size_t output_index, crypto::public_key &derived_key) {
return crypto::wallet::derive_subaddress_public_key(out_key, derivation, output_index,derived_key);
bool device_default::derive_subaddress_public_key(const crypto::public_key &out_key, const crypto::key_derivation &derivation, const crypto::hash& uniqueness, crypto::public_key &derived_key) {
return crypto::wallet::derive_subaddress_public_key(out_key, derivation, uniqueness, derived_key);
}
crypto::public_key device_default::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) {
@@ -240,18 +240,18 @@ namespace hw {
return crypto::wallet::generate_key_derivation(key1, key2, derivation);
}
bool device_default::derivation_to_scalar(const crypto::key_derivation &derivation, const size_t output_index, crypto::ec_scalar &res){
crypto::derivation_to_scalar(derivation,output_index, res);
bool device_default::derivation_to_scalar(const crypto::key_derivation &derivation, const crypto::hash& uniqueness, crypto::ec_scalar &res){
crypto::derivation_to_scalar(derivation, uniqueness, res);
return true;
}
bool device_default::derive_secret_key(const crypto::key_derivation &derivation, const std::size_t output_index, const crypto::secret_key &base, crypto::secret_key &derived_key){
crypto::derive_secret_key(derivation, output_index, base, derived_key);
bool device_default::derive_secret_key(const crypto::key_derivation &derivation, const crypto::hash& uniqueness, const crypto::secret_key &base, crypto::secret_key &derived_key){
crypto::derive_secret_key(derivation, uniqueness, base, derived_key);
return true;
}
bool device_default::derive_public_key(const crypto::key_derivation &derivation, const std::size_t output_index, const crypto::public_key &base, crypto::public_key &derived_key){
return crypto::derive_public_key(derivation, output_index, base, derived_key);
bool device_default::derive_public_key(const crypto::key_derivation &derivation, const crypto::hash& uniqueness, const crypto::public_key &base, crypto::public_key &derived_key){
return crypto::derive_public_key(derivation, uniqueness, base, derived_key);
}
bool device_default::secret_key_to_public_key(const crypto::secret_key &sec, crypto::public_key &pub) {
@@ -297,7 +297,8 @@ namespace hw {
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,
const bool use_view_tags, crypto::view_tag &view_tag) {
const bool use_view_tags, crypto::view_tag &view_tag,
const crypto::hash& uniqueness) {
crypto::key_derivation derivation;
@@ -334,7 +335,7 @@ namespace hw {
if (tx_version > 1)
{
crypto::secret_key scalar1;
derivation_to_scalar(derivation, output_index, scalar1);
derivation_to_scalar(derivation, uniqueness, scalar1);
amount_keys.push_back(rct::sk2rct(scalar1));
}
@@ -343,8 +344,8 @@ namespace hw {
derive_view_tag(derivation, output_index, view_tag);
}
r = derive_public_key(derivation, output_index, dst_entr.addr.m_spend_public_key, out_eph_public_key);
CHECK_AND_ASSERT_MES(r, false, "at creation outs: failed to derive_public_key(" << derivation << ", " << output_index << ", "<< dst_entr.addr.m_spend_public_key << ")");
r = derive_public_key(derivation, uniqueness, dst_entr.addr.m_spend_public_key, out_eph_public_key);
CHECK_AND_ASSERT_MES(r, false, "at creation outs: failed to derive_public_key(" << derivation << ", " << uniqueness << ", "<< dst_entr.addr.m_spend_public_key << ")");
return r;
}