Monero
Toggle main menu visibility
Loading...
Searching...
No Matches
src
multisig
multisig_clsag_context.h
Go to the documentation of this file.
1
// Copyright (c) 2021, The Monero Project
2
//
3
// All rights reserved.
4
//
5
// Redistribution and use in source and binary forms, with or without modification, are
6
// permitted provided that the following conditions are met:
7
//
8
// 1. Redistributions of source code must retain the above copyright notice, this list of
9
// conditions and the following disclaimer.
10
//
11
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12
// of conditions and the following disclaimer in the documentation and/or other
13
// materials provided with the distribution.
14
//
15
// 3. Neither the name of the copyright holder nor the names of its contributors may be
16
// used to endorse or promote products derived from this software without specific
17
// prior written permission.
18
//
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
30
// References
31
// - CLSAG (base signature scheme): https://eprint.iacr.org/2019/654
32
// - MuSig2 (style for multisig signing): https://eprint.iacr.org/2020/1261
34
35
36
#pragma once
37
38
#include "
ringct/rctTypes.h
"
39
40
#include <vector>
41
42
43
namespace
multisig
{
44
45
namespace
signing
{
46
47
class
CLSAG_context_t
final {
48
private
:
49
// is the CLSAG context initialized?
50
bool
initialized
;
51
// challenge components: c = H(domain-separator, {P}, {C}, C_offset, message, L, R)
52
rct::keyV
c_params
;
53
// indices in c_params where L and R will be
54
std::size_t
c_params_L_offset
;
55
std::size_t
c_params_R_offset
;
56
// musig2-style nonce combination factor components for multisig signing
57
// b = H(domain-separator, {P}, {C}, C_offset, message, {L_combined_alphas}, {R_combined_alphas}, I, D, {s_non_l}, l, k, n)
58
// - {P} = ring of one-time addresses
59
// - {C} = ring of amount commitments (1:1 with one-time addresses)
60
// - C_offset = pseudo-output commitment to offset all amount commitments with
61
// - message = message the CLSAG will sign
62
// - {L_combined_alphas} = set of summed-together public nonces from all multisig signers for this CLSAG's L component
63
// - {R_combined_alphas} = set of summed-together public nonces from all multisig signers for this CLSAG's R component
64
// - I = key image for one-time address at {P}[l]
65
// - D = auxiliary key image for the offsetted amount commitment '{C}[l] - C_offset'
66
// - {s_non_l} = fake responses for this proof
67
// - l = real signing index in {P} and '{C} - C_offset'
68
// - k = number of parallel nonces that each participant provides
69
// - n = number of ring members
70
rct::keyV
b_params
;
71
// indices in b_params where L and R 'alpha' components will be
72
std::size_t
b_params_L_offset
;
73
std::size_t
b_params_R_offset
;
74
// CLSAG 'concise' coefficients for {P} and '{C} - C_offset'
75
// mu_x = H(domain-separator, {P}, {C}, I, (1/8)*D, C_offset)
76
// - note: 'D' is stored in the form '(1/8)*D' in transaction data
77
rct::key
mu_P
;
78
rct::key
mu_C
;
79
// ring size
80
std::size_t
n
;
81
// aggregate key image: mu_P*I + mu_C*D
82
rct::geDsmp
wH_l_precomp
;
83
// aggregate ring members: mu_P*P_i + mu_C*(C_i - C_offset)
84
std::vector<rct::geDsmp>
W_precomp
;
85
// key image component base keys: H_p(P_i)
86
std::vector<rct::geDsmp>
H_precomp
;
87
// cache for later: generator 'G' in 'precomp' representation
88
rct::geDsmp
G_precomp
;
89
// real signing index in this CLSAG
90
std::size_t
l
;
91
// signature responses
92
rct::keyV
s
;
93
// number of signing nonces expected per signer
94
std::size_t
num_alpha_components
;
95
public
:
96
CLSAG_context_t
() :
initialized
{
false
} {}
97
98
// prepare CLSAG challenge context
99
bool
init
(
100
const
rct::keyV
& P,
101
const
rct::keyV
& C_nonzero,
102
const
rct::key
& C_offset,
103
const
rct::key
& message,
104
const
rct::key
& I,
105
const
rct::key
& D,
106
const
unsigned
int
l
,
107
const
rct::keyV
&
s
,
108
const
std::size_t
num_alpha_components
109
);
110
111
// get the local signer's combined musig2-style private nonce and compute the CLSAG challenge
112
bool
combine_alpha_and_compute_challenge
(
113
// set of summed-together musig2-style public nonces from all multisig signers for this CLSAG's L component
114
const
rct::keyV
& total_alpha_G,
115
// set of summed-together musig2-style public nonces from all multisig signers for this CLSAG's R component
116
const
rct::keyV
& total_alpha_H,
117
// local signer's private musig2-style nonces
118
const
rct::keyV
& alpha,
119
// local signer's final private nonce, using musig2-style combination with factor 'b'
120
// alpha_combined = sum_i(b^i * alpha[i])
121
rct::key
& alpha_combined,
122
// CLSAG challenge to store in the proof
123
rct::key
& c_0,
124
// final CLSAG challenge to respond to (need this to make multisig partial signatures)
125
rct::key
& c
126
);
127
128
// getter for CLSAG 'concise' coefficients
129
bool
get_mu
(
130
rct::key
&
mu_P
,
131
rct::key
&
mu_C
132
)
const
;
133
};
134
135
}
//namespace signing
136
137
}
//namespace multisig
s
#define s(x, c)
Definition
aesb.c:47
multisig::signing::CLSAG_context_t::c_params_R_offset
std::size_t c_params_R_offset
Definition
multisig_clsag_context.h:55
multisig::signing::CLSAG_context_t::G_precomp
rct::geDsmp G_precomp
Definition
multisig_clsag_context.h:88
multisig::signing::CLSAG_context_t::n
std::size_t n
Definition
multisig_clsag_context.h:80
multisig::signing::CLSAG_context_t::mu_P
rct::key mu_P
Definition
multisig_clsag_context.h:77
multisig::signing::CLSAG_context_t::W_precomp
std::vector< rct::geDsmp > W_precomp
Definition
multisig_clsag_context.h:84
multisig::signing::CLSAG_context_t::b_params
rct::keyV b_params
Definition
multisig_clsag_context.h:70
multisig::signing::CLSAG_context_t::b_params_R_offset
std::size_t b_params_R_offset
Definition
multisig_clsag_context.h:73
multisig::signing::CLSAG_context_t::c_params
rct::keyV c_params
Definition
multisig_clsag_context.h:52
multisig::signing::CLSAG_context_t::H_precomp
std::vector< rct::geDsmp > H_precomp
Definition
multisig_clsag_context.h:86
multisig::signing::CLSAG_context_t::num_alpha_components
std::size_t num_alpha_components
Definition
multisig_clsag_context.h:94
multisig::signing::CLSAG_context_t::CLSAG_context_t
CLSAG_context_t()
Definition
multisig_clsag_context.h:96
multisig::signing::CLSAG_context_t::s
rct::keyV s
Definition
multisig_clsag_context.h:92
multisig::signing::CLSAG_context_t::wH_l_precomp
rct::geDsmp wH_l_precomp
Definition
multisig_clsag_context.h:82
multisig::signing::CLSAG_context_t::get_mu
bool get_mu(rct::key &mu_P, rct::key &mu_C) const
Definition
multisig_clsag_context.cpp:243
multisig::signing::CLSAG_context_t::l
std::size_t l
Definition
multisig_clsag_context.h:90
multisig::signing::CLSAG_context_t::mu_C
rct::key mu_C
Definition
multisig_clsag_context.h:78
multisig::signing::CLSAG_context_t::initialized
bool initialized
Definition
multisig_clsag_context.h:50
multisig::signing::CLSAG_context_t::b_params_L_offset
std::size_t b_params_L_offset
Definition
multisig_clsag_context.h:72
multisig::signing::CLSAG_context_t::c_params_L_offset
std::size_t c_params_L_offset
Definition
multisig_clsag_context.h:54
multisig::signing::CLSAG_context_t::combine_alpha_and_compute_challenge
bool combine_alpha_and_compute_challenge(const rct::keyV &total_alpha_G, const rct::keyV &total_alpha_H, const rct::keyV &alpha, rct::key &alpha_combined, rct::key &c_0, rct::key &c)
Definition
multisig_clsag_context.cpp:178
false
#define false
init
static void init()
Definition
logging.cpp:42
multisig::signing
Definition
multisig_clsag_context.cpp:47
multisig
Definition
multisig.cpp:46
rct::keyV
std::vector< key > keyV
Definition
rctTypes.h:89
rctTypes.h
rct::geDsmp
Definition
rctTypes.h:162
rct::key
Definition
rctTypes.h:79
Generated on
for Monero by
1.17.0