Skip to content

Commit 3c4b803

Browse files
committed
move demo to examples
1 parent b2581f0 commit 3c4b803

File tree

8 files changed

+33
-44
lines changed

8 files changed

+33
-44
lines changed

Cargo.toml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "multi-party-ecdsa"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
authors = [
55
66
@@ -23,22 +23,17 @@ categories = ["cryptography"]
2323
[lib]
2424
crate-type = ["lib"]
2525

26-
[features]
27-
bin = ["rocket", "rocket_contrib"]
2826

2927
[dependencies]
3028
paillier = { git = "https://github.com/KZen-networks/rust-paillier", tag = "v0.3.0" }
3129
zk-paillier = { git = "https://github.com/KZen-networks/zk-paillier", tag = "v0.2.0" }
32-
33-
34-
hex = "0.3.2"
3530
subtle = {version = "2", features = ["nightly"]}
3631
serde = "1.0"
3732
serde_derive = "1.0"
38-
serde_json = "1.0"
39-
reqwest = {version = "0.9.5", default-features = false}
40-
uuid = { version = "0.7", features = ["v4"] }
41-
rust-crypto = "^0.2"
33+
34+
35+
[features]
36+
cclst = ["class_group"]
4237

4338
[dependencies.curv]
4439
git = "https://github.com/KZen-networks/curv"
@@ -51,24 +46,37 @@ tag = "v0.2.0"
5146

5247
[dependencies.class_group]
5348
git = "https://github.com/KZen-networks/class-groups"
54-
tag = "v0.1.3"
49+
tag = "v0.1.4"
50+
optional = true
5551

5652
[dependencies.rocket]
5753
version = "0.4.2"
5854
default-features = false
5955
optional = true
6056

61-
[dependencies.rocket_contrib]
62-
version = "0.4.2"
63-
default-features = false
64-
features = ["json"]
65-
optional = true
57+
6658

6759
[patch.crates-io]
6860
rust-gmp = { version = "0.5.0", features = ["serde_support"], git = "https://github.com/KZen-networks/rust-gmp" }
6961

7062
[dev-dependencies]
7163
criterion = "0.2"
64+
hex = "0.3.2"
65+
rocket_contrib = {version = "0.4.2",default-features = false,features = ["json"]}
66+
rocket = {version = "0.4.2", default-features = false}
67+
reqwest = {version = "0.9.5", default-features = false}
68+
uuid = { version = "0.7", features = ["v4"] }
69+
rust-crypto = "^0.2"
70+
serde_json = "1.0"
71+
72+
[[example]]
73+
name = "sm_manager"
74+
75+
[[example]]
76+
name = "gg18_keygen_client"
77+
78+
[[example]]
79+
name = "gg18_sign_client"
7280

7381
[[bench]]
7482
name = "keygen"
File renamed without changes.
File renamed without changes.

src/bin/sm_manager.rs renamed to examples/sm_manager.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#![feature(proc_macro_hygiene, decl_macro)]
22

33
#[macro_use]
4-
#[cfg(feature = "bin")]
54
extern crate rocket;
6-
#[cfg(feature = "bin")]
75
extern crate rocket_contrib;
86

97
extern crate reqwest;
@@ -14,19 +12,12 @@ extern crate serde_derive;
1412
extern crate serde;
1513
extern crate serde_json;
1614

17-
#[cfg(feature = "bin")]
1815
use rocket::State;
19-
#[cfg(feature = "bin")]
2016
use rocket_contrib::json::Json;
21-
#[cfg(feature = "bin")]
2217
use std::collections::HashMap;
23-
#[cfg(feature = "bin")]
2418
use std::fs;
25-
#[cfg(feature = "bin")]
2619
use std::str;
27-
#[cfg(feature = "bin")]
2820
use std::sync::RwLock;
29-
#[cfg(feature = "bin")]
3021
use uuid::Uuid;
3122
#[derive(Hash, PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
3223
pub struct TupleKey {
@@ -57,7 +48,6 @@ pub struct Params {
5748
pub parties: String,
5849
pub threshold: String,
5950
}
60-
#[cfg(feature = "bin")]
6151
#[post("/get", format = "json", data = "<request>")]
6252
fn get(
6353
db_mtx: State<RwLock<HashMap<TupleKey, String>>>,
@@ -76,7 +66,6 @@ fn get(
7666
None => Json(Err(())),
7767
}
7868
}
79-
#[cfg(feature = "bin")]
8069
#[post("/set", format = "json", data = "<request>")]
8170
fn set(
8271
db_mtx: State<RwLock<HashMap<TupleKey, String>>>,
@@ -88,7 +77,6 @@ fn set(
8877
Json(Ok(()))
8978
}
9079

91-
#[cfg(feature = "bin")]
9280
#[post("/signupkeygen", format = "json")]
9381
fn signup_keygen(
9482
db_mtx: State<RwLock<HashMap<TupleKey, String>>>,
@@ -128,7 +116,6 @@ fn signup_keygen(
128116
return Json(Ok(party_signup));
129117
}
130118

131-
#[cfg(feature = "bin")]
132119
#[post("/signupsign", format = "json")]
133120
fn signup_sign(db_mtx: State<RwLock<HashMap<TupleKey, String>>>) -> Json<Result<PartySignup, ()>> {
134121
//read parameters:
@@ -168,7 +155,6 @@ fn signup_sign(db_mtx: State<RwLock<HashMap<TupleKey, String>>>) -> Json<Result<
168155
}
169156

170157
//refcell, arc
171-
#[cfg(feature = "bin")]
172158
fn run_server() {
173159
// let mut my_config = Config::development();
174160
// my_config.set_port(18001);
@@ -221,6 +207,5 @@ fn run_server() {
221207

222208
fn main() {
223209
//refcell, arc
224-
#[cfg(feature = "bin")]
225210
run_server()
226211
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#[macro_use]
1818
extern crate serde_derive;
1919
extern crate serde;
20-
extern crate serde_json;
2120
extern crate subtle;
2221

2322
extern crate centipede;
23+
#[cfg(feature = "cclst")]
2424
extern crate class_group;
2525
extern crate curv;
2626
extern crate paillier;

src/protocols/two_party_ecdsa/cclst_2019/party_two.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,8 @@ impl PartialSig {
323323
let v = BigInt::mod_mul(&k2_inv, &local_share.x2.to_big_int(), &q);
324324
let v = BigInt::mod_mul(&v, &rx, &q);
325325

326-
let c2 = Ciphertext {
327-
c1: party_two_public.encrypted_secret_share.c1.exp(&v),
328-
c2: party_two_public.encrypted_secret_share.c2.exp(&v),
329-
};
330-
331-
let c3 = Ciphertext {
332-
c1: c1.c1.compose(&c2.c1).reduce().0,
333-
c2: c1.c2.compose(&c2.c2).reduce().0,
334-
};
326+
let c2 = HSMCL::eval_scal(&party_two_public.encrypted_secret_share, &v);
327+
let c3 = HSMCL::eval_sum(&c1, &c2);
335328

336329
//c3:
337330
PartialSig { c3 }

src/protocols/two_party_ecdsa/cclst_2019/test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ mod tests {
2929
}
3030

3131
#[test]
32-
3332
fn test_full_key_gen() {
3433
let (party_one_first_message, comm_witness, ec_key_pair_party1) =
3534
party_one::KeyGenFirstMsg::create_commitments_with_fixed_secret_share(ECScalar::from(
@@ -126,5 +125,4 @@ mod tests {
126125
party_one::compute_pubkey(&party1_private, &party_two_private_share_gen.public_share);
127126
party_one::verify(&signature, &pubkey, &message).expect("Invalid signature")
128127
}
129-
130128
}

src/protocols/two_party_ecdsa/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@
1515
*/
1616

1717
// Fast Secure Two-Party ECDSA Signing by Yehuda Lindell (https://eprint.iacr.org/2017/552.pdf).
18-
pub mod cclst_2019;
18+
1919
pub mod lindell_2017;
20+
21+
// Two-Party ECDSA from Hash Proof Systems and
22+
//Efficient Instantiations (https://eprint.iacr.org/2019/503.pdf)
23+
#[cfg(feature = "cclst")]
24+
pub mod cclst_2019;

0 commit comments

Comments
 (0)