aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-06-28 16:03:28 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:28:58 +0100
commit6d0e47148bc400ca6668860e162fe2f4ad8a3dac (patch)
treeb9d5d32dc975b8811cf992c2f86a75d00bb5c815 /src
parentringct: fix size unit mismatch calling keccak (diff)
downloadmonero-6d0e47148bc400ca6668860e162fe2f4ad8a3dac.tar.xz
rct: add the tx prefix hash into the MLSAG
to protect the non-signatures parts of the tx from tampering.
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/cryptonote_format_utils.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp
index 9f0693b30..4cc62c165 100644
--- a/src/cryptonote_core/cryptonote_format_utils.cpp
+++ b/src/cryptonote_core/cryptonote_format_utils.cpp
@@ -685,9 +685,6 @@ namespace cryptonote
if (amount_in > amount_out)
amounts.push_back(amount_in - amount_out);
- LOG_PRINT_L1("Signing tx: " << obj_to_json_str(tx));
- tx.rct_signatures = rct::genRct(inSk, destinations, amounts, mixRing, sources[0].real_output); // same index assumption
-
// zero out all amounts to mask rct outputs, real amounts are now encrypted
for (size_t i = 0; i < tx.vin.size(); ++i)
{
@@ -697,6 +694,10 @@ namespace cryptonote
for (size_t i = 0; i < tx.vout.size(); ++i)
tx.vout[i].amount = 0;
+ crypto::hash tx_prefix_hash;
+ get_transaction_prefix_hash(tx, tx_prefix_hash);
+ tx.rct_signatures = rct::genRct(inSk, destinations, amounts, mixRing, rct::hash2rct(tx_prefix_hash), sources[0].real_output); // same index assumption
+
LOG_PRINT2("construct_tx.log", "transaction_created: " << get_transaction_hash(tx) << ENDL << obj_to_json_str(tx) << ENDL, LOG_LEVEL_3);
}