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§
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 Methods§
sourcefn into_dyn(
self
) -> Box<dyn MTProvider<Output = Self::Output, Error = BoxError> + Send + 'static>
fn into_dyn( self ) -> Box<dyn MTProvider<Output = Self::Output, Error = BoxError> + Send + '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?)
}