Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.4.1 - draft-11 compatible, builds on latest Rust #135

Merged
merged 26 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6913b5d
Fix Clippy (#85)
daxpedda Dec 10, 2022
1691125
Update `curve25519-dalek` to 4.0.0-pre.5 (#86)
daxpedda Dec 18, 2022
8f60a10
Adding all-features CI test (#87)
kevinlewi Dec 18, 2022
a987a23
Upgrade `p256` to v0.12 (#90)
daxpedda Jan 19, 2023
3405773
Replace `json` with `serde_json` (#92)
daxpedda Jan 19, 2023
26dcfdf
Fix Clippy (#96)
daxpedda Jan 31, 2023
06bd7d5
Depend on `ProjectivePoint: ToEncodedPoint` (#95)
daxpedda Jan 31, 2023
40bcbb2
Update `curve25519-dalek` (#94)
daxpedda Jan 31, 2023
6c97fb7
Use explicit crate features (#100)
daxpedda Feb 1, 2023
68829f6
Bump `curve25519-dalek` to v4.0.0-rc.1 (#102)
daxpedda Feb 3, 2023
e988f56
Test P-384 (#84)
daxpedda Feb 8, 2023
6a64fa9
Update RustCrypto dependencies to v0.13 (#106)
daxpedda Mar 4, 2023
9bf0a44
Update curve25519-dalek requirement from =4.0.0-rc.1 to =4.0.0-rc.2 (…
dependabot[bot] Apr 2, 2023
7a2020e
Updating dual-license language (#110)
kevinlewi May 23, 2023
2ad47f8
Bump `curve25519-dalek` to v4.0.0-rc.3 (#113)
daxpedda Jun 26, 2023
f399c96
Bump `curve25519-dalek` to v4 (#116)
daxpedda Jul 24, 2023
24eddd5
Fixing clippy IntoIterator warnings (#123)
kevinlewi Sep 20, 2023
7e443c8
Bump actions/checkout from 3 to 4 (#120)
dependabot[bot] Sep 20, 2023
88d9366
Updating setup-rust-action (#125)
kevinlewi Sep 22, 2023
834fe58
Test P-521 (#127)
daxpedda Nov 13, 2023
b960f9a
Fix ambiguous lifetime elision (#131)
daxpedda Jan 17, 2024
0624c32
Bump actions/cache from 3 to 4 (#132)
dependabot[bot] Jan 17, 2024
45eb587
Fixups + cherry-picking changes from #101
cyyynthia Sep 22, 2024
a2db7f4
Fix Clippy warnings
cyyynthia Sep 22, 2024
34ac51a
More fixups, tests passing
cyyynthia Sep 22, 2024
9f5e791
Ensure CI runs on branch v0.4
kevinlewi Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .cargo/license.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under both the MIT license found in the
// LICENSE-MIT file in the root directory of this source tree and the Apache
// This source code is dual-licensed under either the MIT license found in the
// LICENSE-MIT file in the root directory of this source tree or the Apache
// License, Version 2.0 found in the LICENSE-APACHE file in the root directory
// of this source tree.
// of this source tree. You may select, at your option, one of the above-listed
// licenses.
39 changes: 22 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ on:
push:
branches:
- main
- v0.4
pull_request:
types: [opened, repoened, synchronize]
types: [opened, reopened, synchronize]

jobs:
cargo-audit:
name: Audit
runs-on: ubuntu-latest
steps:
- name: Cache cargo-audit
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/.crates.toml
Expand All @@ -24,7 +25,7 @@ jobs:
run: cargo install cargo-audit

- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run cargo audit
run: cargo audit -D warnings
Expand All @@ -35,20 +36,19 @@ jobs:
fail-fast: false
matrix:
backend_feature:
- --features ristretto255-ciphersuite,ristretto255-u64
- --features ristretto255-ciphersuite,ristretto255-u32
- --features ristretto255-ciphersuite
-
frontend_feature:
-
- --features danger
- --features serde
toolchain:
- stable
- 1.57.0
- 1.65.0
name: test
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install ${{ matrix.toolchain }} toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -75,6 +75,12 @@ jobs:
command: test
args: --no-default-features ${{ matrix.frontend_feature }},std ${{ matrix.backend_feature }}

- name: Run cargo test with all features enabled
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

build-no-std:
name: Build with no-std on ${{ matrix.target }}
runs-on: ubuntu-latest
Expand All @@ -88,15 +94,14 @@ jobs:
- thumbv6m-none-eabi
backend_feature:
-
- --features ristretto255-ciphersuite,ristretto255-u64
- --features ristretto255-ciphersuite,ristretto255-u32
- --features ristretto255-ciphersuite
frontend_feature:
-
- --features danger
- --features serde
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
- run: rustup target add ${{ matrix.target }}
- run: cargo build --verbose --target=${{ matrix.target }} --no-default-features ${{ matrix.frontend_feature }} ${{ matrix.backend_feature }}

Expand All @@ -106,7 +111,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -120,7 +125,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets -- -D warnings
args: --all-features --all-targets -- -D warnings

- name: Run cargo doc
uses: actions-rs/cargo@v1
Expand All @@ -136,7 +141,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -157,7 +162,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/.crates.toml
Expand All @@ -166,10 +171,10 @@ jobs:
key: taplo

- name: Install Taplo
run: cargo install taplo-cli
run: cargo install taplo-cli --locked

- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Taplo
run: taplo fmt --check
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]

steps:
- uses: hecrj/setup-rust-action@v1
- uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust }}
- uses: actions/checkout@master
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# Editors
.idea
.vscode
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.4.1 (TBD)
* Backport all non-protocol-breaking changes from versions 0.5+
* Fixes Rust 1.81+ compatibility, compatible with 0.4.0 (draft 11), incompatible with 0.5+ (final RFC)
* Updated dependencies

## 0.4.0 (September 15, 2022)
* Updated to be in sync with draft-irtf-cfrg-voprf-11, with
the addition of the POPRF mode
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ outlined on that page and do not file a public issue.

## License
By contributing to voprf, you agree that your contributions will be
licensed under the LICENSE file in the root directory of this source tree.
licensed under both the LICENSE-MIT and LICENSE-APACHE files in the root
directory of this source tree.
47 changes: 27 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,63 @@ keywords = ["oprf"]
license = "MIT"
name = "voprf"
readme = "README.md"
repository = "https://github.com/novifinancial/voprf/"
rust-version = "1.57"
version = "0.4.0"
repository = "https://github.com/facebook/voprf/"
rust-version = "1.65"
version = "0.4.1"

[features]
alloc = []
danger = []
default = ["ristretto255-ciphersuite", "ristretto255-u64", "serde"]
ristretto255 = ["curve25519-dalek", "generic-array/more_lengths"]
ristretto255-ciphersuite = ["ristretto255", "sha2"]
ristretto255-fiat-u32 = ["curve25519-dalek/fiat_u32_backend", "ristretto255"]
ristretto255-fiat-u64 = ["curve25519-dalek/fiat_u64_backend", "ristretto255"]
ristretto255-simd = ["curve25519-dalek/simd_backend", "ristretto255"]
ristretto255-u32 = ["curve25519-dalek/u32_backend", "ristretto255"]
ristretto255-u64 = ["curve25519-dalek/u64_backend", "ristretto255"]
serde = ["generic-array/serde", "serde_"]
default = ["ristretto255-ciphersuite", "dep:serde"]
ristretto255 = ["dep:curve25519-dalek", "generic-array/more_lengths"]
ristretto255-ciphersuite = ["ristretto255", "dep:sha2"]
serde = ["generic-array/serde", "dep:serde"]
std = ["alloc"]

[dependencies]
curve25519-dalek = { version = "=4.0.0-pre.1", default-features = false, optional = true }
curve25519-dalek = { version = "4", default-features = false, features = [
"rand_core",
"zeroize",
], optional = true }
derive-where = { version = "1", features = ["zeroize-on-drop"] }
digest = "0.10"
displaydoc = { version = "0.2", default-features = false }
elliptic-curve = { version = "0.12", features = [
elliptic-curve = { version = "0.13", features = [
"hash2curve",
"sec1",
"voprf",
] }
generic-array = "0.14"
rand_core = { version = "0.6", default-features = false }
serde_ = { version = "1", package = "serde", default-features = false, features = [
serde = { version = "1", default-features = false, features = [
"derive",
], optional = true }
sha2 = { version = "0.10", default-features = false, optional = true }
subtle = { version = "2.3", default-features = false }
zeroize = { version = "1.5", default-features = false }
subtle = { version = "2.6", default-features = false }
zeroize = { version = "1.8", default-features = false }

[dev-dependencies]
generic-array = { version = "0.14", features = ["more_lengths"] }
hex = "0.4"
json = "0.12"
p256 = { version = "0.11", default-features = false, features = [
p256 = { version = "0.13", default-features = false, features = [
"hash2curve",
"voprf",
] }
p384 = { version = "0.13", default-features = false, features = [
"hash2curve",
"voprf",
] }
p521 = { version = "0.13.3", default-features = false, features = [
"hash2curve",
"voprf",
] }
proptest = "1"
rand = "0.8"
regex = "1"
serde_json = "1"
sha2 = "0.10"

[package.metadata.docs.rs]
features = ["danger", "std"]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
targets = []
12 changes: 0 additions & 12 deletions LICENSE

This file was deleted.

10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# voprf ![Build Status](https://github.com/novifinancial/voprf/workflows/Rust%20CI/badge.svg)
# voprf ![Build Status](https://github.com/facebook/voprf/workflows/Rust%20CI/badge.svg)
An implementation of a (verifiable) oblivious pseudorandom function (VOPRF)

A VOPRF is a verifiable oblivious pseudorandom function, a protocol between a client and a server. The regular (non-verifiable) OPRF is also supported in this implementation.
Expand All @@ -16,12 +16,12 @@ Installation
Add the following line to the dependencies of your `Cargo.toml`:

```
voprf = "0.4"
voprf = "0.4.1"
```

### Minimum Supported Rust Version

Rust **1.57** or higher.
Rust **1.65** or higher.

Contributors
------------
Expand All @@ -32,4 +32,6 @@ To learn more about contributing to this project, [see this document](./CONTRIBU
License
-------

This project is [licensed](./LICENSE) under either Apache 2.0 or MIT, at your option.
This project is dual-licensed under either the [MIT license](./LICENSE-MIT)
or the [Apache License, Version 2.0](./LICENSE-APACHE).
You may select, at your option, one of the above-listed licenses.
19 changes: 10 additions & 9 deletions src/ciphersuite.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under both the MIT license found in the
// LICENSE-MIT file in the root directory of this source tree and the Apache
// This source code is dual-licensed under either the MIT license found in the
// LICENSE-MIT file in the root directory of this source tree or the Apache
// License, Version 2.0 found in the LICENSE-APACHE file in the root directory
// of this source tree.
// of this source tree. You may select, at your option, one of the above-listed
// licenses.

//! Defines the CipherSuite trait to specify the underlying primitives for VOPRF

use digest::core_api::BlockSizeUser;
use digest::{Digest, OutputSizeUser};
use digest::{FixedOutput, HashMarker, OutputSizeUser};
use elliptic_curve::VoprfParameters;
use generic_array::typenum::{IsLess, IsLessOrEqual, U256};

Expand All @@ -22,25 +23,25 @@ where
{
/// The ciphersuite identifier as dictated by
/// <https://datatracker.ietf.org/doc/draft-irtf-cfrg-voprf/>
const ID: u16;
const ID: &'static str;

/// A finite cyclic group along with a point representation that allows some
/// customization on how to hash an input to a curve point. See [`Group`].
type Group: Group;

/// The main hash function to use (for HKDF computations and hashing
/// transcripts).
type Hash: BlockSizeUser + Digest;
type Hash: BlockSizeUser + Default + FixedOutput + HashMarker;
}

impl<T: VoprfParameters> CipherSuite for T
where
T: Group,
T::Hash: BlockSizeUser + Digest,
T::Hash: BlockSizeUser + Default + FixedOutput + HashMarker,
<T::Hash as OutputSizeUser>::OutputSize:
IsLess<U256> + IsLessOrEqual<<T::Hash as BlockSizeUser>::BlockSize>,
{
const ID: u16 = T::ID;
const ID: &'static str = T::ID;

type Group = T;

Expand Down
Loading
Loading