Update curve25519-dalek to 4.0.0-pre.5 (#301)

* Update `curve25519-dalek`

* Improve documentation

* Update `voprf` to 0.5.0-pre.1
This commit is contained in:
daxpedda
2022-12-19 14:04:52 -08:00
committed by GitHub
parent 2dc2b0e617
commit 8901b74030
7 changed files with 44 additions and 75 deletions
+14 -26
View File
@@ -13,13 +13,10 @@ jobs:
fail-fast: false
matrix:
backend_feature:
- --features ristretto255-u64,ristretto255-voprf
- --features ristretto255-u32,ristretto255-voprf
- --features ristretto255-voprf
-
- --features curve25519-u64,ristretto255-u64,ristretto255-voprf
- --features curve25519-u32,ristretto255-u32,ristretto255-voprf
- --features curve25519-u64
- --features curve25519-u32
- --features curve25519,ristretto255-voprf
- --features curve25519
frontend_feature:
-
- --features argon2
@@ -61,13 +58,10 @@ jobs:
# 32-bit x86
- i686-unknown-linux-gnu
backend_feature:
- --features ristretto255-u64,ristretto255-voprf
- --features ristretto255-u32,ristretto255-voprf
- --features ristretto255-voprf
-
- curve25519-u64,ristretto255-u64,ristretto255-voprf
- curve25519-u32,ristretto255-u64,ristretto255-voprf
- curve25519-u64
- curve25519-u32
- curve25519,ristretto255-voprf
- curve25519
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
@@ -135,13 +129,10 @@ jobs:
# for any no_std target
- thumbv6m-none-eabi
backend_feature:
- ristretto255-u64,ristretto255-voprf
- ristretto255-u32,ristretto255-voprf
- ristretto255-voprf
-
- curve25519-u64,ristretto255-u64,ristretto255-voprf
- curve25519-u32,ristretto255-u32,ristretto255-voprf
- curve25519-u64
- curve25519-u32
- curve25519,ristretto255-voprf
- curve25519
frontend_feature:
- argon2
- serde
@@ -158,13 +149,10 @@ jobs:
fail-fast: false
matrix:
backend_feature:
- --features ristretto255-u64,ristretto255-voprf
- --features ristretto255-u32,ristretto255-voprf
- --features ristretto255-voprf
-
- --features curve25519-u64,ristretto255-u64,ristretto255-voprf
- --features curve25519-u32,ristretto255-u32,ristretto255-voprf
- --features curve25519-u32
- --features curve25519-u32
- --features curve25519,ristretto255-voprf
- --features curve25519
steps:
- name: Checkout sources
uses: actions/checkout@v3
@@ -201,7 +189,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --features argon2,std,curve25519-u64 -- -D warnings
args: --all-targets --features argon2,std,curve25519 -- -D warnings
- name: Run cargo doc
uses: actions-rs/cargo@v1
@@ -209,7 +197,7 @@ jobs:
RUSTDOCFLAGS: -D warnings
with:
command: doc
args: --no-deps --document-private-items --features argon2,std,curve25519-u64
args: --no-deps --document-private-items --features argon2,std,curve25519
format:
name: cargo fmt
+9 -14
View File
@@ -13,18 +13,8 @@ version = "2.0.0"
[features]
curve25519 = ["curve25519-dalek"]
curve25519-fiat-u32 = ["curve25519-dalek/fiat_u32_backend", "curve25519"]
curve25519-fiat-u64 = ["curve25519-dalek/fiat_u64_backend", "curve25519"]
curve25519-u32 = ["curve25519-dalek/u32_backend", "curve25519"]
curve25519-u64 = ["curve25519-dalek/u64_backend", "curve25519"]
curve255195519-simd = ["curve25519-dalek/simd_backend", "curve25519"]
default = ["ristretto255-u64", "ristretto255-voprf", "serde"]
default = ["ristretto255-voprf", "serde"]
ristretto255 = ["curve25519-dalek", "voprf/ristretto255"]
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"]
ristretto255-voprf = ["ristretto255", "voprf/ristretto255-ciphersuite"]
serde = ["serde_", "generic-array/serde", "voprf/serde"]
std = ["getrandom"]
@@ -33,7 +23,9 @@ std = ["getrandom"]
argon2 = { version = "0.4", default-features = false, features = [
"alloc",
], optional = true }
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 }
@@ -46,7 +38,9 @@ serde_ = { version = "1", package = "serde", default-features = false, features
"derive",
], optional = true }
subtle = { version = "2.3", default-features = false }
voprf = { version = "0.4", default-features = false, features = ["danger"] }
voprf = { version = "=0.5.0-pre.1", default-features = false, features = [
"danger",
] }
zeroize = { version = "1.5", features = ["zeroize_derive"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
@@ -74,7 +68,8 @@ harness = false
name = "opaque"
[package.metadata.docs.rs]
features = ["argon2", "std", "curve25519-u64"]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
targets = []
[[example]]
+2 -8
View File
@@ -12,14 +12,8 @@ use criterion::Criterion;
use opaque_ke::*;
use rand::rngs::OsRng;
#[cfg(feature = "ristretto255-u64")]
static SUFFIX: &str = "ristretto255-u64";
#[cfg(feature = "ristretto255-u32")]
static SUFFIX: &str = "ristretto255-u32";
#[cfg(feature = "ristretto255-fiat-u64")]
static SUFFIX: &str = "ristretto255-fiat-u64";
#[cfg(feature = "ristretto255-fiat-u32")]
static SUFFIX: &str = "ristretto255-fiat-u32";
#[cfg(feature = "ristretto255")]
static SUFFIX: &str = "ristretto255";
#[cfg(all(not(feature = "ristretto255")))]
static SUFFIX: &str = "p256";
+5 -5
View File
@@ -49,7 +49,7 @@ impl KeGroup for Curve25519 {
loop {
let scalar = Scalar::random(rng);
if scalar != Scalar::zero() {
if scalar != Scalar::ZERO {
break scalar;
}
}
@@ -69,7 +69,7 @@ impl KeGroup for Curve25519 {
let scalar = Scalar::from_bytes_mod_order_wide(&uniform_bytes.into());
if scalar == Scalar::zero() {
if scalar == Scalar::ZERO {
Err(InternalError::HashToScalar)
} else {
Ok(scalar)
@@ -77,7 +77,7 @@ impl KeGroup for Curve25519 {
}
fn is_zero_scalar(scalar: Self::Sk) -> subtle::Choice {
scalar.ct_eq(&Scalar::zero())
scalar.ct_eq(&Scalar::ZERO)
}
fn public_key(sk: Self::Sk) -> Self::Pk {
@@ -96,8 +96,8 @@ impl KeGroup for Curve25519 {
bytes
.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(InternalError::PointError)
}
}
+4 -4
View File
@@ -66,7 +66,7 @@ impl KeGroup for Ristretto255 {
}
};
if scalar != Scalar::zero() {
if scalar != Scalar::ZERO {
break scalar;
}
}
@@ -84,7 +84,7 @@ impl KeGroup for Ristretto255 {
}
fn is_zero_scalar(scalar: Self::Sk) -> subtle::Choice {
scalar.ct_eq(&Scalar::zero())
scalar.ct_eq(&Scalar::ZERO)
}
fn public_key(sk: Self::Sk) -> Self::Pk {
@@ -103,8 +103,8 @@ impl KeGroup for Ristretto255 {
bytes
.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(InternalError::PointError)
}
}
+9 -17
View File
@@ -1097,23 +1097,12 @@
//!
//! - The `serde` feature, enabled by default, provides convenience functions for serializing and deserializing with [serde](https://serde.rs/).
//!
//! - The backend features are re-exported from [curve25519-dalek](https://doc.dalek.rs/curve25519_dalek/index.html#backends-and-features)
//! and allow for selecting the corresponding backend for the curve arithmetic
//! used. 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, which can be used too, but keep in mind that
//! `curve25519-dalek` will fail to compile without a selected backend. This
//! enables the use of [`Ristretto255`] as a `KeGroup` and `OprfCs`.
//! - The `ristretto255` feature enables using [`Ristretto255`] as a `KeGroup`
//! and `OprfCs`. To select a specific backend see the [curve25519-dalek]
//! documentation.
//!
//! - The `curve25519` feature is similar to the `ristretto255` feature and
//! requires to select a backend like `curve25519-u64`, other backends are the
//! same as in `ristretto255-*`. This enables [`Curve25519`] as a `KeGroup`.
//!
//! - The `ristretto255-simd` feature is re-exported from [curve25519-dalek](https://doc.dalek.rs/curve25519_dalek/index.html#backends-and-features)
//! and enables parallel formulas, using either AVX2 or AVX512-IFMA. This will
//! automatically enable the `ristretto255-u64` feature and requires Rust
//! nightly.
//! - The `curve25519` feature enables [`Curve25519`] as a `KeGroup`. To select
//! a specific backend see the [curve25519-dalek] documentation.
//!
//! - The `p256` feature enables the use of [`p256::NistP256`] as a `KeGroup`
//! and a `OprfCs` for `CipherSuite`.
@@ -1121,10 +1110,13 @@
//! - The `bench` feature is used only for running performance benchmarks for
//! this implementation.
//!
//! [curve25519-dalek]:
//! (https://docs.rs/curve25519-dalek/4.0.0-pre.5/curve25519_dalek/index.html#backends)
//! [`p256::NistP256`]: https://docs.rs/p256/latest/p256/struct.NistP256.html
#![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, missing_docs)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![allow(type_alias_bounds)]
+1 -1
View File
@@ -122,7 +122,7 @@ static STR_PASSWORD: &str = "password";
static STR_CREDENTIAL_IDENTIFIER: &str = "credential_identifier";
// To regenerate these test vectors, run:
// cargo test --features curve25519-u64 -- --nocapture generate_test_vectors
// cargo test --features curve25519 -- --nocapture generate_test_vectors
#[cfg(feature = "ristretto255")]
static TEST_VECTOR_RISTRETTO255: &str = r#"
{