From 0473d9db68d9cc3a11f36b89561f8b5de8939e56 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 15 Apr 2025 22:30:56 +0200 Subject: [PATCH] Bump MSRV to v1.83 (#140) * Fix Clippy warnings for Rust v1.86 * Bump MSRV to v1.83 Signed-off-by: daxpedda --------- Signed-off-by: daxpedda --- .github/workflows/main.yml | 2 +- Cargo.toml | 2 +- src/common.rs | 95 ++++++----------------- src/error.rs | 3 +- src/group/elliptic_curve.rs | 21 +++-- src/group/mod.rs | 12 ++- src/oprf.rs | 79 ++++--------------- src/poprf.rs | 137 ++++++--------------------------- src/serialization.rs | 92 ++++------------------ src/tests/test_cfrg_vectors.rs | 99 ++++-------------------- src/voprf.rs | 122 ++++++----------------------- 11 files changed, 141 insertions(+), 523 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2fb11a..b4ff312 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,7 +43,7 @@ jobs: - --features serde toolchain: - stable - - 1.65.0 + - 1.83.0 name: test steps: - name: Checkout sources diff --git a/Cargo.toml b/Cargo.toml index c96c30e..9c324c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "voprf" readme = "README.md" repository = "https://github.com/facebook/voprf/" -rust-version = "1.65" +rust-version = "1.83" version = "0.5.0" [features] diff --git a/src/common.rs b/src/common.rs index f790edd..bf4d345 100644 --- a/src/common.rs +++ b/src/common.rs @@ -12,10 +12,9 @@ use core::convert::TryFrom; use core::ops::Add; use derive_where::derive_where; -use digest::core_api::BlockSizeUser; -use digest::{Digest, Output, OutputSizeUser}; +use digest::{Digest, Output}; use generic_array::sequence::Concat; -use generic_array::typenum::{IsLess, IsLessOrEqual, Unsigned, U2, U256, U9}; +use generic_array::typenum::{IsLess, Unsigned, U2, U256, U9}; use generic_array::{ArrayLength, GenericArray}; use rand_core::{CryptoRng, RngCore}; use subtle::ConstantTimeEq; @@ -79,10 +78,7 @@ impl Mode { pub struct BlindedElement( #[cfg_attr(feature = "serde", serde(with = "Element::"))] pub(crate) ::Elem, -) -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>; +); /// The server's response to the [BlindedElement] message from a client (either /// verifiable or not) to a server (either verifiable or not). @@ -96,10 +92,7 @@ where pub struct EvaluationElement( #[cfg_attr(feature = "serde", serde(with = "Element::"))] pub(crate) ::Elem, -) -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>; +); /// Contains prepared [`EvaluationElement`]s by a server batch evaluate /// preparation. @@ -110,10 +103,7 @@ where derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct PreparedEvaluationElement(pub(crate) EvaluationElement) -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>; +pub struct PreparedEvaluationElement(pub(crate) EvaluationElement); /// A proof produced by a server that the OPRF output matches against a server /// public key. @@ -124,11 +114,7 @@ where derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct Proof -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct Proof { #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] pub(crate) c_scalar: ::Scalar, #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] @@ -147,14 +133,10 @@ pub(crate) fn generate_proof( k: ::Scalar, a: ::Elem, b: ::Elem, - cs: impl Iterator::Elem> + ExactSizeIterator, - ds: impl Iterator::Elem> + ExactSizeIterator, + cs: impl ExactSizeIterator::Elem>, + ds: impl ExactSizeIterator::Elem>, mode: Mode, -) -> Result> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result> { // https://www.rfc-editor.org/rfc/rfc9497#section-2.2.1 let (m, z) = compute_composites::(Some(k), b, cs, ds, mode)?; @@ -209,15 +191,11 @@ where pub(crate) fn verify_proof( a: ::Elem, b: ::Elem, - cs: impl Iterator::Elem> + ExactSizeIterator, - ds: impl Iterator::Elem> + ExactSizeIterator, + cs: impl ExactSizeIterator::Elem>, + ds: impl ExactSizeIterator::Elem>, proof: &Proof, mode: Mode, -) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result<()> { // https://www.rfc-editor.org/rfc/rfc9497#section-2.2.2 let (m, z) = compute_composites::(None, b, cs, ds, mode)?; let t2 = (a * &proof.s_scalar) + &(b * &proof.c_scalar); @@ -282,11 +260,7 @@ fn compute_composites< c_slice: IC, d_slice: ID, mode: Mode, -) -> Result> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result> { // https://www.rfc-editor.org/rfc/rfc9497#section-2.2.1 let elem_len = ::ElemLen::U16.to_be_bytes(); @@ -362,11 +336,7 @@ pub(crate) fn derive_key_internal( seed: &[u8], info: &[u8], mode: Mode, -) -> Result<::Scalar, Error> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result<::Scalar, Error> { let dst = Dst::new::(STR_DERIVE_KEYPAIR, mode); let info_len = i2osp_2(info.len()).map_err(|_| Error::DeriveKeyPair)?; @@ -400,11 +370,7 @@ pub fn derive_key( seed: &[u8], info: &[u8], mode: Mode, -) -> Result<::Scalar, Error> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result<::Scalar, Error> { derive_key_internal::(seed, info, mode) } @@ -418,11 +384,7 @@ pub(crate) fn derive_keypair( seed: &[u8], info: &[u8], mode: Mode, -) -> Result, Error> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result, Error> { let sk_s = derive_key_internal::(seed, info, mode)?; let pk_s = CS::Group::base_elem() * &sk_s; @@ -438,11 +400,7 @@ pub(crate) fn deterministic_blind_unchecked( input: &[u8], blind: &::Scalar, mode: Mode, -) -> Result<::Elem> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result<::Elem> { let hashed_point = hash_to_group::(input, mode)?; Ok(hashed_point * blind) } @@ -451,11 +409,7 @@ where pub(crate) fn hash_to_group( input: &[u8], mode: Mode, -) -> Result<::Elem> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result<::Elem> { let dst = Dst::new::(STR_HASH_TO_GROUP, mode); CS::Group::hash_to_curve::(&[input], &dst.as_dst()).map_err(|_| Error::Input) } @@ -466,11 +420,7 @@ pub(crate) fn server_evaluate_hash_input( input: &[u8], info: Option<&[u8]>, issued_element: GenericArray::Group as Group>::ElemLen>, -) -> Result> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result> { // OPRF & VOPRF // hashInput = I2OSP(len(input), 2) || input || // I2OSP(len(issuedElement), 2) || issuedElement || @@ -504,12 +454,11 @@ pub(crate) struct Dst> { } impl> Dst { - pub(crate) fn new>(par_1: T, mode: Mode) -> Self + pub(crate) fn new(par_1: T, mode: Mode) -> Self where + CS: CipherSuite, T: Into>, - TL: Add, - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, + TL: ArrayLength + Add, { let par_1 = par_1.into(); // Generates the contextString parameter as defined in diff --git a/src/error.rs b/src/error.rs index 5e794bf..d33f16f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -41,5 +41,4 @@ pub enum InternalError { I2osp, } -#[cfg(feature = "std")] -impl std::error::Error for Error {} +impl core::error::Error for Error {} diff --git a/src/group/elliptic_curve.rs b/src/group/elliptic_curve.rs index e74b1c2..fae084d 100644 --- a/src/group/elliptic_curve.rs +++ b/src/group/elliptic_curve.rs @@ -6,6 +6,8 @@ // of this source tree. You may select, at your option, one of the above-listed // licenses. +use core::ops::Add; + use digest::core_api::BlockSizeUser; use digest::{FixedOutput, HashMarker}; use elliptic_curve::group::cofactor::CofactorGroup; @@ -14,28 +16,37 @@ use elliptic_curve::sec1::{FromEncodedPoint, ModulusSize, ToEncodedPoint}; use elliptic_curve::{ AffinePoint, Field, FieldBytesSize, Group as _, ProjectivePoint, PublicKey, Scalar, SecretKey, }; -use generic_array::typenum::{IsLess, IsLessOrEqual, U256}; -use generic_array::GenericArray; +use generic_array::typenum::{IsLess, IsLessOrEqual, Sum, U256}; +use generic_array::{ArrayLength, GenericArray}; use rand_core::{CryptoRng, RngCore}; use super::Group; use crate::{Error, InternalError, Result}; +type ElemLen = as ModulusSize>::CompressedPointSize; +type ScalarLen = FieldBytesSize; + impl Group for C where C: GroupDigest, ProjectivePoint: CofactorGroup + ToEncodedPoint, - FieldBytesSize: ModulusSize, + ScalarLen: ModulusSize, AffinePoint: FromEncodedPoint + ToEncodedPoint, Scalar: FromOkm, + // `VoprfClientLen`, `PoprfClientLen`, `VoprfServerLen`, `PoprfServerLen` + ScalarLen: Add>, + Sum, ElemLen>: ArrayLength, + // `ProofLen` + ScalarLen: Add>, + Sum, ScalarLen>: ArrayLength, { type Elem = ProjectivePoint; - type ElemLen = as ModulusSize>::CompressedPointSize; + type ElemLen = ElemLen; type Scalar = Scalar; - type ScalarLen = FieldBytesSize; + type ScalarLen = ScalarLen; // Implements the `hash_to_curve()` function from // https://www.rfc-editor.org/rfc/rfc9380.html#section-3 diff --git a/src/group/mod.rs b/src/group/mod.rs index 1f0b052..c51e06e 100644 --- a/src/group/mod.rs +++ b/src/group/mod.rs @@ -16,7 +16,7 @@ use core::ops::{Add, Mul, Sub}; use digest::core_api::BlockSizeUser; use digest::{FixedOutput, HashMarker}; -use generic_array::typenum::{IsLess, IsLessOrEqual, U256}; +use generic_array::typenum::{IsLess, IsLessOrEqual, Sum, U256}; use generic_array::{ArrayLength, GenericArray}; use rand_core::{CryptoRng, RngCore}; #[cfg(feature = "ristretto255")] @@ -28,7 +28,15 @@ use crate::{InternalError, Result}; /// A prime-order subgroup of a base field (EC, prime-order field ...). This /// subgroup is noted additively — as in the RFC — in this trait. -pub trait Group { +pub trait Group +where + // `VoprfClientLen`, `PoprfClientLen`, `VoprfServerLen`, `PoprfServerLen` + Self::ScalarLen: Add, + Sum: ArrayLength, + // `ProofLen` + Self::ScalarLen: Add, + Sum: ArrayLength, +{ /// The type of group elements type Elem: ConstantTimeEq + Copy diff --git a/src/oprf.rs b/src/oprf.rs index 710b748..d3e2f48 100644 --- a/src/oprf.rs +++ b/src/oprf.rs @@ -11,9 +11,8 @@ use core::iter::{self, Map}; use derive_where::derive_where; -use digest::core_api::BlockSizeUser; -use digest::{Digest, Output, OutputSizeUser}; -use generic_array::typenum::{IsLess, IsLessOrEqual, Unsigned, U256}; +use digest::{Digest, Output}; +use generic_array::typenum::Unsigned; use generic_array::GenericArray; use rand_core::{CryptoRng, RngCore}; @@ -44,11 +43,7 @@ use crate::{CipherSuite, Error, Group, Result}; derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct OprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct OprfClient { #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] pub(crate) blind: ::Scalar, } @@ -62,11 +57,7 @@ where derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct OprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct OprfServer { #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] pub(crate) sk: ::Scalar, } @@ -76,11 +67,7 @@ where // =================== // ///////////////////////// -impl OprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl OprfClient { /// Computes the first step for the multiplicative blinding version of /// DH-OPRF. /// @@ -154,11 +141,7 @@ where } } -impl OprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl OprfServer { /// Produces a new instance of a [OprfServer] using a supplied RNG /// /// # Errors @@ -194,7 +177,7 @@ where Ok(Self { sk }) } - // Only used for tests + /// Only used for tests #[cfg(test)] pub fn get_private_key(&self) -> ::Scalar { self.sk @@ -231,11 +214,7 @@ where /// Contains the fields that are returned by a non-verifiable client blind #[derive_where(Debug; ::Scalar, ::Elem)] -pub struct OprfClientBlindResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct OprfClientBlindResult { /// The state to be persisted on the client pub state: OprfClient, /// The message to send to the server @@ -261,11 +240,7 @@ fn finalize_after_unblind< >( inputs_and_unblinded_elements: IE, _unused: &'a [u8], -) -> FinalizeAfterUnblindResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> FinalizeAfterUnblindResult<'a, CS, I, IE> { inputs_and_unblinded_elements.map(|(input, unblinded_element)| { let elem_len = ::ElemLen::U16.to_be_bytes(); @@ -303,11 +278,7 @@ mod tests { key: ::Scalar, info: &[u8], mode: Mode, - ) -> Output - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + ) -> Output { let dst = Dst::new::(STR_HASH_TO_GROUP, mode); let point = CS::Group::hash_to_curve::(&[input], &dst.as_dst()).unwrap(); @@ -319,11 +290,7 @@ mod tests { .unwrap() } - fn base_retrieval() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn base_retrieval() { let input = b"input"; let mut rng = OsRng; let client_blind_result = OprfClient::::blind(input, &mut rng).unwrap(); @@ -334,11 +301,7 @@ mod tests { assert_eq!(client_finalize_result, res2); } - fn base_inversion_unsalted() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn base_inversion_unsalted() { let mut rng = OsRng; let mut input = [0u8; 64]; rng.fill_bytes(&mut input); @@ -358,11 +321,7 @@ mod tests { assert_eq!(client_finalize_result, res2); } - fn server_evaluate() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn server_evaluate() { let input = b"input"; let mut rng = OsRng; let client_blind_result = OprfClient::::blind(input, &mut rng).unwrap(); @@ -386,11 +345,7 @@ mod tests { assert!(client_finalize != server_evaluate); } - fn zeroize_oprf_client() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn zeroize_oprf_client() { let input = b"input"; let mut rng = OsRng; let client_blind_result = OprfClient::::blind(input, &mut rng).unwrap(); @@ -404,11 +359,7 @@ mod tests { assert!(message.serialize().iter().all(|&x| x == 0)); } - fn zeroize_oprf_server() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn zeroize_oprf_server() { let input = b"input"; let mut rng = OsRng; let client_blind_result = OprfClient::::blind(input, &mut rng).unwrap(); diff --git a/src/poprf.rs b/src/poprf.rs index a0fd531..53393c4 100644 --- a/src/poprf.rs +++ b/src/poprf.rs @@ -13,9 +13,8 @@ use alloc::vec::Vec; use core::iter::{self, Map, Repeat, Zip}; use derive_where::derive_where; -use digest::core_api::BlockSizeUser; use digest::{Digest, Output, OutputSizeUser}; -use generic_array::typenum::{IsLess, IsLessOrEqual, Unsigned, U256}; +use generic_array::typenum::Unsigned; use generic_array::GenericArray; use rand_core::{CryptoRng, RngCore}; @@ -42,11 +41,7 @@ use crate::{CipherSuite, Error, Group, Result}; derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct PoprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct PoprfClient { #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] pub(crate) blind: ::Scalar, #[cfg_attr(feature = "serde", serde(with = "Element::"))] @@ -62,11 +57,7 @@ where derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct PoprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct PoprfServer { #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] pub(crate) sk: ::Scalar, #[cfg_attr(feature = "serde", serde(with = "Element::"))] @@ -78,11 +69,7 @@ where // =================== // ///////////////////////// -impl PoprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl PoprfClient { /// Computes the first step for the multiplicative blinding version of /// DH-OPRF. /// @@ -193,11 +180,7 @@ where } } -impl PoprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl PoprfServer { /// Produces a new instance of a [PoprfServer] using a supplied RNG /// /// # Errors @@ -235,7 +218,7 @@ where Ok(Self { sk, pk }) } - // Only used for tests + /// Only used for tests #[cfg(test)] pub fn get_private_key(&self) -> ::Scalar { self.sk @@ -427,11 +410,7 @@ where } } -impl BlindedElement -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl BlindedElement { /// Creates a [BlindedElement] from a raw group element. /// /// # Caution @@ -450,11 +429,7 @@ where } } -impl EvaluationElement -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl EvaluationElement { /// Creates an [EvaluationElement] from a raw group element. /// /// # Caution @@ -480,11 +455,7 @@ where /// Contains the fields that are returned by a verifiable client blind #[derive_where(Debug; ::Scalar, ::Elem)] -pub struct PoprfClientBlindResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct PoprfClientBlindResult { /// The state to be persisted on the client pub state: PoprfClient, /// The message to send to the server @@ -497,11 +468,7 @@ pub type PoprfClientBatchFinalizeResult<'a, CS, II, IC, IM> = /// Contains the fields that are returned by a verifiable server evaluate #[derive_where(Debug; ::Scalar, ::Elem)] -pub struct PoprfServerEvaluateResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct PoprfServerEvaluateResult { /// The message to send to the client pub message: EvaluationElement, /// The proof for the client to verify @@ -511,11 +478,7 @@ where /// Contains the fields that are returned by a verifiable server batch evaluate #[derive_where(Debug; ::Scalar, ::Elem)] #[cfg(feature = "alloc")] -pub struct PoprfServerBatchEvaluateResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct PoprfServerBatchEvaluateResult { /// The messages to send to the client pub messages: Vec>, /// The proof for the client to verify @@ -545,19 +508,12 @@ pub type PoprfServerBatchEvaluatePreparedEvaluationElements = Map< pub struct PoprfPreparedTweak( #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] ::Scalar, -) -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>; +); /// Contains the fields that are returned by a partially verifiable server batch /// evaluate prepare #[derive_where(Debug; I, ::Scalar)] -pub struct PoprfServerBatchEvaluatePrepareResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct PoprfServerBatchEvaluatePrepareResult { /// Prepared [`EvaluationElement`]. pub prepared_evaluation_elements: PoprfServerBatchEvaluatePreparedEvaluationElements, /// Prepared tweak. @@ -576,8 +532,6 @@ pub type PoprfServerBatchEvaluateFinishedMessages<'a, CS, I> = Map< #[derive_where(Debug; <&'a I as IntoIterator>::IntoIter, ::Scalar)] pub struct PoprfServerBatchEvaluateFinishResult<'a, CS: 'a + CipherSuite, I> where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, &'a I: IntoIterator>, { /// The [`EvaluationElement`]s to send to the client @@ -598,11 +552,7 @@ where fn compute_tweaked_key( pk: ::Elem, info: Option<&[u8]>, -) -> Result<::Elem> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result<::Elem> { // None for info is treated the same as empty bytes let info = info.unwrap_or_default(); @@ -636,11 +586,7 @@ where fn compute_tweak( sk: ::Scalar, info: Option<&[u8]>, -) -> Result<::Scalar> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result<::Scalar> { // None for info is treated the same as empty bytes let info = info.unwrap_or_default(); @@ -691,8 +637,6 @@ fn poprf_unblind<'a, CS: 'a + CipherSuite, IC, IM>( info: Option<&[u8]>, ) -> Result> where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, &'a IC: 'a + IntoIterator>, <&'a IC as IntoIterator>::IntoIter: ExactSizeIterator, &'a IM: 'a + IntoIterator>, @@ -742,11 +686,7 @@ fn finalize_after_unblind< unblinded_elements: IE, inputs: II, info: Option<&'a [u8]>, -) -> Result> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> Result> { if unblinded_elements.len() != inputs.len() { return Err(Error::Batch); } @@ -784,11 +724,8 @@ where #[cfg(test)] mod tests { - use core::ops::Add; use core::ptr; - use generic_array::typenum::Sum; - use generic_array::ArrayLength; use rand::rngs::OsRng; use super::*; @@ -800,11 +737,7 @@ mod tests { key: ::Scalar, info: &[u8], mode: Mode, - ) -> Output - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + ) -> Output { let t = compute_tweak::(key, Some(info)).unwrap(); let dst = Dst::new::(STR_HASH_TO_GROUP, mode); @@ -820,11 +753,7 @@ mod tests { .unwrap() } - fn verifiable_retrieval() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_retrieval() { let input = b"input"; let info = b"info"; let mut rng = OsRng; @@ -847,11 +776,7 @@ mod tests { assert_eq!(client_finalize_result, res2); } - fn verifiable_bad_public_key() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_bad_public_key() { let input = b"input"; let info = b"info"; let mut rng = OsRng; @@ -875,11 +800,7 @@ mod tests { assert!(client_finalize_result.is_err()); } - fn verifiable_server_evaluate() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_server_evaluate() { let input = b"input"; let info = Some(b"info".as_slice()); let mut rng = OsRng; @@ -912,13 +833,7 @@ mod tests { assert!(client_finalize != server_evaluate); } - fn zeroize_verifiable_client() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - ::ScalarLen: Add<::ElemLen>, - Sum<::ScalarLen, ::ElemLen>: ArrayLength, - { + fn zeroize_verifiable_client() { let input = b"input"; let mut rng = OsRng; let client_blind_result = PoprfClient::::blind(input, &mut rng).unwrap(); @@ -932,15 +847,7 @@ mod tests { assert!(message.serialize().iter().all(|&x| x == 0)); } - fn zeroize_verifiable_server() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - ::ScalarLen: Add<::ElemLen>, - Sum<::ScalarLen, ::ElemLen>: ArrayLength, - ::ScalarLen: Add<::ScalarLen>, - Sum<::ScalarLen, ::ScalarLen>: ArrayLength, - { + fn zeroize_verifiable_server() { let input = b"input"; let info = b"info"; let mut rng = OsRng; diff --git a/src/serialization.rs b/src/serialization.rs index 7f1d38d..bafdcf5 100644 --- a/src/serialization.rs +++ b/src/serialization.rs @@ -9,13 +9,9 @@ //! Handles the serialization of each of the components used in the VOPRF //! protocol -use core::ops::Add; - -use digest::core_api::BlockSizeUser; -use digest::OutputSizeUser; use generic_array::sequence::Concat; -use generic_array::typenum::{IsLess, IsLessOrEqual, Sum, Unsigned, U256}; -use generic_array::{ArrayLength, GenericArray}; +use generic_array::typenum::{Sum, Unsigned}; +use generic_array::GenericArray; use crate::{ BlindedElement, CipherSuite, Error, EvaluationElement, Group, OprfClient, OprfServer, @@ -30,11 +26,7 @@ use crate::{ /// Length of [`OprfClient`] in bytes for serialization. pub type OprfClientLen = <::Group as Group>::ScalarLen; -impl OprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl OprfClient { /// Serialization into bytes pub fn serialize(&self) -> GenericArray> { CS::Group::serialize_scalar(self.blind) @@ -57,17 +49,9 @@ pub type VoprfClientLen = Sum< <::Group as Group>::ElemLen, >; -impl VoprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl VoprfClient { /// Serialization into bytes - pub fn serialize(&self) -> GenericArray> - where - ::ScalarLen: Add<::ElemLen>, - VoprfClientLen: ArrayLength, - { + pub fn serialize(&self) -> GenericArray> { ::serialize_scalar(self.blind) .concat(::serialize_elem(self.blinded_element)) } @@ -93,17 +77,9 @@ pub type PoprfClientLen = Sum< <::Group as Group>::ElemLen, >; -impl PoprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl PoprfClient { /// Serialization into bytes - pub fn serialize(&self) -> GenericArray> - where - ::ScalarLen: Add<::ElemLen>, - PoprfClientLen: ArrayLength, - { + pub fn serialize(&self) -> GenericArray> { ::serialize_scalar(self.blind) .concat(::serialize_elem(self.blinded_element)) } @@ -126,11 +102,7 @@ where /// Length of [`OprfServer`] in bytes for serialization. pub type OprfServerLen = <::Group as Group>::ScalarLen; -impl OprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl OprfServer { /// Serialization into bytes pub fn serialize(&self) -> GenericArray> { CS::Group::serialize_scalar(self.sk) @@ -153,17 +125,9 @@ pub type VoprfServerLen = Sum< <::Group as Group>::ElemLen, >; -impl VoprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl VoprfServer { /// Serialization into bytes - pub fn serialize(&self) -> GenericArray> - where - ::ScalarLen: Add<::ElemLen>, - VoprfServerLen: ArrayLength, - { + pub fn serialize(&self) -> GenericArray> { CS::Group::serialize_scalar(self.sk).concat(CS::Group::serialize_elem(self.pk)) } @@ -185,17 +149,9 @@ pub type PoprfServerLen = Sum< <::Group as Group>::ElemLen, >; -impl PoprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl PoprfServer { /// Serialization into bytes - pub fn serialize(&self) -> GenericArray> - where - ::ScalarLen: Add<::ElemLen>, - PoprfServerLen: ArrayLength, - { + pub fn serialize(&self) -> GenericArray> { CS::Group::serialize_scalar(self.sk).concat(CS::Group::serialize_elem(self.pk)) } @@ -217,17 +173,9 @@ pub type ProofLen = Sum< <::Group as Group>::ScalarLen, >; -impl Proof -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl Proof { /// Serialization into bytes - pub fn serialize(&self) -> GenericArray> - where - ::ScalarLen: Add<::ScalarLen>, - ProofLen: ArrayLength, - { + pub fn serialize(&self) -> GenericArray> { CS::Group::serialize_scalar(self.c_scalar) .concat(CS::Group::serialize_scalar(self.s_scalar)) } @@ -247,11 +195,7 @@ where /// Length of [`BlindedElement`] in bytes for serialization. pub type BlindedElementLen = <::Group as Group>::ElemLen; -impl BlindedElement -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl BlindedElement { /// Serialization into bytes pub fn serialize(&self) -> GenericArray> { CS::Group::serialize_elem(self.0) @@ -271,11 +215,7 @@ where /// Length of [`EvaluationElement`] in bytes for serialization. pub type EvaluationElementLen = <::Group as Group>::ElemLen; -impl EvaluationElement -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl EvaluationElement { /// Serialization into bytes pub fn serialize(&self) -> GenericArray> { CS::Group::serialize_elem(self.0) diff --git a/src/tests/test_cfrg_vectors.rs b/src/tests/test_cfrg_vectors.rs index 47c2b3a..71ef4d7 100644 --- a/src/tests/test_cfrg_vectors.rs +++ b/src/tests/test_cfrg_vectors.rs @@ -9,12 +9,7 @@ use alloc::string::String; use alloc::vec; use alloc::vec::Vec; -use core::ops::Add; -use digest::core_api::BlockSizeUser; -use digest::OutputSizeUser; -use generic_array::typenum::{IsLess, IsLessOrEqual, Sum, U256}; -use generic_array::ArrayLength; use serde_json::Value; use crate::tests::mock_rng::CycleRng; @@ -219,11 +214,7 @@ fn test_vectors() -> Result<()> { Ok(()) } -fn test_oprf_seed_to_key(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_oprf_seed_to_key(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { let server = OprfServer::::new_from_seed(¶meters.seed, ¶meters.key_info)?; @@ -235,11 +226,7 @@ where Ok(()) } -fn test_voprf_seed_to_key(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_voprf_seed_to_key(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { let server = VoprfServer::::new_from_seed(¶meters.seed, ¶meters.key_info)?; @@ -255,11 +242,7 @@ where Ok(()) } -fn test_poprf_seed_to_key(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_poprf_seed_to_key(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { let server = PoprfServer::::new_from_seed(¶meters.seed, ¶meters.key_info)?; @@ -276,11 +259,7 @@ where } // Tests input -> blind, blinded_element -fn test_oprf_blind(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_oprf_blind(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let blind = CS::Group::deserialize_scalar(¶meters.blind[i])?; @@ -301,11 +280,7 @@ where } // Tests input -> blind, blinded_element -fn test_voprf_blind(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_voprf_blind(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let blind = CS::Group::deserialize_scalar(¶meters.blind[i])?; @@ -326,11 +301,7 @@ where } // Tests input -> blind, blinded_element -fn test_poprf_blind(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_poprf_blind(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let blind = CS::Group::deserialize_scalar(¶meters.blind[i])?; @@ -351,11 +322,7 @@ where } // Tests sksm, blinded_element -> evaluation_element -fn test_oprf_blind_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_oprf_blind_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let server = OprfServer::::new_with_key(¶meters.sksm)?; @@ -372,13 +339,7 @@ where Ok(()) } -fn test_voprf_blind_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - ::ScalarLen: Add<::ScalarLen>, - Sum<::ScalarLen, ::ScalarLen>: ArrayLength, -{ +fn test_voprf_blind_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { let mut rng = CycleRng::new(parameters.proof_random_scalar.clone()); let server = VoprfServer::::new_with_key(¶meters.sksm)?; @@ -404,13 +365,7 @@ where Ok(()) } -fn test_poprf_blind_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - ::ScalarLen: Add<::ScalarLen>, - Sum<::ScalarLen, ::ScalarLen>: ArrayLength, -{ +fn test_poprf_blind_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { let mut rng = CycleRng::new(parameters.proof_random_scalar.clone()); let server = PoprfServer::::new_with_key(¶meters.sksm)?; @@ -446,11 +401,7 @@ where } // Tests input, blind, evaluation_element -> output -fn test_oprf_finalize(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_oprf_finalize(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let client = @@ -467,11 +418,7 @@ where Ok(()) } -fn test_voprf_finalize(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_voprf_finalize(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { let mut clients = vec![]; for i in 0..parameters.input.len() { @@ -506,11 +453,7 @@ where Ok(()) } -fn test_poprf_finalize(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_poprf_finalize(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { let mut clients = vec![]; for i in 0..parameters.input.len() { @@ -544,11 +487,7 @@ where } // Tests input, sksm -> output -fn test_oprf_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_oprf_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let server = OprfServer::::new_with_key(¶meters.sksm)?; @@ -561,11 +500,7 @@ where Ok(()) } -fn test_voprf_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_voprf_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let server = VoprfServer::::new_with_key(¶meters.sksm)?; @@ -578,11 +513,7 @@ where Ok(()) } -fn test_poprf_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +fn test_poprf_evaluate(tvs: &[VOPRFTestVectorParameters]) -> Result<()> { for parameters in tvs { for i in 0..parameters.input.len() { let server = PoprfServer::::new_with_key(¶meters.sksm)?; diff --git a/src/voprf.rs b/src/voprf.rs index 9871952..d5f031e 100644 --- a/src/voprf.rs +++ b/src/voprf.rs @@ -13,9 +13,8 @@ use alloc::vec::Vec; use core::iter::{self, Map, Repeat, Zip}; use derive_where::derive_where; -use digest::core_api::BlockSizeUser; -use digest::{Digest, Output, OutputSizeUser}; -use generic_array::typenum::{IsLess, IsLessOrEqual, Unsigned, U256}; +use digest::{Digest, Output}; +use generic_array::typenum::Unsigned; use generic_array::GenericArray; use rand_core::{CryptoRng, RngCore}; @@ -42,11 +41,7 @@ use crate::{CipherSuite, Error, Group, Result}; derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct VoprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct VoprfClient { #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] pub(crate) blind: ::Scalar, #[cfg_attr(feature = "serde", serde(with = "Element::"))] @@ -62,11 +57,7 @@ where derive(serde::Deserialize, serde::Serialize), serde(bound = "") )] -pub struct VoprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct VoprfServer { #[cfg_attr(feature = "serde", serde(with = "Scalar::"))] pub(crate) sk: ::Scalar, #[cfg_attr(feature = "serde", serde(with = "Element::"))] @@ -78,11 +69,7 @@ where // =================== // ///////////////////////// -impl VoprfClient -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl VoprfClient { /// Computes the first step for the multiplicative blinding version of /// DH-OPRF. /// @@ -161,7 +148,7 @@ where /// /// The resulting messages can each fail individually with [`Error::Input`] /// if the `input` is empty or longer then [`u16::MAX`]. - pub fn batch_finalize<'a, I: 'a, II, IC, IM>( + pub fn batch_finalize<'a, I, II, IC, IM>( inputs: &'a II, clients: &'a IC, messages: &'a IM, @@ -170,7 +157,7 @@ where ) -> Result> where CS: 'a, - I: AsRef<[u8]>, + I: 'a + AsRef<[u8]>, &'a II: 'a + IntoIterator, <&'a II as IntoIterator>::IntoIter: ExactSizeIterator, &'a IC: 'a + IntoIterator>, @@ -197,18 +184,14 @@ where } } - // Only used for test functions + /// Only used for test functions #[cfg(test)] pub fn get_blind(&self) -> ::Scalar { self.blind } } -impl VoprfServer -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +impl VoprfServer { /// Produces a new instance of a [VoprfServer] using a supplied RNG /// /// # Errors @@ -246,7 +229,7 @@ where Ok(Self { sk, pk }) } - // Only used for tests + /// Only used for tests #[cfg(test)] pub fn get_private_key(&self) -> ::Scalar { self.sk @@ -402,11 +385,7 @@ where /// Contains the fields that are returned by a verifiable client blind #[derive_where(Debug; ::Scalar, ::Elem)] -pub struct VoprfClientBlindResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct VoprfClientBlindResult { /// The state to be persisted on the client pub state: VoprfClient, /// The message to send to the server @@ -423,11 +402,7 @@ pub type VoprfClientBatchFinalizeResult<'a, C, I, II, IC, IM> = FinalizeAfterUnb /// Contains the fields that are returned by a verifiable server evaluate #[derive_where(Debug; ::Scalar, ::Elem)] -pub struct VoprfServerEvaluateResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct VoprfServerEvaluateResult { /// The message to send to the client pub message: EvaluationElement, /// The proof for the client to verify @@ -437,11 +412,7 @@ where /// Contains the fields that are returned by a verifiable server batch evaluate #[derive_where(Debug; ::Scalar, ::Elem)] #[cfg(feature = "alloc")] -pub struct VoprfServerBatchEvaluateResult -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +pub struct VoprfServerBatchEvaluateResult { /// The messages to send to the client pub messages: Vec>, /// The proof for the client to verify @@ -472,8 +443,6 @@ pub type VoprfServerBatchEvaluateFinishedMessages<'a, CS, I> = Map< #[derive_where(Debug; <&'a I as IntoIterator>::IntoIter, ::Scalar)] pub struct VoprfServerBatchEvaluateFinishResult<'a, CS: 'a + CipherSuite, I> where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, &'a I: IntoIterator>, { /// The [`EvaluationElement`]s to send to the client @@ -511,8 +480,6 @@ fn verifiable_unblind<'a, CS: 'a + CipherSuite, IC, IM>( proof: &Proof, ) -> Result> where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, &'a IC: 'a + IntoIterator>, <&'a IC as IntoIterator>::IntoIter: ExactSizeIterator, &'a IM: 'a + IntoIterator>, @@ -554,11 +521,7 @@ fn finalize_after_unblind< IE: 'a + Iterator::Elem)>, >( inputs_and_unblinded_elements: IE, -) -> FinalizeAfterUnblindResult<'a, CS, I, IE> -where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, -{ +) -> FinalizeAfterUnblindResult<'a, CS, I, IE> { inputs_and_unblinded_elements.map(|(input, unblinded_element)| { let elem_len = ::ElemLen::U16.to_be_bytes(); @@ -583,13 +546,10 @@ where #[cfg(test)] mod tests { - use core::ops::Add; use core::ptr; use ::alloc::vec; use ::alloc::vec::Vec; - use generic_array::typenum::Sum; - use generic_array::ArrayLength; use rand::rngs::OsRng; use super::*; @@ -600,11 +560,7 @@ mod tests { input: &[u8], key: ::Scalar, mode: Mode, - ) -> Output - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + ) -> Output { let dst = Dst::new::(STR_HASH_TO_GROUP, mode); let point = CS::Group::hash_to_curve::(&[input], &dst.as_dst()).unwrap(); @@ -616,11 +572,7 @@ mod tests { .unwrap() } - fn verifiable_retrieval() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_retrieval() { let input = b"input"; let mut rng = OsRng; let client_blind_result = VoprfClient::::blind(input, &mut rng).unwrap(); @@ -639,11 +591,7 @@ mod tests { assert_eq!(client_finalize_result, res2); } - fn verifiable_batch_retrieval() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_batch_retrieval() { let mut rng = OsRng; let mut inputs = vec![]; let mut client_states = vec![]; @@ -687,11 +635,7 @@ mod tests { assert_eq!(client_finalize_result, res2); } - fn verifiable_batch_bad_public_key() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_batch_bad_public_key() { let mut rng = OsRng; let mut inputs = vec![]; let mut client_states = vec![]; @@ -727,11 +671,7 @@ mod tests { assert!(client_finalize_result.is_err()); } - fn verifiable_bad_public_key() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_bad_public_key() { let input = b"input"; let mut rng = OsRng; let client_blind_result = VoprfClient::::blind(input, &mut rng).unwrap(); @@ -751,11 +691,7 @@ mod tests { assert!(client_finalize_result.is_err()); } - fn verifiable_server_evaluate() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - { + fn verifiable_server_evaluate() { let input = b"input"; let mut rng = OsRng; let client_blind_result = VoprfClient::::blind(input, &mut rng).unwrap(); @@ -784,13 +720,7 @@ mod tests { assert!(client_finalize != server_evaluate); } - fn zeroize_voprf_client() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - ::ScalarLen: Add<::ElemLen>, - Sum<::ScalarLen, ::ElemLen>: ArrayLength, - { + fn zeroize_voprf_client() { let input = b"input"; let mut rng = OsRng; let client_blind_result = VoprfClient::::blind(input, &mut rng).unwrap(); @@ -804,15 +734,7 @@ mod tests { assert!(message.serialize().iter().all(|&x| x == 0)); } - fn zeroize_voprf_server() - where - ::OutputSize: - IsLess + IsLessOrEqual<::BlockSize>, - ::ScalarLen: Add<::ElemLen>, - Sum<::ScalarLen, ::ElemLen>: ArrayLength, - ::ScalarLen: Add<::ScalarLen>, - Sum<::ScalarLen, ::ScalarLen>: ArrayLength, - { + fn zeroize_voprf_server() { let input = b"input"; let mut rng = OsRng; let client_blind_result = VoprfClient::::blind(input, &mut rng).unwrap();