diff --git a/CHANGELOG.md b/CHANGELOG.md index 51d8c10..1a8aa98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.4.0-pre.1 (April 1, 2022) +* Updated to be in sync with draft-irtf-cfrg-voprf-09, with + the addition of the POPRF mode +* Added support for running the API without performing allocations +* Revamped the way the Group trait was used, so as to be more easily + extendable to other groups +* Added common traits for each public-facing struct, including serde + support + ## 0.3.0 (October 25, 2021) * Updated to be in sync with draft-irtf-cfrg-voprf-08 diff --git a/Cargo.toml b/Cargo.toml index ce1766b..0ced17d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ name = "voprf" readme = "README.md" repository = "https://github.com/novifinancial/voprf/" rust-version = "1.57" -version = "0.3.0" +version = "0.4.0-pre.1" [features] alloc = [] diff --git a/README.md b/README.md index 90d06d0..d076ebe 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Installation Add the following line to the dependencies of your `Cargo.toml`: ``` -voprf = "0.3" +voprf = "0.4.0-pre.1" ``` ### Minimum Supported Rust Version diff --git a/src/ciphersuite.rs b/src/ciphersuite.rs index 87a295c..734c9ca 100644 --- a/src/ciphersuite.rs +++ b/src/ciphersuite.rs @@ -21,7 +21,7 @@ where IsLess + IsLessOrEqual<::BlockSize>, { /// The ciphersuite identifier as dictated by - /// + /// const ID: u16; /// A finite cyclic group along with a point representation that allows some diff --git a/src/common.rs b/src/common.rs index d30fced..628a700 100644 --- a/src/common.rs +++ b/src/common.rs @@ -153,7 +153,7 @@ where ::OutputSize: IsLess + IsLessOrEqual<::BlockSize>, { - // https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-08.html#section-3.3.2.2-1 + // https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-09.html#section-2.2.1 let (m, z) = compute_composites::(Some(k), b, cs, ds, mode)?; @@ -216,7 +216,7 @@ where ::OutputSize: IsLess + IsLessOrEqual<::BlockSize>, { - // https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-08.html#section-3.3.4.1-2 + // https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-09.html#section-2.2.2 let (m, z) = compute_composites::(None, b, cs, ds, mode)?; let t2 = (a * &proof.s_scalar) + &(b * &proof.c_scalar); let t3 = (m * &proof.s_scalar) + &(z * &proof.c_scalar); @@ -285,7 +285,7 @@ where ::OutputSize: IsLess + IsLessOrEqual<::BlockSize>, { - // https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-08.html#section-3.3.2.3-2 + // https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-09.html#section-2.2.1 let elem_len = ::ElemLen::U16.to_be_bytes(); @@ -430,7 +430,7 @@ where } /// Generates the contextString parameter as defined in -/// +/// pub(crate) fn create_context_string(mode: Mode) -> GenericArray where ::OutputSize: diff --git a/src/lib.rs b/src/lib.rs index a9a3ffd..659787b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,20 +8,17 @@ //! An implementation of a verifiable oblivious pseudorandom function (VOPRF) //! //! Note: This implementation is in sync with -//! [draft-irtf-cfrg-voprf-08](https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-08.html), +//! [draft-irtf-cfrg-voprf-09](https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-09.html), //! but this specification is subject to change, until the final version //! published by the IETF. //! //! # Overview //! //! A verifiable oblivious pseudorandom function is a protocol that is evaluated -//! between a client and a server. They must first agree on a collection of -//! primitives to be kept consistent throughout protocol execution. These -//! include: -//! - a finite cyclic group along with a point representation, and -//! - a hashing function. +//! between a client and a server. They must first agree on a finite cyclic +//! group along with a point representation. //! -//! We will use the following choices in this example: +//! We will use the following choice in this example: //! //! ```ignore //! type CipherSuite = voprf::Ristretto255; @@ -29,19 +26,22 @@ //! //! ## Modes of Operation //! -//! VOPRF can be used in two modes: +//! VOPRF can be used in three modes: //! - [Base Mode](#base-mode), which corresponds to a normal OPRF evaluation //! with no support for the verification of the OPRF outputs //! - [Verifiable Mode](#verifiable-mode), which corresponds to an OPRF //! evaluation where the outputs can be verified against a server public key +//! (VOPRF) +//! - [Partially Oblivious Verifiable Mode](#metadata), which corresponds to a +//! VOPRF, where a public input can be supplied to the PRF computation //! -//! In either mode, the protocol begins with a client blinding, followed by a -//! server evaluation, and finishes with a client finalization. +//! In all of these modes, the protocol begins with a client blinding, followed +//! by a server evaluation, and finishes with a client finalization. //! //! ## Base Mode //! -//! In base mode, a [OprfClient] interacts with a [OprfServer] -//! to compute the output of the VOPRF. +//! In base mode, an [OprfClient] interacts with an [OprfServer] +//! to compute the output of the OPRF. //! //! ### Server Setup //! @@ -65,8 +65,8 @@ //! ### Client Blinding //! //! In the first step, the client chooses an input, and runs -//! [OprfClient::blind] to produce a [OprfClientBlindResult], -//! which consists of a [BlindedElement] to be sent to the server and a +//! [OprfClient::blind] to produce an [OprfClientBlindResult], +//! which consists of a [BlindedElement] to be sent to the server and an //! [OprfClient] which must be persisted on the client for the final //! step of the VOPRF protocol. //! @@ -340,7 +340,7 @@ //! let messages: Vec<_> = messages.collect(); //! ``` //! -//! If `alloc` is available, [VoprfServer::batch_evaluate] can be called +//! If `alloc` is available, `VoprfServer::batch_evaluate` can be called //! to avoid having to collect output manually: //! //! ``` @@ -419,16 +419,19 @@ //! //! ## Metadata //! -//! The optional metadata parameter included in the protocol allows clients and -//! servers (of either mode) to cryptographically bind additional data to the +//! The optional metadata parameter included in the POPRF mode allows clients +//! and servers to cryptographically bind additional data to the //! VOPRF output. This metadata is known to both parties at the start of the //! protocol, and is inserted under the server's evaluate step and the client's //! finalize step. This metadata can be constructed with some type of //! higher-level domain separation to avoid cross-protocol attacks or related //! issues. //! -//! A custom metadata can be specified, for example, by: -//! `Some(b"custom metadata")`. +//! The API for POPRF mode is similar to VOPRF mode, except that a [PoprfServer] +//! and [PoprfClient] are used, and that each of the functions accept an +//! additional (and optional) info parameter which represents the public input. +//! See +//! for more detailed information on how this public input should be used. //! //! # Features //! diff --git a/src/poprf.rs b/src/poprf.rs index cfcd57f..2191983 100644 --- a/src/poprf.rs +++ b/src/poprf.rs @@ -319,7 +319,7 @@ where Ok(PoprfServerBatchEvaluateResult { messages, proof }) } - /// Alternative version of [`batch_evaluate`](Self::batch_evaluate) without + /// Alternative version of `batch_evaluate` without /// memory allocation. Returned [`PreparedEvaluationElement`] have to /// be [`collect`](Iterator::collect)ed and passed into /// [`batch_evaluate_finish`](Self::batch_evaluate_finish). diff --git a/src/voprf.rs b/src/voprf.rs index 5538d55..6f4ab81 100644 --- a/src/voprf.rs +++ b/src/voprf.rs @@ -310,7 +310,7 @@ where Ok(VoprfServerBatchEvaluateResult { messages, proof }) } - /// Alternative version of [`batch_evaluate`](Self::batch_evaluate) without + /// Alternative version of `batch_evaluate` without /// memory allocation. Returned [`PreparedEvaluationElement`] have to be /// [`collect`](Iterator::collect)ed and passed into /// [`batch_evaluate_finish`](Self::batch_evaluate_finish).