Skip to content

Commit

Permalink
Combined helper measurement and helper proof seeds (#1167)
Browse files Browse the repository at this point in the history
* Combined helper measurement and helper proof seeds

* Made Prio3InputShare an enum (Leader/Helper)

* Un-ignored Prio3 known-answer tests

---------

Co-authored-by: Michael Rosenberg <mrosenberg@cloudflare.com>
  • Loading branch information
rozbb and Michael Rosenberg authored Jan 6, 2025
1 parent 6a7a916 commit cc2eb8f
Show file tree
Hide file tree
Showing 3 changed files with 331 additions and 179 deletions.
11 changes: 10 additions & 1 deletion src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ impl Encode for u64 {
}
}

/// Encode `items` into `bytes` as a fixed-length vector, with no length tag.
pub fn encode_fixlen_items<E: Encode>(bytes: &mut Vec<u8>, items: &[E]) -> Result<(), CodecError> {
for item in items {
item.encode(bytes)?;
}

Ok(())
}

/// Encode `items` into `bytes` as a [variable-length vector][1] with a maximum length of `0xff`.
///
/// [1]: https://datatracker.ietf.org/doc/html/rfc8446#section-3.4
Expand Down Expand Up @@ -422,7 +431,7 @@ pub fn decode_u32_items<P, D: ParameterizedDecode<P>>(
}

/// Decode the next `length` bytes from `bytes` into as many instances of `D` as possible.
fn decode_items<P, D: ParameterizedDecode<P>>(
pub(crate) fn decode_items<P, D: ParameterizedDecode<P>>(
length: usize,
decoding_parameter: &P,
bytes: &mut Cursor<&[u8]>,
Expand Down
Loading

0 comments on commit cc2eb8f

Please sign in to comment.