diff --git a/Cargo.lock b/Cargo.lock index fff20e6..71d99f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1957,6 +1957,10 @@ dependencies = [ "syn", ] +[[package]] +name = "seec-experimental" +version = "0.1.0" + [[package]] name = "seec-macros" version = "0.1.0" diff --git a/crates/seec-experimental/Cargo.toml b/crates/seec-experimental/Cargo.toml new file mode 100644 index 0000000..ee013dc --- /dev/null +++ b/crates/seec-experimental/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "seec-experimental" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/seec-experimental/src/lib.rs b/crates/seec-experimental/src/lib.rs new file mode 100644 index 0000000..27c8ae9 --- /dev/null +++ b/crates/seec-experimental/src/lib.rs @@ -0,0 +1,113 @@ +use std::marker::PhantomData; + +trait Share {} + +trait SimdShare: Share { + type Scalar: Share; +} + +trait Gate {} + +struct Sender(PhantomData); + +struct Receiver(PhantomData); + +struct Context; + +// impl Context { +// async fn get_setup_data(&self) +// } + +// TODO: what about preprocessing information? +// in original, this is passed to the methods, but I'm not super happy with it +// maybe I can have a more general ExecutionContext, which allows access to preprocessing data? +trait Protocol { + type Share: Share; + type SimdShare: SimdShare; + + type SetupData; + + type Msg; + + fn eval_non_interactive( + &self, + gate: G, + inputs: impl IntoIterator, + ) -> Self::Share; + + fn eval_interactive_msg( + &self, + gate: G, + inputs: impl IntoIterator, + ) -> Self::Msg; + fn eval_interactive( + &self, + gate: G, + inputs: impl IntoIterator, + msg: Self::Msg, + other_msg: Self::Msg, + ) -> Self::Share; + + // todo replicate for SIMD, what about async? + async fn simd_eval_interactive_msg( + &self, + gate: G, + inputs: impl IntoIterator, + sender: &mut Sender, + ); + // TODO: what about access to own sent message? + async fn simd_eval_interactive( + &self, + gate: G, + inputs: impl IntoIterator, + receiver: &mut Sender, + ); +} + +struct Gmw(PhantomData); + +struct BoolGate; + +impl Share for bool {} + +struct BitVec; + +impl Share for BitVec {} + +impl SimdShare for BitVec { + type Scalar = bool; +} + +impl Gate for BoolGate {} + +impl Protocol for Gmw { + type Share = bool; + type SimdShare = BitVec; + type Msg = (); + + fn eval_non_interactive( + &self, + gate: BoolGate, + inputs: impl IntoIterator, + ) -> Self::Share { + todo!() + } + + fn eval_interactive_msg( + &self, + gate: BoolGate, + inputs: impl IntoIterator, + ) -> Self::Msg { + todo!() + } + + fn eval_interactive( + &self, + gate: BoolGate, + inputs: impl IntoIterator, + msg: Self::Msg, + other_msg: Self::Msg, + ) -> Self::Share { + todo!() + } +}