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
+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#"
{