aboutsummaryrefslogtreecommitdiff
path: root/src/gen_multisig
diff options
context:
space:
mode:
authorkoe <ukoe@protonmail.com>2021-08-02 23:27:43 -0500
committerkoe <ukoe@protonmail.com>2022-02-22 16:37:42 -0600
commite08abaa43f2c534bf21c0ed59ba325538502007e (patch)
treee9df79c11b538a2672643526dd63b01354b11565 /src/gen_multisig
parentMerge pull request #7984 (diff)
downloadmonero-e08abaa43f2c534bf21c0ed59ba325538502007e.tar.xz
multisig key exchange update and refactor
Diffstat (limited to 'src/gen_multisig')
-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 4aa21b149..87de3c351 100644
--- a/src/gen_multisig/gen_multisig.cpp
+++ b/src/gen_multisig/gen_multisig.cpp
@@ -95,55 +95,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);
}
}