Update curve25519-dalek to 4.0.0-pre.5 (#86)
* Update `curve25519-dalek` * Improve documentation
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user