diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ecf73a..36482e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,24 @@ # Changelog -## 0.7.0-pre.0 (June 28, 2026) +## 1.0.0-pre.0 (June 29, 2026) + +Forked from [facebook/voprf](https://github.com/facebook/voprf/) at `0.6.0-pre.1`. + * MSRV bumped to 1.87 * Migrated from `elliptic-curve 0.13` to `0.14` -* Replaced `generic-array` with `hybrid-array` -* Updated `digest` dependency to 0.11 -* Updated `rand_core` dependency to 0.10 -* Updated `rand` dependency to 0.10 -* Updated `sha2` dependency to 0.11 -* Updated `p256`, `p384`, `p521` dependencies to 0.14.0-rc +* Replaced `generic-array` with `hybrid-array 0.4` +* Updated `digest` to 0.11, `rand_core` to 0.10, `rand` to 0.10, `sha2` to 0.11 +* Updated `p256`, `p384`, `p521` to `0.14` * Replaced `elliptic-curve/hash2curve` feature with standalone `hash2curve 0.14` crate -* Updated `hash_to_scalar` to use `MapToCurve::Length` as OKM length per RFC 9380, replacing the removed `GroupDigest::hash_to_scalar` method -* Updated `random_scalar` to consume exactly `ScalarLen` bytes per attempt, adapting to the new `rand_core 0.10` API -* Added `OkmLen` associated type to `Group` trait +* Removed `VoprfParameters` dependency to be replaced with `OprfParameters` + `GroupDigest` +* Added `SecurityLevel` associated type to `Group` trait for generic hash bounds +* Added `OkmLen` associated type to `Group` trait (`MapToCurve::Length`) +* Updated `hash_to_scalar` to use `MapToCurve::Length` as OKM length per RFC 9380 +* Updated `random_scalar` for deterministic byte consumption with `rand_core 0.10` +* Auto-impl `CipherSuite` for any `OprfParameters + Group` type via `OprfHash` ## 0.6.0-pre.1 (April 6, 2026) + * MSRV bumped to 1.85 * Updated rand_core dependency to 0.9 * Updated rand dependency to 0.9 @@ -22,40 +26,50 @@ * Fixed docs issue ## 0.6.0-pre.0 (November 8, 2025) + * MSRV bumped to 1.83 * Updated Ristretto255 random scalar generation * Updated generic-array to v1 ## 0.5.0 (March 6, 2024) + * Just a version bump from v0.5.0-pre.7 ## 0.5.0-pre.7 (January 11, 2024) + * Updated to be in sync with RFC 9497 ## 0.5.0-pre.6 (July 24, 2023) + * Updated curve25519-dalek dependency to 4 ## 0.5.0-pre.5 (June 27, 2023) + * Updated curve25519-dalek dependency to 4.0.0-rc.3 ## 0.5.0-pre.4 (May 20, 2023) + * Updated curve25519-dalek dependency to 4.0.0-rc.2 ## 0.5.0-pre.3 (March 4, 2023) + * Updated to be in sync with draft-irtf-cfrg-voprf-19 * Increased MSRV to 1.65 * Updated p256 dependency to v0.13 * Added p384 tests ## 0.5.0-pre.2 (February 3, 2023) + * Increased MSRV to 1.60 * Updated p256 dependency to v0.12 * Updated curve25519-dalek dependency to 4.0.0-rc.1 ## 0.5.0-pre.1 (December 19, 2022) + * Updated curve25519-dalek dependency to 4.0.0-pre.5 ## 0.4.0 (September 15, 2022) + * Updated to be in sync with draft-irtf-cfrg-voprf-11, with the addition of the POPRF mode * Adds the evaluate() function to the servers to calculate the output of the OPRF diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f192ad6..e7c9fd9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,6 @@ We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue. ## License -By contributing to voprf, you agree that your contributions will be +By contributing to voprf-vx, you agree that your contributions will be licensed under both the LICENSE-MIT and LICENSE-APACHE files in the root directory of this source tree. diff --git a/Cargo.toml b/Cargo.toml index 64b0169..4b1885d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,15 @@ [package] -authors = ["Kevin Lewi "] +authors = ["VexaHub Developers", "Kevin Lewi "] categories = ["no-std", "algorithms", "cryptography"] description = "An implementation of a verifiable oblivious pseudorandom function (VOPRF)" edition = "2024" -keywords = ["oprf"] +keywords = ["oprf", "voprf", "cryptography", "oblivious-prf"] license = "MIT" -name = "voprf-vexahub" +name = "voprf-vx" readme = "README.md" repository = "https://github.com/facebook/voprf/" rust-version = "1.87" -version = "0.7.0-pre.0" +version = "1.0.0-pre.0" [features] alloc = [] diff --git a/README.md b/README.md index 5838c17..bb5d1dd 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This implementation is based on [RFC 9497](https://www.rfc-editor.org/rfc/rfc949 Documentation ------------- -The API can be found [here](https://docs.rs/voprf-vexahub/) along with an example for usage. +The API can be found [here](https://docs.rs/voprf-vx/) along with an example for usage. Installation ------------ @@ -16,7 +16,7 @@ Installation Add the following line to the dependencies of your `Cargo.toml`: ``` -voprf = { package = "voprf-vexahub", version = "0.6.0-rc.0" } +voprf = { package = "voprf-vx", version = "1.0.0-pre.0" } ``` ### Minimum Supported Rust Version @@ -26,7 +26,9 @@ Rust **1.87** or higher. Contributors ------------ -The author of this code is Kevin Lewi ([@kevinlewi](https://github.com/kevinlewi)). +This is a fork of [facebook/voprf](https://github.com/facebook/voprf/) maintained by [VexaHub](https://github.com/vexahub). + +The original author is Kevin Lewi ([@kevinlewi](https://github.com/kevinlewi)). To learn more about contributing to this project, [see this document](./CONTRIBUTING.md). License diff --git a/src/ciphersuite.rs b/src/ciphersuite.rs index 1eb0887..64e4c1f 100644 --- a/src/ciphersuite.rs +++ b/src/ciphersuite.rs @@ -12,8 +12,8 @@ use crate::Group; use core::ops::Mul; use digest::block_api::BlockSizeUser; use digest::typenum::{IsLess, IsLessOrEqual, U256}; -use digest::{Digest, FixedOutput, HashMarker, OutputSizeUser}; -use hash2curve::{ExpandMsg, GroupDigest, OprfParameters}; +use digest::{FixedOutput, HashMarker, OutputSizeUser}; +use hash2curve::{ExpandMsg, GroupDigest, MapToCurve, OprfParameters}; use hybrid_array::ArraySize; use hybrid_array::typenum::{IsGreaterOrEqual, Prod, True, U2}; @@ -36,34 +36,24 @@ where /// The main hash function to use (for HKDF computations and hashing /// transcripts). - type Hash: Digest + BlockSizeUser + Default + FixedOutput + HashMarker; + type Hash: BlockSizeUser + Default + FixedOutput + HashMarker; } -/// Trait associating a hash to an elliptic curve for OPRF usage. -pub trait OprfCipherSuite: OprfParameters + Group { - type Hash: Digest + BlockSizeUser + Default + FixedOutput + HashMarker + OutputSizeUser; -} +/// The hash function associated with a curve's OPRF `expand_message` implementation. +type OprfHash = + <::ExpandMsg as ExpandMsg<::SecurityLevel>>::Hash; -impl OprfCipherSuite for T -where - T: OprfParameters + Group, - ::ExpandMsg: ExpandMsg<::SecurityLevel>, - <::ExpandMsg as ExpandMsg<::SecurityLevel>>::Hash: - Digest + BlockSizeUser + Default + FixedOutput + HashMarker + OutputSizeUser, -{ - type Hash = <::ExpandMsg as ExpandMsg<::SecurityLevel>>::Hash; -} - -impl CipherSuite for T +impl CipherSuite for T where T: Group, ::SecurityLevel: Mul, - <::Hash as OutputSizeUser>::OutputSize: ArraySize + OprfHash: BlockSizeUser + Default + FixedOutput + HashMarker, + as OutputSizeUser>::OutputSize: ArraySize + IsLess - + IsLessOrEqual<<::Hash as BlockSizeUser>::BlockSize, Output = True> + + IsLessOrEqual< as BlockSizeUser>::BlockSize, Output = True> + IsGreaterOrEqual::SecurityLevel, U2>, Output = True>, { const ID: &'static [u8] = T::ID; type Group = T; - type Hash = ::Hash; + type Hash = OprfHash; } diff --git a/src/group/elliptic_curve.rs b/src/group/elliptic_curve.rs index ccb3b4f..2fed7c4 100644 --- a/src/group/elliptic_curve.rs +++ b/src/group/elliptic_curve.rs @@ -29,7 +29,7 @@ type ScalarLen = FieldBytesSize; impl Group for C where - C: GroupDigest + MapToCurve, + C: GroupDigest, C::SecurityLevel: Mul, C::SecurityLevel: ArraySize, >::Output: ArraySize, @@ -37,7 +37,6 @@ where ScalarLen: ModulusSize, ScalarLen: ArraySize, ScalarLen: hybrid_array::typenum::NonZero, - Scalar: elliptic_curve::ops::Reduce>>, Scalar: elliptic_curve::ops::Reduce::Length>>, AffinePoint: FromSec1Point + ToSec1Point, // `VoprfClientLen`, `PoprfClientLen`, `VoprfServerLen`, `PoprfServerLen` @@ -58,8 +57,6 @@ where type SecurityLevel = C::SecurityLevel; - type OkmLen = ::Length; - // Implements the `hash_to_curve()` function from // https://www.rfc-editor.org/rfc/rfc9380.html#section-3 fn hash_to_curve(input: &[&[u8]], dst: &[&[u8]]) -> Result { diff --git a/src/group/mod.rs b/src/group/mod.rs index 515379e..6155f51 100644 --- a/src/group/mod.rs +++ b/src/group/mod.rs @@ -66,9 +66,6 @@ where /// `expand_message` requirement `len_in_bytes = 2 * k / 8`. type SecurityLevel: ArraySize; - /// The OKM length for hash_to_scalar (>= ScalarLen, used by hash_to_field). - type OkmLen: ArraySize + hybrid_array::typenum::NonZero; - /// Transforms a password and domain separation tag (DST) into a curve point /// /// # Errors diff --git a/src/group/ristretto.rs b/src/group/ristretto.rs index d5e0b32..6d8532e 100644 --- a/src/group/ristretto.rs +++ b/src/group/ristretto.rs @@ -17,7 +17,7 @@ use digest::{FixedOutput, HashMarker}; use hash2curve::{ExpandMsg, ExpandMsgXmd, Expander}; use hybrid_array::Array; use hybrid_array::typenum::{ - IsGreaterOrEqual, IsLess, IsLessOrEqual, Prod, True, U2, U16, U32, U64, U256, + IsGreaterOrEqual, IsLess, IsLessOrEqual, Prod, True, U2, U16, U32, U256, }; use rand_core::{TryCryptoRng, TryRng}; use subtle::ConstantTimeEq; @@ -49,8 +49,6 @@ impl Group for Ristretto255 { type SecurityLevel = U16; - type OkmLen = U64; - // Implements the `hash_to_ristretto255()` function from // https://www.rfc-editor.org/rfc/rfc9380.html#appendix-B fn hash_to_curve(input: &[&[u8]], dst: &[&[u8]]) -> Result