14
14
@license GPL-3.0+ <https://github.com/KZen-networks/multi-party-ecdsa/blob/master/LICENSE>
15
15
*/
16
16
17
- use class_group:: primitives:: CLDLProof ;
18
- use class_group:: primitives:: Ciphertext ;
19
- use class_group:: primitives:: HSMCL ;
20
- use class_group:: primitives:: PK as HSMCLPK ;
17
+ use class_group:: primitives:: cl_dl_lcm :: CLDLProof ;
18
+ use class_group:: primitives:: cl_dl_lcm :: Ciphertext ;
19
+ use class_group:: primitives:: cl_dl_lcm :: HSMCL ;
20
+ use class_group:: primitives:: cl_dl_lcm :: PK as HSMCLPK ;
21
21
use curv:: arithmetic:: traits:: * ;
22
22
use curv:: cryptographic_primitives:: commitments:: hash_commitment:: HashCommitment ;
23
23
use curv:: cryptographic_primitives:: commitments:: traits:: Commitment ;
@@ -201,6 +201,20 @@ impl KeyGenSecondMsg {
201
201
}
202
202
}
203
203
204
+ impl HSMCLPublic {
205
+ pub fn set ( ek : & HSMCLPK , encrypted_secret_share : & Ciphertext ) -> HSMCLPublic {
206
+ let y_lcm_2_10 : BigInt = str:: parse (
207
+ "15161806181366890704755537519628428221282838501257142250824360639698299050776571382489681778825684381429314058890905101687022024744606800532531764952734582389201393752832486383043169059475949454418063248428056646723694341952991408637386677631205400831455008554143754794994126167401137152222379676492247471515691285702536834646805381995650206229354446213284302569283840180834930263739794772017863585682362821412785936104792844891075228278568320000" ,
208
+ ) . unwrap ( ) ;
209
+ let encrypted_share_y = HSMCL :: eval_scal ( encrypted_secret_share, & y_lcm_2_10) ;
210
+
211
+ HSMCLPublic {
212
+ ek : ek. clone ( ) ,
213
+ encrypted_secret_share : encrypted_share_y,
214
+ }
215
+ }
216
+ }
217
+
204
218
pub fn compute_pubkey ( local_share : & EcKeyPair , other_share_public_share : & GE ) -> GE {
205
219
let pubkey = other_share_public_share. clone ( ) ;
206
220
pubkey. scalar_mul ( & local_share. secret_share . get_element ( ) )
@@ -215,7 +229,7 @@ impl Party2Private {
215
229
}
216
230
217
231
impl HSMCLPublic {
218
- pub fn verify_zkcldl_proof ( proof : CLDLProof ) -> Result < ( Self ) , ( ) > {
232
+ pub fn verify_zkcldl_proof ( proof : CLDLProof ) -> Result < Self , ( ) > {
219
233
let res = proof. verify ( ) ;
220
234
match res {
221
235
Ok ( _) => Ok ( HSMCLPublic {
@@ -306,6 +320,9 @@ impl PartialSig {
306
320
ephemeral_other_public_share : & GE ,
307
321
message : & BigInt ,
308
322
) -> PartialSig {
323
+ let y_lcm_2_10 : BigInt = str:: parse (
324
+ "15161806181366890704755537519628428221282838501257142250824360639698299050776571382489681778825684381429314058890905101687022024744606800532531764952734582389201393752832486383043169059475949454418063248428056646723694341952991408637386677631205400831455008554143754794994126167401137152222379676492247471515691285702536834646805381995650206229354446213284302569283840180834930263739794772017863585682362821412785936104792844891075228278568320000" ,
325
+ ) . unwrap ( ) ;
309
326
let q = FE :: q ( ) ;
310
327
//compute r = k2* R1
311
328
let mut r: GE = ephemeral_other_public_share. clone ( ) ;
@@ -318,7 +335,8 @@ impl PartialSig {
318
335
. invert ( & q)
319
336
. unwrap ( ) ;
320
337
let k2_inv_m = BigInt :: mod_mul ( & k2_inv, message, & q) ;
321
- let c1 = HSMCL :: encrypt ( & party_two_public. ek , & k2_inv_m) ;
338
+ let k2_inv_m_y_lcm_2_10 = BigInt :: mod_mul ( & k2_inv_m, & y_lcm_2_10, & q) ;
339
+ let c1 = HSMCL :: encrypt ( & party_two_public. ek , & k2_inv_m_y_lcm_2_10) ;
322
340
let v = BigInt :: mod_mul ( & k2_inv, & local_share. x2 . to_big_int ( ) , & q) ;
323
341
let v = BigInt :: mod_mul ( & v, & rx, & q) ;
324
342
0 commit comments