Skip to content

Commit

Permalink
Move szk module from flp to vdaf::mastic
Browse files Browse the repository at this point in the history
Some of the implementation details of SZK are, for the moment, specific
to Mastic. For example, the domain separation tag for each XOF
invocation is prefixed by `b"mastic"`. It therefore makes sense to move
this module to `mastic` until such time we need to refactor in order to
use SZK in multiple places.
  • Loading branch information
cjpatton committed Jan 13, 2025
1 parent 400d9e1 commit 20bc920
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/flp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ use std::convert::TryFrom;
use std::fmt::Debug;

pub mod gadgets;
#[cfg(all(feature = "crypto-dependencies", feature = "experimental"))]
pub mod szk;
pub mod types;

/// Errors propagated by methods in this module.
Expand Down
4 changes: 2 additions & 2 deletions src/vdaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#[cfg(feature = "experimental")]
use crate::dp::DifferentialPrivacyStrategy;
#[cfg(all(feature = "crypto-dependencies", feature = "experimental"))]
use crate::flp::szk::SzkError;
#[cfg(all(feature = "crypto-dependencies", feature = "experimental"))]
use crate::idpf::IdpfError;
#[cfg(all(feature = "crypto-dependencies", feature = "experimental"))]
use crate::vdaf::mastic::szk::SzkError;
#[cfg(all(feature = "crypto-dependencies", feature = "experimental"))]
use crate::vidpf::VidpfError;
use crate::{
codec::{CodecError, Decode, Encode, ParameterizedDecode},
Expand Down
15 changes: 8 additions & 7 deletions src/vdaf/mastic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::{
bt::BinaryTree,
codec::{CodecError, Decode, Encode, ParameterizedDecode},
field::{decode_fieldvec, FieldElement, FieldElementWithInteger},
flp::{
szk::{Szk, SzkInputShare, SzkJointShare, SzkQueryShare, SzkQueryState},
Type,
},
flp::Type,
vdaf::{
poplar1::{Poplar1, Poplar1AggregationParam},
xof::{Seed, Xof},
Expand All @@ -24,6 +21,8 @@ use crate::{
},
};

use szk::{Szk, SzkInputShare, SzkJointShare, SzkQueryShare, SzkQueryState};

use rand::prelude::*;
use std::io::{Cursor, Read};
use std::ops::BitAnd;
Expand All @@ -33,6 +32,8 @@ use subtle::{Choice, ConstantTimeEq};

use super::xof::XofTurboShake128;

pub(crate) mod szk;

pub(crate) const SEED_SIZE: usize = 32;
pub(crate) const NONCE_SIZE: usize = 16;

Expand Down Expand Up @@ -319,9 +320,9 @@ impl<T: Type> Client<16> for Mastic<T> {

/// Mastic preparation state.
///
/// State held by an aggregator waiting for a message during Mastic preparation. Includes intermediate
/// state for [`Szk`] verification, the output shares currently being validated, and
/// parameters of Mastic used for encoding.
/// State held by an aggregator waiting for a message during Mastic preparation. Includes
/// intermediate state for the evaluation check, the range check (if applicable) verification, and
/// the output shares currently being validated.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct MasticPrepareState<F: FieldElement> {
/// The counter and truncated weight for each candidate prefix.
Expand Down
File renamed without changes.

0 comments on commit 20bc920

Please sign in to comment.