Trait seec::mul_triple::MTProvider

source ·
pub trait MTProvider {
    type Output;
    type Error;

    // Required methods
    fn precompute_mts<'life0, 'async_trait>(
        &'life0 mut self,
        amount: usize
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn request_mts<'life0, 'async_trait>(
        &'life0 mut self,
        amount: usize
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn into_dyn(
        self
    ) -> Box<dyn MTProvider<Output = Self::Output, Error = BoxError> + Send + 'static>
       where Self: Sized + Send + 'static,
             Self::Error: Error + Send + Sync + 'static { ... }
}
Expand description

Provides a source of multiplication triples.

Required Associated Types§

Required Methods§

source

fn precompute_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn request_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

source

fn into_dyn( self ) -> Box<dyn MTProvider<Output = Self::Output, Error = BoxError> + Send + 'static>
where Self: Sized + Send + 'static, Self::Error: Error + Send + Sync + 'static,

Examples found in repository?
crates/seec/examples/aes_cbc.rs (line 363)
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
async fn encrypt(
    args: &ExecuteArgs,
    mut executor_channel: Channel<Message<BooleanGmw>>,
    ot_channel: Option<Channel<mul_triple::boolean::ot_ext::DefaultMsg>>,
    shared_file: &BitSlice<usize>,
    shared_key: &BitSlice<usize>,
    shared_iv: &BitSlice<usize>,
) -> Result<Output<BitVec<usize>>> {
    let exec_circ: ExecutableCircuit<bool, BooleanGate, usize> = bincode::deserialize_from(
        BufReader::new(File::open(&args.circuit).context("Failed to open circuit file")?),
    )?;

    let mut input = shared_key.to_bitvec();
    input.extend_from_bitslice(shared_iv);
    input.extend_from_bitslice(shared_file);

    let mtp = match ot_channel {
        None => InsecureMTProvider::default().into_dyn(),
        Some(ot_channel) => mul_triple::boolean::ot_ext::OtMTProvider::new_with_default_ot_ext(
            OsRng,
            ot_channel.0,
            ot_channel.1,
        )
        .into_dyn(),
    };

    let mut executor: Executor<BooleanGmw, usize> = Executor::new(&exec_circ, args.id, mtp).await?;
    Ok(executor
        .execute(
            Input::Scalar(input),
            &mut executor_channel.0,
            &mut executor_channel.1,
        )
        .await?)
}

Trait Implementations§

source§

impl<Out, Err> MTProvider for Box<dyn MTProvider<Output = Out, Error = Err> + Send>

§

type Output = Out

§

type Error = Err

source§

fn precompute_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn request_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementations on Foreign Types§

source§

impl<Mtp: MTProvider + Send> MTProvider for &mut Mtp

§

type Output = <Mtp as MTProvider>::Output

§

type Error = <Mtp as MTProvider>::Error

source§

fn precompute_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn request_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<Out, Err> MTProvider for Box<dyn MTProvider<Output = Out, Error = Err> + Send>

§

type Output = Out

§

type Error = Err

source§

fn precompute_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn request_mts<'life0, 'async_trait>( &'life0 mut self, amount: usize ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

source§

impl MTProvider for seec::mul_triple::boolean::insecure_provider::InsecureMTProvider

source§

impl MTProvider for seec::mul_triple::boolean::trusted_provider::TrustedMTProviderClient

source§

impl MTProvider for seec::mul_triple::boolean::trusted_seed_provider::TrustedMTProviderClient

source§

impl<F: Read + Seek + Debug + Send, MulTriples> MTProvider for MTStorage<F, MulTriples>
where MulTriples: DeserializeOwned + SetupStorage,

§

type Output = MulTriples

§

type Error = StorageError

source§

impl<R> MTProvider for InsecureMixedSetup<R>
where R: Ring, Standard: Distribution<R>,

source§

impl<R, RNG, OtS, OtR> MTProvider for seec::mul_triple::arithmetic::ot_ext::OtMTProvider<R, RNG, OtS, OtR>
where R: Ring + From<u8> + Pod, Block: From<R>, Standard: Distribution<R>, RNG: RngCore + CryptoRng + Send, OtS: ExtROTSender<Msg = OtR::Msg> + Send, OtS::Msg: RemoteSend + Debug, OtR: ExtROTReceiver + Send, OtR::Msg: RemoteSend + Debug,

§

type Output = MulTriples<R>

§

type Error = ()

source§

impl<R: Ring> MTProvider for seec::mul_triple::arithmetic::insecure_provider::InsecureMTProvider<R>

source§

impl<RNG, S, R> MTProvider for seec::mul_triple::boolean::ot_ext::OtMTProvider<RNG, S, R>
where RNG: RngCore + CryptoRng + Send, S: ExtROTSender<Msg = R::Msg> + Send, S::Msg: RemoteSend + Debug, R: ExtROTReceiver + Send, R::Msg: RemoteSend + Debug,

source§

impl<Rng: RngCore + CryptoRng + Send> MTProvider for SilentMtProvider<Rng>