aboutsummaryrefslogtreecommitdiff
path: root/src/gen_multisig/gen_multisig.cpp
diff options
context:
space:
mode:
authorkoe <ukoe@protonmail.com>2021-08-02 23:27:43 -0500
committerkoe <ukoe@protonmail.com>2022-02-24 14:47:13 -0600
commit743dd0e3b49582b802ddc552c20fb97fc26738d8 (patch)
tree06c44ee3fc7a079158210015b119bc21b6c2d039 /src/gen_multisig/gen_multisig.cpp
parentMerge pull request #8131 (diff)
downloadmonero-743dd0e3b49582b802ddc552c20fb97fc26738d8.tar.xz
multisig key exchange update and refactor
Diffstat (limited to '')
-rw-r--r--src/gen_multisig/gen_multisig.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/gen_multisig/gen_multisig.cpp b/src/gen_multisig/gen_multisig.cpp
index 15f7e5c0a..014287cc5 100644
--- a/src/gen_multisig/gen_multisig.cpp
+++ b/src/gen_multisig/gen_multisig.cpp
@@ -97,55 +97,35 @@ static bool generate_multisig(uint32_t threshold, uint32_t total, const std::str
}
// gather the keys
- std::vector<crypto::secret_key> sk(total);
- std::vector<crypto::public_key> pk(total);
+ std::vector<std::string> first_round_msgs;
+ first_round_msgs.reserve(total);
for (size_t n = 0; n < total; ++n)
{
wallets[n]->decrypt_keys(pwd_container->password());
- if (!tools::wallet2::verify_multisig_info(wallets[n]->get_multisig_info(), sk[n], pk[n]))
- {
- tools::fail_msg_writer() << genms::tr("Failed to verify multisig info");
- return false;
- }
+
+ first_round_msgs.emplace_back(wallets[n]->get_multisig_first_kex_msg());
+
wallets[n]->encrypt_keys(pwd_container->password());
}
// make the wallets multisig
- std::vector<std::string> extra_info(total);
+ std::vector<std::string> kex_msgs_intermediate(total);
std::stringstream ss;
for (size_t n = 0; n < total; ++n)
{
std::string name = basename + "-" + std::to_string(n + 1);
- std::vector<crypto::secret_key> skn;
- std::vector<crypto::public_key> pkn;
- for (size_t k = 0; k < total; ++k)
- {
- if (k != n)
- {
- skn.push_back(sk[k]);
- pkn.push_back(pk[k]);
- }
- }
- extra_info[n] = wallets[n]->make_multisig(pwd_container->password(), skn, pkn, threshold);
+
+ kex_msgs_intermediate[n] = wallets[n]->make_multisig(pwd_container->password(), first_round_msgs, threshold);
+
ss << " " << name << std::endl;
}
//exchange keys unless exchange_multisig_keys returns no extra info
- while (!extra_info[0].empty())
+ while (!kex_msgs_intermediate[0].empty())
{
- std::unordered_set<crypto::public_key> pkeys;
- std::vector<crypto::public_key> signers(total);
- for (size_t n = 0; n < total; ++n)
- {
- if (!tools::wallet2::verify_extra_multisig_info(extra_info[n], pkeys, signers[n]))
- {
- tools::fail_msg_writer() << genms::tr("Error verifying multisig extra info");
- return false;
- }
- }
for (size_t n = 0; n < total; ++n)
{
- extra_info[n] = wallets[n]->exchange_multisig_keys(pwd_container->password(), pkeys, signers);
+ kex_msgs_intermediate[n] = wallets[n]->exchange_multisig_keys(pwd_container->password(), kex_msgs_intermediate);
}
}