pub trait Protocol: Send + Sync {
type Plain: Plain;
type Share: Share<Plain = Self::Plain>;
type Msg: RemoteSend + Clone;
type SimdMsg: RemoteSend + Clone;
type Gate: Gate<Self::Plain>;
type Wire;
type ShareStorage: ShareStorage<Self::Share>;
type SetupStorage: SetupStorage;
const SIMD_SUPPORT: bool = false;
// Required methods
fn share_constant(
&self,
party_id: usize,
output_share: Self::Share,
val: Self::Plain
) -> Self::Share;
fn evaluate_non_interactive(
&self,
party_id: usize,
gate: &Self::Gate,
inputs: impl Iterator<Item = Self::Share>
) -> Self::Share;
fn compute_msg(
&self,
party_id: usize,
interactive_gates: impl Iterator<Item = Self::Gate>,
gate_outputs: impl Iterator<Item = Self::Share>,
inputs: impl Iterator<Item = Self::Share>,
preprocessing_data: &mut Self::SetupStorage
) -> Self::Msg;
fn evaluate_interactive(
&self,
party_id: usize,
interactive_gates: impl Iterator<Item = Self::Gate>,
gate_outputs: impl Iterator<Item = Self::Share>,
own_msg: Self::Msg,
other_msg: Self::Msg,
preprocessing_data: &mut Self::SetupStorage
) -> Self::ShareStorage;
// Provided methods
fn share_constant_simd(
&self,
party_id: usize,
_output_share: &SimdShareOf<Self::Share>,
val: Self::Plain,
simd_len: NonZeroUsize
) -> SimdShareOf<Self::Share> { ... }
fn evaluate_non_interactive_simd<'e>(
&self,
party_id: usize,
gate: &Self::Gate,
inputs: impl Iterator<Item = &'e <Self::Share as Share>::SimdShare>
) -> <Self::Share as Share>::SimdShare { ... }
fn compute_msg_simd<'e>(
&self,
_party_id: usize,
_interactive_gates: impl Iterator<Item = Self::Gate>,
_gate_outputs: impl Iterator<Item = &'e SimdShareOf<Self::Share>>,
_inputs: impl Iterator<Item = &'e SimdShareOf<Self::Share>>,
_preprocessing_data: &mut Self::SetupStorage
) -> Self::SimdMsg { ... }
fn evaluate_interactive_simd<'e>(
&self,
_party_id: usize,
_interactive_gates: impl Iterator<Item = Self::Gate>,
_gate_outputs: impl Iterator<Item = &'e SimdShareOf<Self::Share>>,
_own_msg: Self::SimdMsg,
_other_msg: Self::SimdMsg,
_preprocessing_data: &mut Self::SetupStorage
) -> Vec<Self::ShareStorage> { ... }
fn setup_gate_outputs<Idx: GateIdx>(
&mut self,
_party_id: usize,
circuit: &ExecutableCircuit<Self::Plain, Self::Gate, Idx>
) -> GateOutputs<Self::ShareStorage> { ... }
}
Required Associated Types§
type Plain: Plain
type Msg: RemoteSend + Clone
type SimdMsg: RemoteSend + Clone
type Gate: Gate<Self::Plain>
type Wire
sourcetype SetupStorage: SetupStorage
type SetupStorage: SetupStorage
The type which provides the data needed to evaluate interactive gate. In the case of normal GMW, this data is multiplication triples.
Provided Associated Constants§
const SIMD_SUPPORT: bool = false
Required Methods§
output_share is the share initialized for the constant gate by Protocol::setup_gate_outputs
.
This way, the conversion of a plain constant value to a shared
fn evaluate_non_interactive( &self, party_id: usize, gate: &Self::Gate, inputs: impl Iterator<Item = Self::Share> ) -> Self::Share
fn compute_msg( &self, party_id: usize, interactive_gates: impl Iterator<Item = Self::Gate>, gate_outputs: impl Iterator<Item = Self::Share>, inputs: impl Iterator<Item = Self::Share>, preprocessing_data: &mut Self::SetupStorage ) -> Self::Msg
fn evaluate_interactive( &self, party_id: usize, interactive_gates: impl Iterator<Item = Self::Gate>, gate_outputs: impl Iterator<Item = Self::Share>, own_msg: Self::Msg, other_msg: Self::Msg, preprocessing_data: &mut Self::SetupStorage ) -> Self::ShareStorage
Provided Methods§
Default implementation uses Protocol::share_constant
with a default constructed
output_share. Overwrite this method if you need to use the SIMD output_share to properly
share the SIMD constant.
fn evaluate_non_interactive_simd<'e>( &self, party_id: usize, gate: &Self::Gate, inputs: impl Iterator<Item = &'e <Self::Share as Share>::SimdShare> ) -> <Self::Share as Share>::SimdShare
fn compute_msg_simd<'e>( &self, _party_id: usize, _interactive_gates: impl Iterator<Item = Self::Gate>, _gate_outputs: impl Iterator<Item = &'e SimdShareOf<Self::Share>>, _inputs: impl Iterator<Item = &'e SimdShareOf<Self::Share>>, _preprocessing_data: &mut Self::SetupStorage ) -> Self::SimdMsg
fn evaluate_interactive_simd<'e>( &self, _party_id: usize, _interactive_gates: impl Iterator<Item = Self::Gate>, _gate_outputs: impl Iterator<Item = &'e SimdShareOf<Self::Share>>, _own_msg: Self::SimdMsg, _other_msg: Self::SimdMsg, _preprocessing_data: &mut Self::SetupStorage ) -> Vec<Self::ShareStorage>
fn setup_gate_outputs<Idx: GateIdx>( &mut self, _party_id: usize, circuit: &ExecutableCircuit<Self::Plain, Self::Gate, Idx> ) -> GateOutputs<Self::ShareStorage>
Object Safety§
This trait is not object safe.