Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC][oprf][shuffle] OPRF Shuffle using a 2-round 4-message shuffle protocol #809

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub mod oprf_shuffle;

use std::{
fmt::{Debug, Display, Formatter},
num::NonZeroU32,
Expand Down Expand Up @@ -206,6 +208,7 @@ pub enum QueryType {
MaliciousIpa(IpaQueryConfig),
SemiHonestSparseAggregate(SparseAggregateQueryConfig),
MaliciousSparseAggregate(SparseAggregateQueryConfig),
OPRFShuffle(oprf_shuffle::QueryConfig),
}

impl QueryType {
Expand All @@ -214,6 +217,7 @@ impl QueryType {
pub const MALICIOUS_IPA_STR: &'static str = "malicious-ipa";
pub const SEMIHONEST_AGGREGATE_STR: &'static str = "semihonest-sparse-aggregate";
pub const MALICIOUS_AGGREGATE_STR: &'static str = "malicious-sparse-aggregate";
pub const OPRF_SHUFFLE_STR: &'static str = "oprf-shuffle";
}

/// TODO: should this `AsRef` impl (used for `Substep`) take into account config of IPA?
Expand All @@ -226,6 +230,7 @@ impl AsRef<str> for QueryType {
QueryType::MaliciousIpa(_) => Self::MALICIOUS_IPA_STR,
QueryType::SemiHonestSparseAggregate(_) => Self::SEMIHONEST_AGGREGATE_STR,
QueryType::MaliciousSparseAggregate(_) => Self::MALICIOUS_AGGREGATE_STR,
QueryType::OPRFShuffle(_) => Self::OPRF_SHUFFLE_STR,
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/transport/query/oprf_shuffle.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub struct QueryConfig {}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pub mod error;
pub mod ff;
pub mod helpers;
pub mod hpke;
pub mod one_off_fns;

#[cfg(feature = "web-app")]
pub mod net;
pub mod protocol;
Expand Down
8 changes: 8 additions & 0 deletions src/net/http_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ pub mod query {
let Query(q) = req.extract().await?;
Ok(QueryType::MaliciousSparseAggregate(q))
}
QueryType::OPRF_SHUFFLE_STR => {
let Query(q) = req.extract().await?;
Ok(QueryType::OPRFShuffle(q))
}
other => Err(Error::bad_query_value("query_type", other)),
}?;
Ok(QueryConfigQueryParams(QueryConfig {
Expand Down Expand Up @@ -188,6 +192,10 @@ pub mod query {

Ok(())
}
QueryType::OPRFShuffle(_config) => {
write!(f, "")?;
Ok(())
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/one_off_fns.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use futures::Stream;

///
/// Helps to convince the compiler that things are `Send`. Like `seq_join::assert_send`, but for
/// streams.
///
/// <https://github.com/rust-lang/rust/issues/102211#issuecomment-1367900125>
pub fn assert_stream_send<'a, T>(
st: impl Stream<Item = T> + Send + 'a,
) -> impl Stream<Item = T> + Send + 'a {
st
}
File renamed without changes.
1 change: 1 addition & 0 deletions src/protocol/basics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod apply_permutation;
pub mod check_zero;
mod if_else;
pub(crate) mod mul;
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub struct Base<'a> {
}

impl<'a> Base<'a> {
fn new(participant: &'a PrssEndpoint, gateway: &'a Gateway) -> Self {
pub fn new(participant: &'a PrssEndpoint, gateway: &'a Gateway) -> Self {
Self::new_complete(
participant,
gateway,
Expand Down
2 changes: 2 additions & 0 deletions src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ pub mod context;
pub mod dp;
pub mod ipa;
pub mod modulus_conversion;
pub mod oprf;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub mod oprf;
#[cfg(feature = "ipa-prf")]
pub mod oprf;

I used the ipa-prf feature which requires descriptive gate, but it hasn't landed yet but probably will land soon.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably not call this oprf since it is just a shuffle and a basic protocol that could be used in different context. It is not related to an oprf other than that we want to use it together with a prf/orpf in our new IPA version.

#[cfg(feature = "descriptive-gate")]
pub mod prf_sharding;
pub mod prss;
pub mod sort;
Expand Down
1 change: 1 addition & 0 deletions src/protocol/oprf/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod shuffle;
Loading
Loading