Skip to content

Commit

Permalink
Addressed PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Rosenberg committed Nov 20, 2024
1 parent a154837 commit 7802201
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/topology/ping_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ pub trait PingPongTopology<const VERIFY_KEY_SIZE: usize, const NONCE_SIZE: usize
/// `inbound` must be `PingPongMessage::Initialize` or the function will fail.
///
/// [VDAF]: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vdaf-08#section-5.8
#[allow(clippy::too_many_arguments)]
fn helper_initialized(
&self,
verify_key: &[u8; VERIFY_KEY_SIZE],
Expand Down
15 changes: 8 additions & 7 deletions src/vdaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ pub trait Vdaf: Clone + Debug {
/// Generate the domain separation tag for this VDAF. The output is used for domain separation
/// by the XOF.
fn domain_separation_tag(&self, usage: u16, ctx: &[u8]) -> Vec<u8> {
// The first 8 bytes are fixed. Copy in the appropriate values
let mut dst = vec![0u8; 8];
dst[0] = VERSION;
dst[1] = 0; // algorithm class
dst[2..6].copy_from_slice(&(self.algorithm_id()).to_be_bytes());
dst[6..8].copy_from_slice(&usage.to_be_bytes());
// Finally, append `ctx`
// Prefix is 8 bytes and defined by the spec. Copy these values in
let mut dst = Vec::with_capacity(ctx.len() + 8);
dst.push(VERSION);
dst.push(0); // algorithm class
dst.extend_from_slice(self.algorithm_id().to_be_bytes().as_slice());
dst.extend_from_slice(usage.to_be_bytes().as_slice());
// Finally, append user-chosen `ctx`
dst.extend_from_slice(ctx);

dst
Expand Down Expand Up @@ -259,6 +259,7 @@ pub trait Aggregator<const VERIFY_KEY_SIZE: usize, const NONCE_SIZE: usize>: Vda
/// Implements `Vdaf.prep_init` from [VDAF].
///
/// [VDAF]: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vdaf-08#section-5.2
#[allow(clippy::too_many_arguments)]
fn prepare_init(
&self,
verify_key: &[u8; VERIFY_KEY_SIZE],
Expand Down
6 changes: 3 additions & 3 deletions src/vdaf/prio3_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ where
T: Type<Measurement = MP>,
P: Xof<SEED_SIZE>,
{
let verify_key = t.verify_key.as_ref();
let ctx = t.ctx.as_ref().try_into().unwrap();
let verify_key = t.verify_key.as_ref().try_into().unwrap();
let ctx = t.ctx.as_ref();

let mut all_output_shares = vec![Vec::new(); prio3.num_aggregators()];
for (test_num, p) in t.prep.iter().enumerate() {
let output_shares = check_prep_test_vec(prio3, ctx, verify_key, test_num, p);
let output_shares = check_prep_test_vec(prio3, verify_key, ctx, test_num, p);
for (aggregator_output_shares, output_share) in
all_output_shares.iter_mut().zip(output_shares.into_iter())
{
Expand Down

0 comments on commit 7802201

Please sign in to comment.