@@ -14,9 +14,9 @@ mod bench {
14
14
c. bench_function ( "keygen" , move |b| {
15
15
b. iter ( || {
16
16
let ( party_one_first_message, comm_witness, ec_key_pair_party1) =
17
- party_one:: KeyGenFirstMsg :: create_commitments_with_fixed_secret_share (
18
- ECScalar :: from ( & BigInt :: sample ( 253 ) ) ,
19
- ) ;
17
+ party_one:: KeyGenFirstMsg :: create_commitments_with_fixed_secret_share ( ECScalar :: from (
18
+ & BigInt :: sample ( 253 ) ,
19
+ ) ) ;
20
20
let ( party_two_first_message, _ec_key_pair_party2) =
21
21
party_two:: KeyGenFirstMsg :: create_with_fixed_secret_share ( ECScalar :: from (
22
22
& BigInt :: from ( 10 ) ,
@@ -25,25 +25,21 @@ mod bench {
25
25
comm_witness,
26
26
& party_two_first_message. d_log_proof ,
27
27
)
28
- . expect ( "failed to verify and decommit" ) ;
28
+ . expect ( "failed to verify and decommit" ) ;
29
29
30
30
let _party_two_second_message =
31
31
party_two:: KeyGenSecondMsg :: verify_commitments_and_dlog_proof (
32
32
& party_one_first_message,
33
33
& party_one_second_message,
34
34
)
35
- . expect ( "failed to verify commitments and DLog proof" ) ;
35
+ . expect ( "failed to verify commitments and DLog proof" ) ;
36
36
37
37
// init paillier keypair:
38
38
let paillier_key_pair =
39
- party_one:: PaillierKeyPair :: generate_keypair_and_encrypted_share (
40
- & ec_key_pair_party1,
41
- ) ;
39
+ party_one:: PaillierKeyPair :: generate_keypair_and_encrypted_share ( & ec_key_pair_party1) ;
42
40
43
- let party_one_private = party_one:: Party1Private :: set_private_key (
44
- & ec_key_pair_party1,
45
- & paillier_key_pair,
46
- ) ;
41
+ let party_one_private =
42
+ party_one:: Party1Private :: set_private_key ( & ec_key_pair_party1, & paillier_key_pair) ;
47
43
48
44
let party_two_paillier = party_two:: PaillierPublic {
49
45
ek : paillier_key_pair. ek . clone ( ) ,
@@ -56,26 +52,23 @@ mod bench {
56
52
correct_key_proof,
57
53
& party_two_paillier. ek ,
58
54
)
59
- . expect ( "bad paillier key" ) ;
55
+ . expect ( "bad paillier key" ) ;
60
56
// zk proof of correct paillier key
61
57
62
58
// zk range proof
63
59
let range_proof = party_one:: PaillierKeyPair :: generate_range_proof (
64
60
& paillier_key_pair,
65
61
& party_one_private,
66
62
) ;
67
-
68
- let _result = party_two:: PaillierPublic :: verify_range_proof (
69
- & party_two_paillier,
70
- & range_proof,
71
- )
72
- . expect ( "range proof error" ) ;
63
+ let _result =
64
+ party_two:: PaillierPublic :: verify_range_proof ( & party_two_paillier, & range_proof)
65
+ . expect ( "range proof error" ) ;
73
66
74
67
// pdl proof minus range proof
75
- let ( party_two_pdl_first_message, pdl_chal_party2) = party_two_paillier
76
- . pdl_challenge ( & party_one_second_message. comm_witness . public_share ) ;
68
+ let ( party_two_pdl_first_message, pdl_chal_party2) =
69
+ party_two_paillier . pdl_challenge ( & party_one_second_message. comm_witness . public_share ) ;
77
70
78
- let ( party_one_pdl_first_message, pdl_decommit_party1) =
71
+ let ( party_one_pdl_first_message, pdl_decommit_party1, alpha ) =
79
72
party_one:: PaillierKeyPair :: pdl_first_stage (
80
73
& party_one_private,
81
74
& party_two_pdl_first_message,
@@ -84,20 +77,20 @@ mod bench {
84
77
let party_two_pdl_second_message =
85
78
party_two:: PaillierPublic :: pdl_decommit_c_tag_tag ( & pdl_chal_party2) ;
86
79
let party_one_pdl_second_message = party_one:: PaillierKeyPair :: pdl_second_stage (
87
- & party_one_pdl_first_message,
88
80
& party_two_pdl_first_message,
89
81
& party_two_pdl_second_message,
90
82
party_one_private,
91
83
pdl_decommit_party1,
84
+ alpha,
92
85
)
93
- . expect ( "pdl error party2" ) ;
86
+ . expect ( "pdl error party2" ) ;
94
87
95
88
party_two:: PaillierPublic :: verify_pdl (
96
89
& pdl_chal_party2,
97
90
& party_one_pdl_first_message,
98
91
& party_one_pdl_second_message,
99
92
)
100
- . expect ( "pdl error party1" )
93
+ . expect ( "pdl error party1" )
101
94
} )
102
95
} ) ;
103
96
}
0 commit comments