diff options
author | cslashm <cslashm@gmail.com> | 2019-09-25 14:31:14 +0200 |
---|---|---|
committer | cslashm <cslashm@gmail.com> | 2019-10-03 16:01:34 +0200 |
commit | d25acd7a1dbd05b24fba13fc4910886948ab90ba (patch) | |
tree | 41b87143c68535c432a67f233c80c8834f0aed5e /src/cryptonote_core | |
parent | Merge pull request #5549 (diff) | |
download | monero-d25acd7a1dbd05b24fba13fc4910886948ab90ba.tar.xz |
Add hmac over encrypted value during transaction
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/cryptonote_tx_utils.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index d2e022347..3e1b4e97f 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -612,23 +612,27 @@ namespace cryptonote { hw::device &hwdev = sender_account_keys.get_device(); hwdev.open_tx(tx_key); + try { + // figure out if we need to make additional tx pubkeys + size_t num_stdaddresses = 0; + size_t num_subaddresses = 0; + account_public_address single_dest_subaddress; + classify_addresses(destinations, change_addr, num_stdaddresses, num_subaddresses, single_dest_subaddress); + bool need_additional_txkeys = num_subaddresses > 0 && (num_stdaddresses > 0 || num_subaddresses > 1); + if (need_additional_txkeys) + { + additional_tx_keys.clear(); + for (const auto &d: destinations) + additional_tx_keys.push_back(keypair::generate(sender_account_keys.get_device()).sec); + } - // figure out if we need to make additional tx pubkeys - size_t num_stdaddresses = 0; - size_t num_subaddresses = 0; - account_public_address single_dest_subaddress; - classify_addresses(destinations, change_addr, num_stdaddresses, num_subaddresses, single_dest_subaddress); - bool need_additional_txkeys = num_subaddresses > 0 && (num_stdaddresses > 0 || num_subaddresses > 1); - if (need_additional_txkeys) - { - additional_tx_keys.clear(); - for (const auto &d: destinations) - additional_tx_keys.push_back(keypair::generate(sender_account_keys.get_device()).sec); + bool r = construct_tx_with_tx_key(sender_account_keys, subaddresses, sources, destinations, change_addr, extra, tx, unlock_time, tx_key, additional_tx_keys, rct, rct_config, msout); + hwdev.close_tx(); + return r; + } catch(...) { + hwdev.close_tx(); + throw; } - - bool r = construct_tx_with_tx_key(sender_account_keys, subaddresses, sources, destinations, change_addr, extra, tx, unlock_time, tx_key, additional_tx_keys, rct, rct_config, msout); - hwdev.close_tx(); - return r; } //--------------------------------------------------------------- bool construct_tx(const account_keys& sender_account_keys, std::vector<tx_source_entry>& sources, const std::vector<tx_destination_entry>& destinations, const boost::optional<cryptonote::account_public_address>& change_addr, const std::vector<uint8_t> &extra, transaction& tx, uint64_t unlock_time) |