diff --git a/actor-ot/src/lib.rs b/actor-ot/src/lib.rs index fde55c317..7ecad932d 100644 --- a/actor-ot/src/lib.rs +++ b/actor-ot/src/lib.rs @@ -178,7 +178,7 @@ mod test { let send = async { sender.send(data).await.unwrap() }; - let receive = async { receiver.receive(&choices).await.unwrap() }; + let receive = async { receiver.receive(choices).await.unwrap() }; let (_, received) = futures::join!(send, receive); @@ -287,7 +287,7 @@ mod test { let choices = vec![false; split_size]; let (send, receive) = - tokio::join!(sender.send(messages.clone()), receiver.receive(&choices)); + tokio::join!(sender.send(messages.clone()), receiver.receive(choices)); send.unwrap(); _ = receive.unwrap(); diff --git a/actor-ot/src/receiver.rs b/actor-ot/src/receiver.rs index 0222f1735..070d65b85 100644 --- a/actor-ot/src/receiver.rs +++ b/actor-ot/src/receiver.rs @@ -13,6 +13,7 @@ use crate::{config::ReceiverFactoryConfig, GetReceiver, Setup}; use mpc_core::{ msgs::ot::{OTFactoryMessage, OTMessage, Split}, ot::r_state::RandSetup, + Block, }; use utils_aio::{mux::MuxChannelControl, Channel}; @@ -241,7 +242,7 @@ impl ReceiverFactoryControl where T: Handler> + Handler>>, - S: ObliviousReceive, + S: ObliviousReceive, { pub fn new(addr: Address) -> Self { Self(addr) @@ -272,7 +273,7 @@ where } #[async_trait] -impl OTReceiverFactory for ReceiverFactoryControl> +impl OTReceiverFactory for ReceiverFactoryControl> where T: Channel + Send + 'static, U: MuxChannelControl + Send + 'static, diff --git a/actor-ot/src/sender.rs b/actor-ot/src/sender.rs index 616548e43..bab35af1c 100644 --- a/actor-ot/src/sender.rs +++ b/actor-ot/src/sender.rs @@ -11,6 +11,7 @@ use crate::{config::SenderFactoryConfig, GetSender, Setup, Verify}; use mpc_core::{ msgs::ot::{OTFactoryMessage, OTMessage, Split}, ot::s_state::RandSetup, + Block, }; use utils_aio::{mux::MuxChannelControl, Channel}; @@ -197,7 +198,7 @@ impl SenderFactoryControl where T: Handler> + Handler>, - S: ObliviousSend, + S: ObliviousSend<[Block; 2]>, { pub fn new(addr: Address) -> Self { Self(addr) @@ -226,7 +227,7 @@ where } #[async_trait] -impl OTSenderFactory for SenderFactoryControl> +impl OTSenderFactory<[Block; 2]> for SenderFactoryControl> where T: Channel + Send + 'static, U: MuxChannelControl + Send + 'static, diff --git a/mpc-aio/src/protocol/garble/exec/dual.rs b/mpc-aio/src/protocol/garble/exec/dual.rs index faa9f51b2..9da258395 100644 --- a/mpc-aio/src/protocol/garble/exec/dual.rs +++ b/mpc-aio/src/protocol/garble/exec/dual.rs @@ -8,23 +8,23 @@ use std::sync::Arc; -use crate::protocol::garble::{ - label::{WireLabelOTReceive, WireLabelOTSend}, - Evaluator, ExecuteWithLabels, GCError, GarbleChannel, GarbleMessage, Generator, +use crate::protocol::{ + garble::{Evaluator, ExecuteWithLabels, GCError, GarbleChannel, GarbleMessage, Generator}, + ot::{ObliviousReceive, ObliviousSend}, }; use async_trait::async_trait; use futures::{SinkExt, StreamExt}; use mpc_circuits::{Circuit, InputValue}; use mpc_core::garble::{ - exec::dual as core, gc_state, Delta, GarbledCircuit, InputLabels, WireLabelPair, + exec::dual as core, gc_state, Delta, GarbledCircuit, InputLabels, WireLabel, WireLabelPair, }; use utils_aio::expect_msg_or_err; pub struct DualExLeader where B: Generator + Evaluator, - S: WireLabelOTSend, - R: WireLabelOTReceive, + S: ObliviousSend>, + R: ObliviousReceive>, { channel: GarbleChannel, backend: B, @@ -35,8 +35,8 @@ where impl DualExLeader where B: Generator + Evaluator + Send, - S: WireLabelOTSend + Send, - R: WireLabelOTReceive + Send, + S: ObliviousSend> + Send, + R: ObliviousReceive> + Send, { pub fn new(channel: GarbleChannel, backend: B, label_sender: S, label_receiver: R) -> Self { Self { @@ -52,8 +52,8 @@ where impl ExecuteWithLabels for DualExLeader where B: Generator + Evaluator + Send, - S: WireLabelOTSend + Send, - R: WireLabelOTReceive + Send, + S: ObliviousSend> + Send, + R: ObliviousReceive> + Send, { async fn execute_with_labels( &mut self, @@ -84,7 +84,7 @@ where .cloned() .collect::>>(); - self.label_sender.send_labels(follower_labels).await?; + self.label_sender.send(follower_labels).await?; let msg = expect_msg_or_err!( self.channel.next().await, @@ -93,7 +93,7 @@ where )?; let gc_ev = GarbledCircuit::::from_unchecked(circ, msg.into())?; - let labels_ev = self.label_receiver.receive_labels(inputs.to_vec()).await?; + let labels_ev = self.label_receiver.receive(inputs.to_vec()).await?; let evaluated_gc = self.backend.evaluate(gc_ev, &labels_ev).await?; let leader = leader.from_evaluated_circuit(evaluated_gc)?; @@ -124,8 +124,8 @@ where pub struct DualExFollower where B: Generator + Evaluator, - S: WireLabelOTSend, - R: WireLabelOTReceive, + S: ObliviousSend>, + R: ObliviousReceive>, { channel: GarbleChannel, backend: B, @@ -136,8 +136,8 @@ where impl DualExFollower where B: Generator + Evaluator + Send, - S: WireLabelOTSend + Send, - R: WireLabelOTReceive + Send, + S: ObliviousSend> + Send, + R: ObliviousReceive> + Send, { pub fn new(channel: GarbleChannel, backend: B, label_sender: S, label_receiver: R) -> Self { Self { @@ -153,8 +153,8 @@ where impl ExecuteWithLabels for DualExFollower where B: Generator + Evaluator + Send, - S: WireLabelOTSend + Send, - R: WireLabelOTReceive + Send, + S: ObliviousSend> + Send, + R: ObliviousReceive> + Send, { async fn execute_with_labels( &mut self, @@ -185,7 +185,7 @@ where .cloned() .collect::>>(); - self.label_sender.send_labels(leader_labels).await?; + self.label_sender.send(leader_labels).await?; let msg = expect_msg_or_err!( self.channel.next().await, @@ -194,7 +194,7 @@ where )?; let gc_ev = GarbledCircuit::::from_unchecked(circ, msg.into())?; - let labels_ev = self.label_receiver.receive_labels(inputs.to_vec()).await?; + let labels_ev = self.label_receiver.receive(inputs.to_vec()).await?; let evaluated_gc = self.backend.evaluate(gc_ev, &labels_ev).await?; let follower = follower.from_evaluated_circuit(evaluated_gc)?; diff --git a/mpc-aio/src/protocol/garble/label.rs b/mpc-aio/src/protocol/garble/label.rs index 52c74bfc4..3fde40a8b 100644 --- a/mpc-aio/src/protocol/garble/label.rs +++ b/mpc-aio/src/protocol/garble/label.rs @@ -1,4 +1,4 @@ -use crate::protocol::ot; +use crate::protocol::ot::{OTError, ObliviousReceive, ObliviousSend, ObliviousVerify}; use async_trait::async_trait; use mpc_circuits::InputValue; use mpc_core::{ @@ -9,58 +9,46 @@ use mpc_core::{ #[derive(Debug, thiserror::Error)] pub enum WireLabelError { #[error("error occurred during OT")] - OTError(#[from] ot::OTError), + OTError(#[from] OTError), #[error("core error")] CoreError(#[from] mpc_core::garble::Error), } #[async_trait] -pub trait WireLabelOTSend: ot::ObliviousSend> { - /// Sends labels using oblivious transfer - /// - /// Inputs must be provided sorted ascending by input id - async fn send_labels( - &mut self, - inputs: Vec>, - ) -> Result<(), WireLabelError> { +impl ObliviousSend> for T +where + T: Send + ObliviousSend<[Block; 2]>, +{ + async fn send(&mut self, inputs: Vec>) -> Result<(), OTError> { self.send( inputs .into_iter() - .map(|labels| { - labels - .as_ref() - .iter() - .map(|pair| [*pair.low(), *pair.high()]) - .collect::>() - }) + .map(|labels| labels.to_blocks()) .flatten() .collect::>(), ) .await - .map_err(WireLabelError::from) } } -impl WireLabelOTSend for T where T: ot::ObliviousSend> {} - #[async_trait] -pub trait WireLabelOTReceive: ot::ObliviousReceive> { - /// Receives labels using oblivious transfer - /// - /// Inputs must be provided sorted ascending by input id - async fn receive_labels( +impl ObliviousReceive> for T +where + T: Send + ObliviousReceive, +{ + async fn receive( &mut self, - inputs: Vec, - ) -> Result>, WireLabelError> { - let choices = inputs + choices: Vec, + ) -> Result>, OTError> { + let choice_bits = choices .iter() .map(|value| value.wire_values()) .flatten() .collect::>(); - let mut labels = self.receive(&choices).await?; + let mut labels = self.receive(choice_bits).await?; - inputs + Ok(choices .into_iter() .map(|value| { InputLabels::new( @@ -71,13 +59,28 @@ pub trait WireLabelOTReceive: ot::ObliviousReceive>(), ) - .map_err(WireLabelError::from) + .expect("Input labels should be valid") }) - .collect::>, WireLabelError>>() + .collect()) } } -impl WireLabelOTReceive for T where T: ot::ObliviousReceive> {} +#[async_trait] +impl ObliviousVerify> for T +where + T: Send + ObliviousVerify<[Block; 2]>, +{ + async fn verify(self, input: Vec>) -> Result<(), OTError> { + self.verify( + input + .into_iter() + .map(|labels| labels.to_blocks()) + .flatten() + .collect(), + ) + .await + } +} #[cfg(test)] mod tests { @@ -95,8 +98,8 @@ mod tests { let expected = receiver_labels[0].select(&value).unwrap(); let (mut sender, mut receiver) = mock_ot_pair::(); - sender.send_labels(receiver_labels).await.unwrap(); - let received = receiver.receive_labels(vec![value]).await.unwrap(); + sender.send(receiver_labels).await.unwrap(); + let received = receiver.receive(vec![value]).await.unwrap(); assert_eq!(received[0].as_ref(), expected.as_ref()); } diff --git a/mpc-aio/src/protocol/garble/mod.rs b/mpc-aio/src/protocol/garble/mod.rs index 72bebe948..08913ba56 100644 --- a/mpc-aio/src/protocol/garble/mod.rs +++ b/mpc-aio/src/protocol/garble/mod.rs @@ -15,6 +15,8 @@ use mpc_core::{ use rand::thread_rng; use utils_aio::Channel; +use super::ot::OTError; + pub type GarbleChannel = Box>; #[derive(Debug, thiserror::Error)] @@ -26,7 +28,7 @@ pub enum GCError { #[error("io error")] IOError(#[from] std::io::Error), #[error("ot error")] - LabelOTError(#[from] label::WireLabelError), + OTError(#[from] OTError), #[error("Received unexpected message: {0:?}")] Unexpected(GarbleMessage), #[error("backend error")] diff --git a/mpc-aio/src/protocol/ot/kos/mod.rs b/mpc-aio/src/protocol/ot/kos/mod.rs index a88eba32e..a94df082b 100644 --- a/mpc-aio/src/protocol/ot/kos/mod.rs +++ b/mpc-aio/src/protocol/ot/kos/mod.rs @@ -35,7 +35,7 @@ mod tests { }); let receive = tokio::spawn(async move { let mut receiver = receiver.rand_setup(ITERATIONS).await.unwrap(); - receiver.receive(&choices).await.unwrap() + receiver.receive(choices).await.unwrap() }); let (_, output) = tokio::join!(send, receive); @@ -70,7 +70,7 @@ mod tests { let receive = tokio::spawn(async move { receiver.accept_commit().await.unwrap(); let mut receiver = receiver.rand_setup(ITERATIONS).await.unwrap(); - let ot_output = receiver.receive(&choices).await.unwrap(); + let ot_output = receiver.receive(choices).await.unwrap(); let verification = receiver.verify(blocks).await; (ot_output, verification) }); diff --git a/mpc-aio/src/protocol/ot/kos/receiver.rs b/mpc-aio/src/protocol/ot/kos/receiver.rs index d7fee25a9..5e59de4b4 100644 --- a/mpc-aio/src/protocol/ot/kos/receiver.rs +++ b/mpc-aio/src/protocol/ot/kos/receiver.rs @@ -93,11 +93,8 @@ impl Kos15IOReceiver { } #[async_trait] -impl ObliviousReceive for Kos15IOReceiver { - type Choice = bool; - type Outputs = Vec; - - async fn receive(&mut self, choices: &[bool]) -> Result { +impl ObliviousReceive for Kos15IOReceiver { + async fn receive(&mut self, choices: Vec) -> Result, OTError> { let message = self.inner.derandomize(&choices)?; self.channel .send(OTMessage::ExtDerandomize(message)) @@ -127,10 +124,8 @@ impl ObliviousAcceptCommit for Kos15IOReceiver { } #[async_trait] -impl ObliviousVerify for Kos15IOReceiver { - type Input = [Block; 2]; - - async fn verify(mut self, input: Vec) -> Result<(), OTError> { +impl ObliviousVerify<[Block; 2]> for Kos15IOReceiver { + async fn verify(mut self, input: Vec<[Block; 2]>) -> Result<(), OTError> { let reveal = expect_msg_or_err!( self.channel.next().await, OTMessage::ExtSenderReveal, diff --git a/mpc-aio/src/protocol/ot/kos/sender.rs b/mpc-aio/src/protocol/ot/kos/sender.rs index cc2c4d5ef..b2f6f235e 100644 --- a/mpc-aio/src/protocol/ot/kos/sender.rs +++ b/mpc-aio/src/protocol/ot/kos/sender.rs @@ -105,10 +105,8 @@ impl Kos15IOSender { } #[async_trait] -impl ObliviousSend for Kos15IOSender { - type Inputs = Vec<[Block; 2]>; - - async fn send(&mut self, inputs: Self::Inputs) -> Result<(), OTError> { +impl ObliviousSend<[Block; 2]> for Kos15IOSender { + async fn send(&mut self, inputs: Vec<[Block; 2]>) -> Result<(), OTError> { let message = expect_msg_or_err!( self.channel.next().await, OTMessage::ExtDerandomize, diff --git a/mpc-aio/src/protocol/ot/mock.rs b/mpc-aio/src/protocol/ot/mock.rs index d44a0cef8..d1794eaed 100644 --- a/mpc-aio/src/protocol/ot/mock.rs +++ b/mpc-aio/src/protocol/ot/mock.rs @@ -1,7 +1,8 @@ use std::sync::{Arc, Mutex}; use super::{ - OTError, OTFactoryError, OTReceiverFactory, OTSenderFactory, ObliviousReceive, ObliviousSend, + OTError, OTFactoryError, OTReceiverFactory, OTSenderFactory, ObliviousReceive, ObliviousReveal, + ObliviousSend, ObliviousVerify, }; use async_trait::async_trait; use futures::{channel::mpsc, StreamExt}; @@ -13,7 +14,7 @@ pub struct MockOTFactory { } #[async_trait] -impl OTSenderFactory for Arc>> { +impl OTSenderFactory<[T; 2]> for Arc>> { type Protocol = MockOTSender; async fn new_sender( @@ -33,7 +34,7 @@ impl OTSenderFactory for Arc>> { } #[async_trait] -impl OTReceiverFactory for Arc>> { +impl OTReceiverFactory for Arc>> { type Protocol = MockOTReceiver; async fn new_receiver( @@ -66,13 +67,11 @@ pub fn mock_ot_pair() -> (MockOTSender, MockOTReceiver) } #[async_trait] -impl ObliviousSend for MockOTSender +impl ObliviousSend<[T; 2]> for MockOTSender where T: Send + 'static, { - type Inputs = Vec<[T; 2]>; - - async fn send(&mut self, inputs: Self::Inputs) -> Result<(), OTError> { + async fn send(&mut self, inputs: Vec<[T; 2]>) -> Result<(), OTError> { self.sender .try_send(inputs) .expect("DummySender should be able to send"); @@ -81,14 +80,11 @@ where } #[async_trait] -impl ObliviousReceive for MockOTReceiver +impl ObliviousReceive for MockOTReceiver where T: Send + 'static, { - type Choice = bool; - type Outputs = Vec; - - async fn receive(&mut self, choices: &[bool]) -> Result, OTError> { + async fn receive(&mut self, choices: Vec) -> Result, OTError> { let payload = self .receiver .next() @@ -99,7 +95,7 @@ where .zip(choices) .map(|(v, c)| { let [low, high] = v; - if *c { + if c { high } else { low @@ -109,6 +105,27 @@ where } } +#[async_trait] +impl ObliviousVerify<[T; 2]> for MockOTReceiver +where + T: Send + 'static, +{ + async fn verify(self, _input: Vec<[T; 2]>) -> Result<(), OTError> { + // MockOT is always honest + Ok(()) + } +} + +#[async_trait] +impl ObliviousReveal for MockOTSender +where + T: Send + 'static, +{ + async fn reveal(mut self) -> Result<(), OTError> { + Ok(()) + } +} + #[cfg(test)] mod tests { use super::*; @@ -121,7 +138,7 @@ mod tests { sender.send(values).await.unwrap(); - let received = receiver.receive(&choice).await.unwrap(); + let received = receiver.receive(choice).await.unwrap(); assert_eq!(received, vec![0, 3]); } } diff --git a/mpc-aio/src/protocol/ot/mod.rs b/mpc-aio/src/protocol/ot/mod.rs index 8f91ce7d5..f01bbd85c 100644 --- a/mpc-aio/src/protocol/ot/mod.rs +++ b/mpc-aio/src/protocol/ot/mod.rs @@ -49,18 +49,13 @@ pub enum OTFactoryError { } #[async_trait] -pub trait ObliviousSend { - type Inputs; - - async fn send(&mut self, inputs: Self::Inputs) -> Result<(), OTError>; +pub trait ObliviousSend { + async fn send(&mut self, inputs: Vec) -> Result<(), OTError>; } #[async_trait] -pub trait ObliviousReceive { - type Choice; - type Outputs; - - async fn receive(&mut self, choices: &[Self::Choice]) -> Result; +pub trait ObliviousReceive { + async fn receive(&mut self, choices: Vec) -> Result, OTError>; } #[async_trait] @@ -82,16 +77,14 @@ pub trait ObliviousAcceptCommit { } #[async_trait] -pub trait ObliviousVerify { - type Input; - +pub trait ObliviousVerify { /// Verifies the correctness of the revealed OT seed - async fn verify(self, input: Vec) -> Result<(), OTError>; + async fn verify(self, input: Vec) -> Result<(), OTError>; } #[async_trait] -pub trait OTSenderFactory { - type Protocol: ObliviousSend + Send; +pub trait OTSenderFactory { + type Protocol: ObliviousSend + Send; /// Constructs a new Sender /// @@ -105,8 +98,8 @@ pub trait OTSenderFactory { } #[async_trait] -pub trait OTReceiverFactory { - type Protocol: ObliviousReceive + Send; +pub trait OTReceiverFactory { + type Protocol: ObliviousReceive + Send; /// Constructs a new Receiver /// @@ -124,9 +117,7 @@ mockall::mock! { pub ObliviousSender {} #[async_trait] - impl ObliviousSend for ObliviousSender { - type Inputs = Vec<[mpc_core::Block; 2]>; - + impl ObliviousSend<[mpc_core::Block; 2]> for ObliviousSender { async fn send( &mut self, inputs: Vec<[mpc_core::Block; 2]>, @@ -139,13 +130,10 @@ mockall::mock! { pub ObliviousReceiver {} #[async_trait] - impl ObliviousReceive for ObliviousReceiver { - type Choice = bool; - type Outputs = Vec; - + impl ObliviousReceive for ObliviousReceiver { async fn receive( &mut self, - choices: &[bool], + choices: Vec, ) -> Result, OTError>; } } diff --git a/mpc-core/src/garble/label/input.rs b/mpc-core/src/garble/label/input.rs index 81fb5b2c5..6f5306028 100644 --- a/mpc-core/src/garble/label/input.rs +++ b/mpc-core/src/garble/label/input.rs @@ -63,6 +63,14 @@ where } impl InputLabels { + /// Returns input labels in block representation + pub fn to_blocks(self) -> Vec<[Block; 2]> { + self.labels + .into_iter() + .map(|labels| labels.to_inner()) + .collect() + } + /// Generates a full set of input [`WireLabelPair`] for the provided [`Circuit`] pub fn generate( rng: &mut R, diff --git a/mpc-core/src/garble/label/mod.rs b/mpc-core/src/garble/label/mod.rs index 87890e011..37f77b1ec 100644 --- a/mpc-core/src/garble/label/mod.rs +++ b/mpc-core/src/garble/label/mod.rs @@ -65,6 +65,12 @@ impl WireLabel { Self { id, value } } + /// Returns inner block + #[inline] + pub fn to_inner(self) -> Block { + self.value + } + /// Returns wire id of label #[inline] pub fn id(&self) -> usize { @@ -144,6 +150,12 @@ impl WireLabelPair { Self { id, low, high } } + /// Returns inner blocks + #[inline] + pub fn to_inner(self) -> [Block; 2] { + [self.low, self.high] + } + /// Generates pairs of wire labels \[W_0, W_0 ^ delta\] pub fn generate( rng: &mut R, diff --git a/share-conversion-aio/src/gf2_128/receiver.rs b/share-conversion-aio/src/gf2_128/receiver.rs index 620d5d8eb..e203cb4e5 100644 --- a/share-conversion-aio/src/gf2_128/receiver.rs +++ b/share-conversion-aio/src/gf2_128/receiver.rs @@ -13,7 +13,7 @@ use mpc_core::Block; /// The receiver for the conversion /// /// Will be the OT receiver -pub struct Receiver { +pub struct Receiver, U: Gf2_128ShareConvert, V = Void> { /// Provides initialized OTs for the OT receiver receiver_factory: T, id: String, @@ -24,12 +24,8 @@ pub struct Receiver { counter: usize, } -impl< - T: OTReceiverFactory + Send, - U: ObliviousReceive>, - V: Gf2_128ShareConvert, - W: Recorder, - > Receiver +impl + Send, V: Gf2_128ShareConvert, W: Recorder> + Receiver { /// Create a new receiver pub fn new(receiver_factory: T, id: String, channel: Gf2ConversionChannel) -> Self { @@ -64,7 +60,7 @@ impl< .await?; self.counter += 1; - let ot_output = ot_receiver.receive(&choices).await?; + let ot_output = ot_receiver.receive(choices).await?; // Aggregate chunks of OTs to get back u128 values let converted_shares = ot_output @@ -80,11 +76,8 @@ impl< } #[async_trait] -impl< - T: OTReceiverFactory + Send, - U: ObliviousReceive> + Send, - V: Recorder + Send, - > AdditiveToMultiplicative for Receiver +impl + Send, V: Recorder + Send> + AdditiveToMultiplicative for Receiver { type FieldElement = u128; @@ -99,11 +92,8 @@ impl< } #[async_trait] -impl< - T: OTReceiverFactory + Send, - U: ObliviousReceive> + Send, - V: Recorder + Send, - > MultiplicativeToAdditive for Receiver +impl + Send, V: Recorder + Send> + MultiplicativeToAdditive for Receiver { type FieldElement = u128; @@ -120,7 +110,7 @@ impl< #[async_trait] impl VerifyTape for Receiver where - T: OTReceiverFactory + Send, + T: OTReceiverFactory + Send, U: Gf2_128ShareConvert + Send, { async fn verify_tape(mut self) -> Result<(), ShareConversionError> { diff --git a/share-conversion-aio/src/gf2_128/sender.rs b/share-conversion-aio/src/gf2_128/sender.rs index ac514962a..7f032d3dd 100644 --- a/share-conversion-aio/src/gf2_128/sender.rs +++ b/share-conversion-aio/src/gf2_128/sender.rs @@ -8,6 +8,7 @@ use crate::{AdditiveToMultiplicative, MultiplicativeToAdditive, ShareConversionE use async_trait::async_trait; use futures::SinkExt; use mpc_aio::protocol::ot::{OTSenderFactory, ObliviousSend}; +use mpc_core::Block; use rand::SeedableRng; use rand_chacha::ChaCha12Rng; use utils_aio::adaptive_barrier::AdaptiveBarrier; @@ -17,7 +18,7 @@ use utils_aio::adaptive_barrier::AdaptiveBarrier; /// Will be the OT sender pub struct Sender where - T: OTSenderFactory, + T: OTSenderFactory<[Block; 2]>, U: Gf2_128ShareConvert, V: Recorder, { @@ -35,8 +36,7 @@ where impl Sender where - T: OTSenderFactory + Send, - <::Protocol as ObliviousSend>::Inputs: From + Send, + T: OTSenderFactory<[Block; 2]> + Send, U: Gf2_128ShareConvert, V: Recorder, { @@ -96,8 +96,7 @@ where #[cfg(test)] impl Sender where - T: OTSenderFactory + Send, - <::Protocol as ObliviousSend>::Inputs: From + Send, + T: OTSenderFactory<[Block; 2]> + Send, U: Gf2_128ShareConvert, { pub fn tape_mut(&mut self) -> &mut Tape { @@ -108,8 +107,7 @@ where #[async_trait] impl AdditiveToMultiplicative for Sender where - T: OTSenderFactory + Send, - <::Protocol as ObliviousSend>::Inputs: From + Send, + T: OTSenderFactory<[Block; 2]> + Send, V: Recorder + Send, { type FieldElement = u128; @@ -127,8 +125,7 @@ where #[async_trait] impl MultiplicativeToAdditive for Sender where - T: OTSenderFactory + Send, - <::Protocol as ObliviousSend>::Inputs: From + Send, + T: OTSenderFactory<[Block; 2]> + Send, V: Recorder + Send, { type FieldElement = u128; @@ -146,7 +143,7 @@ where #[async_trait] impl SendTape for Sender where - T: OTSenderFactory + Send, + T: OTSenderFactory<[Block; 2]> + Send, U: Gf2_128ShareConvert + Send, { async fn send_tape(mut self) -> Result<(), ShareConversionError> {