Compare commits
4
Commits
v0.4.0
...
v0.5.0-pre.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a351ceb4d | ||
|
|
8f60a10b8d | ||
|
|
1691125b09 | ||
|
|
6913b5deaa |
@@ -35,8 +35,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
backend_feature:
|
||||
- --features ristretto255-ciphersuite,ristretto255-u64
|
||||
- --features ristretto255-ciphersuite,ristretto255-u32
|
||||
- --features ristretto255-ciphersuite
|
||||
-
|
||||
frontend_feature:
|
||||
-
|
||||
@@ -75,6 +74,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
|
||||
@@ -88,8 +93,7 @@ jobs:
|
||||
- thumbv6m-none-eabi
|
||||
backend_feature:
|
||||
-
|
||||
- --features ristretto255-ciphersuite,ristretto255-u64
|
||||
- --features ristretto255-ciphersuite,ristretto255-u32
|
||||
- --features ristretto255-ciphersuite
|
||||
frontend_feature:
|
||||
-
|
||||
- --features danger
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
## 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
|
||||
|
||||
+7
-9
@@ -9,24 +9,21 @@ name = "voprf"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/novifinancial/voprf/"
|
||||
rust-version = "1.57"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0-pre.1"
|
||||
|
||||
[features]
|
||||
alloc = []
|
||||
danger = []
|
||||
default = ["ristretto255-ciphersuite", "ristretto255-u64", "serde"]
|
||||
default = ["ristretto255-ciphersuite", "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_"]
|
||||
std = ["alloc"]
|
||||
|
||||
[dependencies]
|
||||
curve25519-dalek = { version = "=4.0.0-pre.1", default-features = false, optional = true }
|
||||
curve25519-dalek = { version = "=4.0.0-pre.5", default-features = false, features = [
|
||||
"rand_core",
|
||||
], optional = true }
|
||||
derive-where = { version = "1", features = ["zeroize-on-drop"] }
|
||||
digest = "0.10"
|
||||
displaydoc = { version = "0.2", default-features = false }
|
||||
@@ -58,5 +55,6 @@ regex = "1"
|
||||
sha2 = "0.10"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["danger", "std"]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = []
|
||||
|
||||
@@ -16,7 +16,7 @@ Installation
|
||||
Add the following line to the dependencies of your `Cargo.toml`:
|
||||
|
||||
```
|
||||
voprf = "0.4"
|
||||
voprf = "0.5.0-pre.1"
|
||||
```
|
||||
|
||||
### Minimum Supported Rust Version
|
||||
|
||||
+1
-1
@@ -302,7 +302,7 @@ where
|
||||
// I2OSP(len(seedDST), 2) || seedDST
|
||||
// seed = Hash(h1Input)
|
||||
let seed = CS::Hash::new()
|
||||
.chain_update(&elem_len)
|
||||
.chain_update(elem_len)
|
||||
.chain_update(CS::Group::serialize_elem(b))
|
||||
.chain_update(i2osp_2_array(&seed_dst))
|
||||
.chain_update(seed_dst)
|
||||
|
||||
@@ -22,8 +22,6 @@ use crate::{Error, InternalError, Result};
|
||||
|
||||
/// [`Group`] implementation for Ristretto255.
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
// `cfg` here is only needed because of a bug in Rust's crate feature documentation. See: https://github.com/rust-lang/rust/issues/83428
|
||||
#[cfg(feature = "ristretto255")]
|
||||
pub struct Ristretto255;
|
||||
|
||||
#[cfg(feature = "ristretto255-ciphersuite")]
|
||||
@@ -35,8 +33,6 @@ impl crate::CipherSuite for Ristretto255 {
|
||||
type Hash = sha2::Sha512;
|
||||
}
|
||||
|
||||
// `cfg` here is only needed because of a bug in Rust's crate feature documentation. See: https://github.com/rust-lang/rust/issues/83428
|
||||
#[cfg(feature = "ristretto255")]
|
||||
impl Group for Ristretto255 {
|
||||
type Elem = RistrettoPoint;
|
||||
|
||||
@@ -104,7 +100,7 @@ impl Group for Ristretto255 {
|
||||
loop {
|
||||
let scalar = Scalar::random(rng);
|
||||
|
||||
if scalar != Scalar::zero() {
|
||||
if scalar != Scalar::ZERO {
|
||||
break scalar;
|
||||
}
|
||||
}
|
||||
@@ -115,12 +111,12 @@ impl Group for Ristretto255 {
|
||||
}
|
||||
|
||||
fn is_zero_scalar(scalar: Self::Scalar) -> subtle::Choice {
|
||||
scalar.ct_eq(&Scalar::zero())
|
||||
scalar.ct_eq(&Scalar::ZERO)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn zero_scalar() -> Self::Scalar {
|
||||
Scalar::zero()
|
||||
Scalar::ZERO
|
||||
}
|
||||
|
||||
fn serialize_scalar(scalar: Self::Scalar) -> GenericArray<u8, Self::ScalarLen> {
|
||||
@@ -131,8 +127,8 @@ impl Group for Ristretto255 {
|
||||
scalar_bits
|
||||
.try_into()
|
||||
.ok()
|
||||
.and_then(Scalar::from_canonical_bytes)
|
||||
.filter(|scalar| scalar != &Scalar::zero())
|
||||
.and_then(|bytes| Scalar::from_canonical_bytes(bytes).into())
|
||||
.filter(|scalar| scalar != &Scalar::ZERO)
|
||||
.ok_or(Error::Deserialization)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-14
@@ -532,24 +532,15 @@
|
||||
//! a [`CipherSuite`].
|
||||
//!
|
||||
//! - The `ristretto255` feature enables using [`Ristretto255`] as the
|
||||
//! underlying group for the [Group] choice. A backend feature, which are
|
||||
//! re-exported from [curve25519-dalek] and allow for selecting the
|
||||
//! corresponding backend for the curve arithmetic used, has to be selected,
|
||||
//! otherwise compilation will fail. The `ristretto255-u64` feature is
|
||||
//! included as the default. Other features are mapped as `ristretto255-u32`,
|
||||
//! `ristretto255-fiat-u64` and `ristretto255-fiat-u32`. Any `ristretto255-*`
|
||||
//! backend feature will enable the `ristretto255` feature.
|
||||
//!
|
||||
//! - The `ristretto255-simd` feature is re-exported from [curve25519-dalek] and
|
||||
//! enables parallel formulas, using either AVX2 or AVX512-IFMA. This will
|
||||
//! automatically enable the `ristretto255-u64` feature and requires Rust
|
||||
//! nightly.
|
||||
//! underlying group for the [Group] choice. To select a specific backend see
|
||||
//! the [curve25519-dalek] documentation.
|
||||
//!
|
||||
//! [curve25519-dalek]:
|
||||
//! (https://doc.dalek.rs/curve25519_dalek/index.html#backends-and-features)
|
||||
//! (https://docs.rs/curve25519-dalek/4.0.0-pre.5/curve25519_dalek/index.html#backends)
|
||||
|
||||
#![cfg_attr(not(test), deny(unsafe_code))]
|
||||
#![no_std]
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#![cfg_attr(not(test), deny(unsafe_code))]
|
||||
#![warn(
|
||||
clippy::cargo,
|
||||
clippy::missing_errors_doc,
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ where
|
||||
.chain_update(input.as_ref())
|
||||
.chain_update(elem_len)
|
||||
.chain_update(CS::Group::serialize_elem(unblinded_element))
|
||||
.chain_update(&STR_FINALIZE)
|
||||
.chain_update(STR_FINALIZE)
|
||||
.finalize())
|
||||
})
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ impl RngCore for CycleRng {
|
||||
#[inline]
|
||||
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
||||
let len = min(self.v.len(), dest.len());
|
||||
(&mut dest[..len]).copy_from_slice(&self.v[..len]);
|
||||
dest[..len].copy_from_slice(&self.v[..len]);
|
||||
rotate_left(&mut self.v, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,15 +60,15 @@ fn populate_test_vectors(values: &JsonValue) -> VOPRFTestVectorParameters {
|
||||
fn decode(values: &JsonValue, key: &str) -> Vec<u8> {
|
||||
values[key]
|
||||
.as_str()
|
||||
.and_then(|s| hex::decode(&s).ok())
|
||||
.and_then(|s| hex::decode(s).ok())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn decode_vec(values: &JsonValue, key: &str) -> Vec<Vec<u8>> {
|
||||
let s = values[key].as_str().unwrap();
|
||||
let res = match s.contains(',') {
|
||||
true => Some(s.split(',').map(|x| hex::decode(&x).unwrap()).collect()),
|
||||
false => Some(vec![hex::decode(&s).unwrap()]),
|
||||
true => Some(s.split(',').map(|x| hex::decode(x).unwrap()).collect()),
|
||||
false => Some(vec![hex::decode(s).unwrap()]),
|
||||
};
|
||||
res.unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user