aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-14 15:02:14 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-14 15:02:14 +0200
commit256a1d9ead8eab202c06d4bc262a5f1c20237bbe (patch)
tree27db39b45079104409bb186a74fe04733797bf4b
parentMerge pull request #2670 (diff)
parentsubaddress: remove unneeded scalarmultBase (diff)
downloadmonero-256a1d9ead8eab202c06d4bc262a5f1c20237bbe.tar.xz
Merge pull request #2675
00cc1fdd subaddress: remove unneeded scalarmultBase (kenshi84)
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
index 96f6ee872..c4024eadc 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp
@@ -174,9 +174,8 @@ namespace cryptonote
tx.unlock_time = unlock_time;
tx.extra = extra;
- keypair txkey = keypair::generate();
- remove_field_from_tx_extra(tx.extra, typeid(tx_extra_pub_key));
- add_tx_pub_key_to_extra(tx, txkey.pub);
+ keypair txkey;
+ txkey.sec = rct::rct2sk(rct::skGen());
tx_key = txkey.sec;
// if we have a stealth payment id, find it and encrypt it with the tx key now
@@ -323,9 +322,13 @@ namespace cryptonote
if (num_stdaddresses == 0 && num_subaddresses == 1)
{
txkey.pub = rct::rct2pk(rct::scalarmultKey(rct::pk2rct(single_dest_subaddress.m_spend_public_key), rct::sk2rct(txkey.sec)));
- remove_field_from_tx_extra(tx.extra, typeid(tx_extra_pub_key));
- add_tx_pub_key_to_extra(tx, txkey.pub);
}
+ else
+ {
+ txkey.pub = rct::rct2pk(rct::scalarmultBase(rct::sk2rct(txkey.sec)));
+ }
+ remove_field_from_tx_extra(tx.extra, typeid(tx_extra_pub_key));
+ add_tx_pub_key_to_extra(tx, txkey.pub);
std::vector<crypto::public_key> additional_tx_public_keys;
additional_tx_keys.clear();
@@ -348,9 +351,11 @@ namespace cryptonote
keypair additional_txkey;
if (need_additional_txkeys)
{
- additional_txkey = keypair::generate();
+ additional_txkey.sec = rct::rct2sk(rct::skGen());
if (dst_entr.is_subaddress)
additional_txkey.pub = rct::rct2pk(rct::scalarmultKey(rct::pk2rct(dst_entr.addr.m_spend_public_key), rct::sk2rct(additional_txkey.sec)));
+ else
+ additional_txkey.pub = rct::rct2pk(rct::scalarmultBase(rct::sk2rct(additional_txkey.sec)));
}
bool r;