Skip to content

Commit 24005e4

Browse files
th4ssinui0
authored andcommitted
chore: bump mpz to alpha.3
1 parent 9e0f791 commit 24005e4

23 files changed

Lines changed: 216 additions & 275 deletions

File tree

Cargo.toml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ 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",
12+
#"crates/components/hmac-sha256-circuits",
1313
"crates/components/key-exchange",
1414
"crates/core",
1515
"crates/data-fixtures",
@@ -51,8 +51,8 @@ tlsn-core = { path = "crates/core" }
5151
tlsn-data-fixtures = { path = "crates/data-fixtures" }
5252
tlsn-deap = { path = "crates/components/deap" }
5353
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" }
54+
#tlsn-hmac-sha256 = { path = "crates/components/hmac-sha256" }
55+
#tlsn-hmac-sha256-circuits = { path = "crates/components/hmac-sha256-circuits" }
5656
tlsn-key-exchange = { path = "crates/components/key-exchange" }
5757
tlsn-mpc-tls = { path = "crates/mpc-tls" }
5858
tlsn-prover = { path = "crates/prover" }
@@ -65,18 +65,18 @@ tlsn-tls-core = { path = "crates/tls/core" }
6565
tlsn-utils = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "6168663" }
6666
tlsn-verifier = { path = "crates/verifier" }
6767

68-
mpz-circuits = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
69-
mpz-memory-core = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
70-
mpz-common = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
71-
mpz-core = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
72-
mpz-vm-core = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
73-
mpz-garble = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
74-
mpz-garble-core = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
75-
mpz-ole = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
76-
mpz-ot = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
77-
mpz-share-conversion = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
78-
mpz-fields = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
79-
mpz-zk = { git = "https://github.com/privacy-scaling-explorations/mpz", tag = "v0.1.0-alpha.2" }
68+
mpz-circuits = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
69+
mpz-memory-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
70+
mpz-common = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
71+
mpz-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
72+
mpz-vm-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
73+
mpz-garble = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
74+
mpz-garble-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
75+
mpz-ole = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
76+
mpz-ot = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
77+
mpz-share-conversion = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
78+
mpz-fields = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
79+
mpz-zk = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
8080

8181
rangeset = { version = "0.2" }
8282
serio = { version = "0.2" }

crates/benches/binary/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ tlsn-benches-library = { workspace = true }
1818
tlsn-benches-browser-native = { workspace = true, optional = true}
1919
tlsn-common = { workspace = true }
2020
tlsn-core = { workspace = true }
21-
tlsn-hmac-sha256 = { workspace = true }
21+
#tlsn-hmac-sha256 = { workspace = true }
2222
tlsn-prover = { workspace = true }
2323
tlsn-server-fixture = { workspace = true }
2424
tlsn-server-fixture-certs = { workspace = true }

crates/components/cipher/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ mpz-ot = { workspace = true }
2727

2828
tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread"] }
2929
rand = { workspace = true }
30-
rand06-compat = { workspace = true }
3130
ctr = { workspace = true }
3231
cipher = { workspace = true }

crates/components/cipher/src/aes/circuit.rs

Lines changed: 0 additions & 52 deletions
This file was deleted.

crates/components/cipher/src/aes/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
33
use crate::{Cipher, CtrBlock, Keystream};
44
use async_trait::async_trait;
5+
use mpz_circuits::circuits::AES128;
56
use mpz_memory_core::binary::{Binary, U8};
67
use mpz_vm_core::{prelude::*, Call, Vm};
78
use std::fmt::Debug;
89

9-
mod circuit;
1010
mod error;
1111

1212
pub use error::AesError;
@@ -55,7 +55,7 @@ impl Cipher for Aes128 {
5555

5656
let output = vm
5757
.call(
58-
Call::builder(circuit::AES128_ECB.clone())
58+
Call::builder(AES128.clone())
5959
.arg(key)
6060
.arg(input)
6161
.build()
@@ -91,7 +91,7 @@ impl Cipher for Aes128 {
9191

9292
let output = vm
9393
.call(
94-
Call::builder(circuit::AES128_CTR.clone())
94+
Call::builder(AES128.clone())
9595
.arg(key)
9696
.arg(iv)
9797
.arg(explicit_nonce)
@@ -145,7 +145,7 @@ impl Cipher for Aes128 {
145145
.map(|(explicit_nonce, counter)| {
146146
let output = vm
147147
.call(
148-
Call::builder(circuit::AES128_CTR.clone())
148+
Call::builder(AES128.clone())
149149
.arg(key)
150150
.arg(iv)
151151
.arg(explicit_nonce)
@@ -172,7 +172,7 @@ mod tests {
172172
use super::*;
173173
use crate::Cipher;
174174
use mpz_common::context::test_st_context;
175-
use mpz_garble::protocol::semihonest::{Evaluator, Generator};
175+
use mpz_garble::protocol::semihonest::{Evaluator, Garbler};
176176
use mpz_memory_core::{
177177
binary::{Binary, U8},
178178
correlated::Delta,
@@ -181,7 +181,6 @@ mod tests {
181181
use mpz_ot::ideal::cot::ideal_cot;
182182
use mpz_vm_core::{Execute, Vm};
183183
use rand::{rngs::StdRng, SeedableRng};
184-
use rand06_compat::Rand0_6CompatExt;
185184

186185
#[tokio::test]
187186
async fn test_aes_ctr() {
@@ -297,11 +296,11 @@ mod tests {
297296

298297
fn mock_vm() -> (impl Vm<Binary>, impl Vm<Binary>) {
299298
let mut rng = StdRng::seed_from_u64(0);
300-
let delta = Delta::random(&mut rng.compat_by_ref());
299+
let delta = Delta::random(&mut rng);
301300

302301
let (cot_send, cot_recv) = ideal_cot(delta.into_inner());
303302

304-
let gen = Generator::new(cot_send, [0u8; 16], delta);
303+
let gen = Garbler::new(cot_send, [0u8; 16], delta);
305304
let ev = Evaluator::new(cot_recv);
306305

307306
(gen, ev)

crates/components/cipher/src/circuit.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

crates/components/cipher/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@
1010
#![forbid(unsafe_code)]
1111

1212
pub mod aes;
13-
mod circuit;
1413

1514
use async_trait::async_trait;
16-
use circuit::build_xor_circuit;
17-
use mpz_circuits::types::ValueType;
15+
use mpz_circuits::circuits::xor;
1816
use mpz_memory_core::{
1917
binary::{Binary, U8},
2018
FromRaw, MemoryExt, Repr, Slice, StaticSize, ToRaw, Vector,
2119
};
2220
use mpz_vm_core::{prelude::*, CallBuilder, CallError, Vm};
23-
use std::collections::VecDeque;
21+
use std::{collections::VecDeque, sync::Arc};
2422

2523
/// Provides computation of 2PC ciphers in counter and ECB mode.
2624
///
@@ -179,7 +177,7 @@ where
179177
return Err(CipherError::new("no keystream material available"));
180178
}
181179

182-
let xor = build_xor_circuit(&[ValueType::new_array::<u8>(self.block_size())]);
180+
let xor = Arc::new(xor(8 * self.block_size()));
183181
let mut pos = 0;
184182
let mut outputs = Vec::with_capacity(self.blocks.len());
185183
for block in &self.blocks {

crates/components/deap/src/lib.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::{
1313
};
1414

1515
use async_trait::async_trait;
16-
use mpz_common::{scoped_futures::ScopedFutureExt as _, Context};
16+
use mpz_common::Context;
1717
use mpz_core::bitvec::BitVec;
1818
use mpz_vm_core::{
1919
memory::{binary::Binary, DecodeFuture, Memory, Slice, View},
@@ -308,8 +308,8 @@ where
308308
let mut zk = self.zk.clone().try_lock_owned().unwrap();
309309
let mut mpc = self.mpc.clone().try_lock_owned().unwrap();
310310
ctx.try_join(
311-
|ctx| async move { zk.flush(ctx).await }.scope_boxed(),
312-
|ctx| async move { mpc.flush(ctx).await }.scope_boxed(),
311+
async move |ctx| zk.flush(ctx).await,
312+
async move |ctx| mpc.flush(ctx).await,
313313
)
314314
.await
315315
.map_err(VmError::execute)??;
@@ -326,8 +326,8 @@ where
326326
let mut zk = self.zk.clone().try_lock_owned().unwrap();
327327
let mut mpc = self.mpc.clone().try_lock_owned().unwrap();
328328
ctx.try_join(
329-
|ctx| async move { zk.preprocess(ctx).await }.scope_boxed(),
330-
|ctx| async move { mpc.preprocess(ctx).await }.scope_boxed(),
329+
async move |ctx| zk.preprocess(ctx).await,
330+
async move |ctx| mpc.preprocess(ctx).await,
331331
)
332332
.await
333333
.map_err(VmError::execute)??;
@@ -360,29 +360,28 @@ mod tests {
360360
use mpz_circuits::circuits::AES128;
361361
use mpz_common::context::test_st_context;
362362
use mpz_core::Block;
363-
use mpz_garble::protocol::semihonest::{Evaluator, Generator};
363+
use mpz_garble::protocol::semihonest::{Evaluator, Garbler};
364364
use mpz_ot::ideal::{cot::ideal_cot, rcot::ideal_rcot};
365365
use mpz_vm_core::{
366366
memory::{binary::U8, correlated::Delta, Array},
367367
prelude::*,
368368
};
369369
use mpz_zk::{Prover, Verifier};
370370
use rand::{rngs::StdRng, SeedableRng};
371-
use rand06_compat::Rand0_6CompatExt;
372371

373372
use super::*;
374373

375374
#[tokio::test]
376375
async fn test_deap() {
377376
let mut rng = StdRng::seed_from_u64(0);
378-
let delta_mpc = Delta::random(&mut rng.compat_by_ref());
379-
let delta_zk = Delta::random(&mut rng.compat_by_ref());
377+
let delta_mpc = Delta::random(&mut rng);
378+
let delta_zk = Delta::random(&mut rng);
380379

381380
let (mut ctx_a, mut ctx_b) = test_st_context(8);
382381
let (rcot_send, rcot_recv) = ideal_rcot(Block::ZERO, delta_zk.into_inner());
383382
let (cot_send, cot_recv) = ideal_cot(delta_mpc.into_inner());
384383

385-
let gb = Generator::new(cot_send, [0u8; 16], delta_mpc);
384+
let gb = Garbler::new(cot_send, [0u8; 16], delta_mpc);
386385
let ev = Evaluator::new(cot_recv);
387386
let prover = Prover::new(rcot_recv);
388387
let verifier = Verifier::new(delta_zk, rcot_send);
@@ -457,14 +456,14 @@ mod tests {
457456
#[tokio::test]
458457
async fn test_malicious() {
459458
let mut rng = StdRng::seed_from_u64(0);
460-
let delta_mpc = Delta::random(&mut rng.compat_by_ref());
461-
let delta_zk = Delta::random(&mut rng.compat_by_ref());
459+
let delta_mpc = Delta::random(&mut rng);
460+
let delta_zk = Delta::random(&mut rng);
462461

463462
let (mut ctx_a, mut ctx_b) = test_st_context(8);
464463
let (rcot_send, rcot_recv) = ideal_rcot(Block::ZERO, delta_zk.into_inner());
465464
let (cot_send, cot_recv) = ideal_cot(delta_mpc.into_inner());
466465

467-
let gb = Generator::new(cot_send, [0u8; 16], delta_mpc);
466+
let gb = Garbler::new(cot_send, [1u8; 16], delta_mpc);
468467
let ev = Evaluator::new(cot_recv);
469468
let prover = Prover::new(rcot_recv);
470469
let verifier = Verifier::new(delta_zk, rcot_send);

crates/components/key-exchange/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ tracing = { workspace = true }
3333
rand = { workspace = true }
3434
rand06-compat = { workspace = true }
3535
tokio = { workspace = true, features = ["sync"] }
36+
itybity = { workspace = true }
3637

3738
[dev-dependencies]
3839
mpz-ot = { workspace = true, features = ["ideal"] }

0 commit comments

Comments
 (0)