aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/cryptonote_format_utils.cpp
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/cryptonote_basic/cryptonote_format_utils.cpp
parentMerge pull request #7984 (diff)
downloadmonero-e08abaa43f2c534bf21c0ed59ba325538502007e.tar.xz
multisig key exchange update and refactor
Diffstat (limited to 'src/cryptonote_basic/cryptonote_format_utils.cpp')
-rw-r--r--src/cryptonote_basic/cryptonote_format_utils.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp
index 17adcdc35..835f59d69 100644
--- a/src/cryptonote_basic/cryptonote_format_utils.cpp
+++ b/src/cryptonote_basic/cryptonote_format_utils.cpp
@@ -306,7 +306,26 @@ namespace cryptonote
{
// derive secret key with subaddress - step 1: original CN derivation
crypto::secret_key scalar_step1;
- hwdev.derive_secret_key(recv_derivation, real_output_index, ack.m_spend_secret_key, scalar_step1); // computes Hs(a*R || idx) + b
+ crypto::secret_key spend_skey = crypto::null_skey;
+
+ if (ack.m_multisig_keys.empty())
+ {
+ // if not multisig, use normal spend skey
+ spend_skey = ack.m_spend_secret_key;
+ }
+ else
+ {
+ // if multisig, use sum of multisig privkeys (local account's share of aggregate spend key)
+ for (const auto &multisig_key : ack.m_multisig_keys)
+ {
+ sc_add((unsigned char*)spend_skey.data,
+ (const unsigned char*)multisig_key.data,
+ (const unsigned char*)spend_skey.data);
+ }
+ }
+
+ // computes Hs(a*R || idx) + b
+ hwdev.derive_secret_key(recv_derivation, real_output_index, spend_skey, scalar_step1);
// step 2: add Hs(a || index_major || index_minor)
crypto::secret_key subaddr_sk;