aboutsummaryrefslogtreecommitdiff
path: root/src/multisig/multisig.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/multisig/multisig.h')
-rw-r--r--src/multisig/multisig.h70
1 files changed, 34 insertions, 36 deletions
diff --git a/src/multisig/multisig.h b/src/multisig/multisig.h
index eab32187c..e041ea670 100644
--- a/src/multisig/multisig.h
+++ b/src/multisig/multisig.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2020, The Monero Project
+// Copyright (c) 2017-2021, The Monero Project
//
// All rights reserved.
//
@@ -28,44 +28,42 @@
#pragma once
-#include <vector>
-#include <unordered_map>
#include "crypto/crypto.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "ringct/rctTypes.h"
-namespace cryptonote
-{
- struct account_keys;
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
- crypto::secret_key get_multisig_blinded_secret_key(const crypto::secret_key &key);
- void generate_multisig_N_N(const account_keys &keys, const std::vector<crypto::public_key> &spend_keys, std::vector<crypto::secret_key> &multisig_keys, rct::key &spend_skey, rct::key &spend_pkey);
- void generate_multisig_N1_N(const account_keys &keys, const std::vector<crypto::public_key> &spend_keys, std::vector<crypto::secret_key> &multisig_keys, rct::key &spend_skey, rct::key &spend_pkey);
- /**
- * @brief generate_multisig_derivations performs common DH key derivation.
- * Each middle round in M/N scheme is DH exchange of public multisig keys of other participants multiplied by secret spend key of current participant.
- * this functions does the following: new multisig key = secret spend * public multisig key
- * @param keys - current wallet's keys
- * @param derivations - public multisig keys of other participants
- * @return new public multisig keys derived from previous round. This data needs to be exchange with other participants
- */
- std::vector<crypto::public_key> generate_multisig_derivations(const account_keys &keys, const std::vector<crypto::public_key> &derivations);
- crypto::secret_key calculate_multisig_signer_key(const std::vector<crypto::secret_key>& derivations);
- /**
- * @brief calculate_multisig_keys. Calculates secret multisig keys from others' participants ones as follows: mi = H(Mi)
- * @param derivations - others' participants public multisig keys.
- * @return vector of current wallet's multisig secret keys
- */
- std::vector<crypto::secret_key> calculate_multisig_keys(const std::vector<crypto::public_key>& derivations);
- crypto::secret_key generate_multisig_view_secret_key(const crypto::secret_key &skey, const std::vector<crypto::secret_key> &skeys);
+namespace cryptonote { struct account_keys; }
+
+namespace multisig
+{
/**
- * @brief generate_multisig_M_N_spend_public_key calculates multisig wallet's spend public key by summing all of public multisig keys
- * @param pkeys unique public multisig keys
- * @return multisig wallet's spend public key
- */
- crypto::public_key generate_multisig_M_N_spend_public_key(const std::vector<crypto::public_key> &pkeys);
- bool generate_multisig_key_image(const account_keys &keys, size_t multisig_key_index, const crypto::public_key& out_key, crypto::key_image& ki);
- void generate_multisig_LR(const crypto::public_key pkey, const crypto::secret_key &k, crypto::public_key &L, crypto::public_key &R);
- bool generate_multisig_composite_key_image(const account_keys &keys, const std::unordered_map<crypto::public_key, cryptonote::subaddress_index>& subaddresses, const crypto::public_key& out_key, const crypto::public_key &tx_public_key, const std::vector<crypto::public_key>& additional_tx_public_keys, size_t real_output_index, const std::vector<crypto::key_image> &pkis, crypto::key_image &ki);
- uint32_t multisig_rounds_required(uint32_t participants, uint32_t threshold);
-}
+ * @brief get_multisig_blinded_secret_key - converts an input private key into a blinded multisig private key
+ * Use 1a: converts account private spend key into multisig private key, which is used for key exchange and message signing
+ * Use 1b: converts account private view key into ancillary private key share, for the composite multisig private view key
+ * Use 2: converts DH shared secrets (curve points) into private keys, which are intermediate private keys in multisig key exchange
+ * @param key - private key to transform
+ * @return transformed private key
+ */
+ crypto::secret_key get_multisig_blinded_secret_key(const crypto::secret_key &key);
+
+ bool generate_multisig_key_image(const cryptonote::account_keys &keys,
+ std::size_t multisig_key_index,
+ const crypto::public_key& out_key,
+ crypto::key_image& ki);
+ void generate_multisig_LR(const crypto::public_key pkey,
+ const crypto::secret_key &k,
+ crypto::public_key &L,
+ crypto::public_key &R);
+ bool generate_multisig_composite_key_image(const cryptonote::account_keys &keys,
+ const std::unordered_map<crypto::public_key, cryptonote::subaddress_index> &subaddresses,
+ const crypto::public_key &out_key,
+ const crypto::public_key &tx_public_key,
+ const std::vector<crypto::public_key> &additional_tx_public_keys,
+ std::size_t real_output_index,
+ const std::vector<crypto::key_image> &pkis,
+ crypto::key_image &ki);
+} //namespace multisig