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

Add OPRF root step to compact #830

Merged
merged 3 commits into from
Nov 3, 2023
Merged
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
7 changes: 6 additions & 1 deletion src/protocol/step/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ impl Debug for Compact {
}

const ROOT_STATE: u16 = 0;
const PRSS_EXCHANGE_STATE: u16 = 65531;
const QUERY_TYPE_SEMIHONEST_STATE: u16 = 65533;
const QUERY_TYPE_MALICIOUS_STATE: u16 = 65532;
const PRSS_EXCHANGE_STATE: u16 = 65531;
const QUERY_TYPE_OPRF_STATE: u16 = 65530;

impl StepNarrow<QueryType> for Compact {
fn narrow(&self, step: &QueryType) -> Self {
match step {
QueryType::SemiHonestIpa(_) => Self(QUERY_TYPE_SEMIHONEST_STATE),
QueryType::MaliciousIpa(_) => Self(QUERY_TYPE_MALICIOUS_STATE),
QueryType::OprfIpa(_) => Self(QUERY_TYPE_OPRF_STATE),
_ => panic!("cannot narrow from the invalid step {}", step.as_ref()),
}
}
Expand All @@ -60,6 +62,7 @@ fn static_reverse_state_map(state: u16) -> &'static str {
ROOT_STATE => "run-0",
QUERY_TYPE_SEMIHONEST_STATE => QueryType::SEMIHONEST_IPA_STR,
QUERY_TYPE_MALICIOUS_STATE => QueryType::MALICIOUS_IPA_STR,
QUERY_TYPE_OPRF_STATE => QueryType::OPRF_IPA_STR,
PRSS_EXCHANGE_STATE => PrssExchangeStep.as_ref(),
_ => panic!("cannot as_ref() from the invalid state {state}"),
}
Expand All @@ -72,6 +75,8 @@ fn static_deserialize_state_map(s: &str) -> u16 {
return QUERY_TYPE_SEMIHONEST_STATE;
} else if s == QueryType::MALICIOUS_IPA_STR {
return QUERY_TYPE_MALICIOUS_STATE;
} else if s == QueryType::OPRF_IPA_STR {
return QUERY_TYPE_OPRF_STATE;
} else if s == PrssExchangeStep.as_ref() {
return PRSS_EXCHANGE_STATE;
}
Expand Down