Trait seec::protocols::Protocol

source ·
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§

source

type Plain: Plain

source

type Share: Share<Plain = Self::Plain>

source

type Msg: RemoteSend + Clone

source

type SimdMsg: RemoteSend + Clone

source

type Gate: Gate<Self::Plain>

source

type Wire

source

type ShareStorage: ShareStorage<Self::Share>

source

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§

source

const SIMD_SUPPORT: bool = false

Required Methods§

source

fn share_constant( &self, party_id: usize, output_share: Self::Share, val: Self::Plain ) -> Self::Share

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

source

fn evaluate_non_interactive( &self, party_id: usize, gate: &Self::Gate, inputs: impl Iterator<Item = Self::Share> ) -> Self::Share

source

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

source

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§

source

fn share_constant_simd( &self, party_id: usize, _output_share: &SimdShareOf<Self::Share>, val: Self::Plain, simd_len: NonZeroUsize ) -> SimdShareOf<Self::Share>

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.

source

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

source

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

source

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>

source

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.

Implementors§