Skip to content

Commit b14e4ae

Browse files
th4ssinui0
authored andcommitted
feat(prf): reduced MPC variant
1 parent 24005e4 commit b14e4ae

37 files changed

+2503
-1390
lines changed

Cargo.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ members = [
88
"crates/common",
99
"crates/components/deap",
1010
"crates/components/cipher",
11-
#"crates/components/hmac-sha256",
12-
#"crates/components/hmac-sha256-circuits",
11+
"crates/components/hmac-sha256",
1312
"crates/components/key-exchange",
1413
"crates/core",
1514
"crates/data-fixtures",
@@ -51,8 +50,7 @@ tlsn-core = { path = "crates/core" }
5150
tlsn-data-fixtures = { path = "crates/data-fixtures" }
5251
tlsn-deap = { path = "crates/components/deap" }
5352
tlsn-formats = { path = "crates/formats" }
54-
#tlsn-hmac-sha256 = { path = "crates/components/hmac-sha256" }
55-
#tlsn-hmac-sha256-circuits = { path = "crates/components/hmac-sha256-circuits" }
53+
tlsn-hmac-sha256 = { path = "crates/components/hmac-sha256" }
5654
tlsn-key-exchange = { path = "crates/components/key-exchange" }
5755
tlsn-mpc-tls = { path = "crates/mpc-tls" }
5856
tlsn-prover = { path = "crates/prover" }

crates/benches/binary/Cargo.toml

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ browser-bench = ["tlsn-benches-browser-native"]
1313
mpz-common = { workspace = true }
1414
mpz-core = { workspace = true }
1515
mpz-garble = { workspace = true }
16+
mpz-vm-core = { workspace = true }
1617
mpz-ot = { workspace = true, features = ["ideal"] }
1718
tlsn-benches-library = { workspace = true }
18-
tlsn-benches-browser-native = { workspace = true, optional = true}
19+
tlsn-benches-browser-native = { workspace = true, optional = true }
1920
tlsn-common = { workspace = true }
2021
tlsn-core = { workspace = true }
21-
#tlsn-hmac-sha256 = { workspace = true }
22+
tlsn-hmac-sha256 = { workspace = true }
2223
tlsn-prover = { workspace = true }
2324
tlsn-server-fixture = { workspace = true }
2425
tlsn-server-fixture-certs = { workspace = true }
@@ -27,7 +28,7 @@ tlsn-verifier = { workspace = true }
2728

2829
anyhow = { workspace = true }
2930
async-trait = { workspace = true }
30-
charming = {version = "0.3.1", features = ["ssr"]}
31+
charming = { version = "0.3.1", features = ["ssr"] }
3132
csv = "1.3.0"
3233
dhat = { version = "0.3.3" }
3334
env_logger = { version = "0.6.0", default-features = false }
@@ -43,7 +44,8 @@ tokio = { workspace = true, features = [
4344
] }
4445
tokio-util = { workspace = true }
4546
toml = "0.8.11"
46-
tracing-subscriber = {workspace = true, features = ["env-filter"]}
47+
tracing-subscriber = { workspace = true, features = ["env-filter"] }
48+
rand = { workspace = true }
4749

4850
[[bin]]
4951
name = "bench"
+22-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
1-
use hmac_sha256::build_circuits;
1+
use hmac_sha256::{Config, MpcPrf};
2+
use mpz_garble::protocol::semihonest::{Evaluator, Garbler};
3+
use mpz_ot::ideal::cot::{ideal_cot, IdealCOTReceiver, IdealCOTSender};
4+
use mpz_vm_core::memory::{binary::U8, correlated::Delta, Array, MemoryExt};
5+
use rand::{rngs::StdRng, SeedableRng};
26

37
pub async fn preprocess_prf_circuits() {
4-
build_circuits().await;
8+
let (mut garbler, _) = mock_vm();
9+
let pms: Array<U8, 32> = garbler.alloc().unwrap();
10+
11+
let mut prf = MpcPrf::new(Config::default());
12+
prf.alloc(&mut garbler, pms).unwrap();
13+
}
14+
15+
fn mock_vm() -> (Garbler<IdealCOTSender>, Evaluator<IdealCOTReceiver>) {
16+
let mut rng = StdRng::seed_from_u64(0);
17+
let delta = Delta::random(&mut rng);
18+
19+
let (cot_send, cot_recv) = ideal_cot(delta.into_inner());
20+
21+
let gen = Garbler::new(cot_send, [0u8; 16], delta);
22+
let ev = Evaluator::new(cot_recv);
23+
24+
(gen, ev)
525
}

crates/components/hmac-sha256-circuits/Cargo.toml

-19
This file was deleted.

crates/components/hmac-sha256-circuits/src/hmac_sha256.rs

-159
This file was deleted.

crates/components/hmac-sha256-circuits/src/lib.rs

-61
This file was deleted.

0 commit comments

Comments
 (0)