Skip to content

Commit 2fe0280

Browse files
Return constant from signing fn
This is necessary so we can build adaptor signatures on top of this.
1 parent fee1f70 commit 2fe0280

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/clsag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ mod tests {
106106
#[allow(non_snake_case)]
107107
let I = signing_key * H_p_pk;
108108

109-
let signature = sign(
109+
let (signature, _) = sign(
110110
msg_to_sign,
111111
signing_key,
112112
signing_key_index,

src/clsag/sign.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn sign(
2929
L: EdwardsPoint,
3030
R: EdwardsPoint,
3131
I: EdwardsPoint,
32-
) -> Clsag {
32+
) -> (Clsag, Scalar) {
3333
let D = z * H_p_pk;
3434
let D_inv_8 = D * INV_EIGHT;
3535
let adjusted_commitment_ring =
@@ -97,11 +97,16 @@ pub fn sign(
9797
h_prev = h
9898
}
9999

100-
responses[signing_key_index] = alpha - h_prev * ((mu_P * signing_key) + (mu_C * z));
100+
let stupid_constant = h_prev * mu_C * z;
101101

102-
Clsag {
103-
s: responses.to_vec(),
104-
c1: h_0,
105-
D: D_inv_8,
106-
}
102+
responses[signing_key_index] = alpha - h_prev * mu_P * signing_key - stupid_constant;
103+
104+
(
105+
Clsag {
106+
s: responses.to_vec(),
107+
c1: h_0,
108+
D: D_inv_8,
109+
},
110+
stupid_constant,
111+
)
107112
}

0 commit comments

Comments
 (0)