Skip to content

Commit

Permalink
Adapt mpz-ole to use new random OT.
Browse files Browse the repository at this point in the history
  • Loading branch information
th4s committed May 28, 2024
1 parent 6f4d6c7 commit 3844d15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions crates/mpz-ole/src/rot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ mod tests {
let (mut ctx_sender, mut ctx_receiver) = test_st_executor(10);

tokio::try_join!(
ole_sender.preprocess::<_, [u8; 32]>(&mut ctx_sender, count),
ole_receiver.preprocess::<_, [u8; 32]>(&mut ctx_receiver, count)
ole_sender.preprocess(&mut ctx_sender, count),
ole_receiver.preprocess(&mut ctx_receiver, count)
)
.unwrap();

Expand Down
7 changes: 3 additions & 4 deletions crates/mpz-ole/src/rot/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ where
/// # Arguments
///
/// * `count` - The number of OLEs to preprocess.
pub async fn preprocess<Ctx: Context, U>(
pub async fn preprocess<Ctx: Context>(
&mut self,
ctx: &mut Ctx,
count: usize,
) -> Result<(), OLEError>
where
T: RandomOTReceiver<Ctx, bool, U> + Send,
U: Into<Array<u8, F::ByteSize>> + Send + Sync,
T: RandomOTReceiver<Ctx, bool, Array<u8, F::ByteSize>> + Send,
{
let random_ot = self
.rot_receiver
Expand All @@ -56,7 +55,7 @@ where
let rot_msg: Vec<F> = random_ot
.msgs
.into_iter()
.map(|f| F::try_from(f.into()))
.map(|f| F::try_from(f))
.collect::<Result<Vec<F>, _>>()?;

let rot_choices: Vec<F> = random_ot
Expand Down
9 changes: 4 additions & 5 deletions crates/mpz-ole/src/rot/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ where
/// # Arguments
///
/// * `count` - The number of OLEs to preprocess.
pub async fn preprocess<Ctx: Context, U>(
pub async fn preprocess<Ctx: Context>(
&mut self,
ctx: &mut Ctx,
count: usize,
) -> Result<(), OLEError>
where
T: RandomOTSender<Ctx, [U; 2]> + Send,
U: Into<Array<u8, F::ByteSize>>,
T: RandomOTSender<Ctx, [Array<u8, F::ByteSize>; 2]> + Send,
{
let random = {
let mut rng = thread_rng();
Expand All @@ -60,8 +59,8 @@ where
.msgs
.into_iter()
.map(|[a, b]| {
let a = F::try_from(a.into())?;
let b = F::try_from(b.into())?;
let a = F::try_from(a)?;
let b = F::try_from(b)?;

Ok::<[F; 2], OLEError>([a, b])
})
Expand Down

0 comments on commit 3844d15

Please sign in to comment.