From 710adeb95d0f37084d2c1dc39b0fd98b12180ca4 Mon Sep 17 00:00:00 2001 From: Michael Lodder Date: Fri, 16 Feb 2024 09:39:32 -0700 Subject: [PATCH] merge in changes from dalek Signed-off-by: Michael Lodder --- curve25519-dalek/Cargo.toml | 5 ++--- curve25519-dalek/src/edwards.rs | 8 ++++---- curve25519-dalek/src/ristretto.rs | 18 +++++++++--------- curve25519-dalek/src/scalar.rs | 28 ++++++++++++++-------------- curve25519-dalek/src/traits.rs | 28 ++++++++++++++-------------- 5 files changed, 43 insertions(+), 44 deletions(-) diff --git a/curve25519-dalek/Cargo.toml b/curve25519-dalek/Cargo.toml index b722620c2..40befcd42 100644 --- a/curve25519-dalek/Cargo.toml +++ b/curve25519-dalek/Cargo.toml @@ -4,9 +4,8 @@ name = "curve25519-dalek-ml" # - update CHANGELOG # - update README if required by semver # - if README was updated, also update module documentation in src/lib.rs -version = "4.1.2" +version = "4.2.0" edition = "2021" -rust-version = "1.60.0" authors = ["Isis Lovecruft ", "Henry de Valence ", "Michael Lodder "] @@ -49,7 +48,7 @@ required-features = ["alloc", "rand_core"] [dependencies] cfg-if = "1" -elliptic-curve = { version = "0.13.5", features = ["hash2curve"], optional = true } +elliptic-curve = { version = "0.13", features = ["hash2curve"], optional = true } ff = { version = "0.13", default-features = false, optional = true } group = { version = "0.13", default-features = false, optional = true } rand_core = { version = "0.6.4", default-features = false, optional = true } diff --git a/curve25519-dalek/src/edwards.rs b/curve25519-dalek/src/edwards.rs index f368a0abb..068966a7f 100644 --- a/curve25519-dalek/src/edwards.rs +++ b/curve25519-dalek/src/edwards.rs @@ -1,6 +1,6 @@ // -*- mode: rust; -*- // -// This file is part of curve25519-dalek. +// This file is part of curve25519-dalek_ml. // Copyright (c) 2016-2021 isis lovecruft // Copyright (c) 2016-2020 Henry de Valence // See LICENSE for licensing information. @@ -85,7 +85,7 @@ //! successful decompression of a compressed point, or else by //! operations on other (valid) `EdwardsPoint`s. //! -//! [curve_models]: https://docs.rs/curve25519-dalek/latest/curve25519-dalek/backend/serial/curve_models/index.html +//! [curve_models]: https://docs.rs/curve25519-dalek_ml/latest/curve25519-dalek/backend/serial/curve_models/index.html // We allow non snake_case names because coordinates in projective space are // traditionally denoted by the capitalisation of their respective @@ -1281,7 +1281,7 @@ impl EdwardsPoint { /// # Example /// /// ``` - /// use curve25519_dalek::constants; + /// use curve25519_dalek_ml::constants; /// /// // Generator of the prime-order subgroup /// let P = constants::ED25519_BASEPOINT_POINT; @@ -1311,7 +1311,7 @@ impl EdwardsPoint { /// # Example /// /// ``` - /// use curve25519_dalek::constants; + /// use curve25519_dalek_ml::constants; /// /// // Generator of the prime-order subgroup /// let P = constants::ED25519_BASEPOINT_POINT; diff --git a/curve25519-dalek/src/ristretto.rs b/curve25519-dalek/src/ristretto.rs index dec7ae067..7362037bb 100644 --- a/curve25519-dalek/src/ristretto.rs +++ b/curve25519-dalek/src/ristretto.rs @@ -1,6 +1,6 @@ // -*- mode: rust; -*- // -// This file is part of curve25519-dalek. +// This file is part of curve25519-dalek_ml. // Copyright (c) 2016-2021 isis lovecruft // Copyright (c) 2016-2020 Henry de Valence // See LICENSE for licensing information. @@ -56,7 +56,7 @@ //! [Why Ristretto?][why_ristretto] section of the Ristretto website. //! //! Ristretto -//! points are provided in `curve25519-dalek` by the `RistrettoPoint` +//! points are provided in `curve25519-dalek_ml` by the `RistrettoPoint` //! struct. //! //! ## Encoding and Decoding @@ -531,7 +531,7 @@ impl RistrettoPoint { /// #[cfg_attr(feature = "rand_core", doc = "```")] #[cfg_attr(not(feature = "rand_core"), doc = "```ignore")] - /// # use curve25519_dalek::ristretto::RistrettoPoint; + /// # use curve25519_dalek_ml::ristretto::RistrettoPoint; /// use rand_core::OsRng; /// /// # // Need fn main() here in comment so the doctest compiles @@ -735,7 +735,7 @@ impl RistrettoPoint { /// #[cfg_attr(feature = "digest", doc = "```")] #[cfg_attr(not(feature = "digest"), doc = "```ignore")] - /// # use curve25519_dalek::ristretto::RistrettoPoint; + /// # use curve25519_dalek_ml::ristretto::RistrettoPoint; /// use sha2::Sha512; /// /// # // Need fn main() here in comment so the doctest compiles @@ -1070,8 +1070,8 @@ impl RistrettoPoint { /// A precomputed table of multiples of the Ristretto basepoint is /// available in the `constants` module: /// ``` -/// use curve25519_dalek::constants::RISTRETTO_BASEPOINT_TABLE; -/// use curve25519_dalek::scalar::Scalar; +/// use curve25519_dalek_ml::constants::RISTRETTO_BASEPOINT_TABLE; +/// use curve25519_dalek_ml::scalar::Scalar; /// /// let a = Scalar::from(87329482u64); /// let P = &a * RISTRETTO_BASEPOINT_TABLE; @@ -1125,9 +1125,9 @@ impl ConditionallySelectable for RistrettoPoint { /// use subtle::ConditionallySelectable; /// use subtle::Choice; /// # - /// # use curve25519_dalek::traits::Identity; - /// # use curve25519_dalek::ristretto::RistrettoPoint; - /// # use curve25519_dalek::constants; + /// # use curve25519_dalek_ml::traits::Identity; + /// # use curve25519_dalek_ml::ristretto::RistrettoPoint; + /// # use curve25519_dalek_ml::constants; /// # fn main() { /// /// let A = RistrettoPoint::identity(); diff --git a/curve25519-dalek/src/scalar.rs b/curve25519-dalek/src/scalar.rs index 5b9eca1da..43e46326c 100644 --- a/curve25519-dalek/src/scalar.rs +++ b/curve25519-dalek/src/scalar.rs @@ -1,6 +1,6 @@ // -*- mode: rust; -*- // -// This file is part of curve25519-dalek. +// This file is part of curve25519-dalek_ml. // Copyright (c) 2016-2021 isis lovecruft // Copyright (c) 2016-2019 Henry de Valence // Portions Copyright 2017 Brian Smith @@ -34,7 +34,7 @@ //! `Some(Scalar)` in return: //! //! ``` -//! use curve25519_dalek::scalar::Scalar; +//! use curve25519_dalek_ml::scalar::Scalar; //! //! let one_as_bytes: [u8; 32] = Scalar::ONE.to_bytes(); //! let a: Option = Scalar::from_canonical_bytes(one_as_bytes).into(); @@ -46,7 +46,7 @@ //! (in this case, \\( \ell + 2 \\)), we'll get `None` back: //! //! ``` -//! use curve25519_dalek::scalar::Scalar; +//! use curve25519_dalek_ml::scalar::Scalar; //! //! let l_plus_two_bytes: [u8; 32] = [ //! 0xef, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, @@ -66,7 +66,7 @@ //! resultant scalar \\( \mod \ell \\), producing \\( 2 \\): //! //! ``` -//! use curve25519_dalek::scalar::Scalar; +//! use curve25519_dalek_ml::scalar::Scalar; //! //! let l_plus_two_bytes: [u8; 32] = [ //! 0xef, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, @@ -92,7 +92,7 @@ #![cfg_attr(not(feature = "digest"), doc = "```ignore")] //! # fn main() { //! use sha2::{Digest, Sha512}; -//! use curve25519_dalek::scalar::Scalar; +//! use curve25519_dalek_ml::scalar::Scalar; //! //! // Hashing a single byte slice //! let a = Scalar::hash_from_bytes::(b"Abolish ICE"); @@ -529,7 +529,7 @@ impl From for Scalar { /// # Example /// /// ``` - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// let fourtytwo = Scalar::from(42u64); /// let six = Scalar::from(6u64); @@ -589,7 +589,7 @@ impl Scalar { /// /// ``` /// # fn main() { - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// use rand_core::OsRng; /// @@ -614,7 +614,7 @@ impl Scalar { /// #[cfg_attr(feature = "digest", doc = "```")] #[cfg_attr(not(feature = "digest"), doc = "```ignore")] - /// # use curve25519_dalek::scalar::Scalar; + /// # use curve25519_dalek_ml::scalar::Scalar; /// use sha2::Sha512; /// /// # // Need fn main() here in comment so the doctest compiles @@ -643,8 +643,8 @@ impl Scalar { /// # Example /// /// ``` - /// # use curve25519_dalek::scalar::Scalar; - /// use curve25519_dalek::digest::Update; + /// use curve25519_dalek_ml::scalar::Scalar; + /// use curve25519_dalek_ml::digest::Update; /// /// use sha2::Digest; /// use sha2::Sha512; @@ -684,7 +684,7 @@ impl Scalar { /// # Example /// /// ``` - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// let s: Scalar = Scalar::ZERO; /// @@ -699,7 +699,7 @@ impl Scalar { /// # Example /// /// ``` - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// let s: Scalar = Scalar::ZERO; /// @@ -724,7 +724,7 @@ impl Scalar { /// # Example /// /// ``` - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// // x = 2238329342913194256032495932344128051776374960164957527413114840482143558222 /// let X: Scalar = Scalar::from_bytes_mod_order([ @@ -768,7 +768,7 @@ impl Scalar { /// # Example /// /// ``` - /// # use curve25519_dalek::scalar::Scalar; + /// # use curve25519_dalek_ml::scalar::Scalar; /// # fn main() { /// let mut scalars = [ /// Scalar::from(3u64), diff --git a/curve25519-dalek/src/traits.rs b/curve25519-dalek/src/traits.rs index 870dd32f8..fe82873ee 100644 --- a/curve25519-dalek/src/traits.rs +++ b/curve25519-dalek/src/traits.rs @@ -1,6 +1,6 @@ // -*- mode: rust; -*- // -// This file is part of curve25519-dalek. +// This file is part of curve25519-dalek_ml. // Copyright (c) 2016-2021 isis lovecruft // Copyright (c) 2016-2019 Henry de Valence // See LICENSE for licensing information. @@ -98,10 +98,10 @@ pub trait MultiscalarMul { /// ``` /// # #[cfg(feature = "alloc")] /// # { - /// use curve25519_dalek::constants; - /// use curve25519_dalek::traits::MultiscalarMul; - /// use curve25519_dalek::ristretto::RistrettoPoint; - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::constants; + /// use curve25519_dalek_ml::traits::MultiscalarMul; + /// use curve25519_dalek_ml::ristretto::RistrettoPoint; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// // Some scalars /// let a = Scalar::from(87329482u64); @@ -153,10 +153,10 @@ pub trait VartimeMultiscalarMul { /// ``` /// #[cfg(feature = "alloc")] /// # { - /// use curve25519_dalek::constants; - /// use curve25519_dalek::traits::VartimeMultiscalarMul; - /// use curve25519_dalek::ristretto::RistrettoPoint; - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::constants; + /// use curve25519_dalek_ml::traits::VartimeMultiscalarMul; + /// use curve25519_dalek_ml::ristretto::RistrettoPoint; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// // Some scalars /// let a = Scalar::from(87329482u64); @@ -219,10 +219,10 @@ pub trait VartimeMultiscalarMul { /// ``` /// #[cfg(feature = "alloc")] /// # { - /// use curve25519_dalek::constants; - /// use curve25519_dalek::traits::VartimeMultiscalarMul; - /// use curve25519_dalek::ristretto::RistrettoPoint; - /// use curve25519_dalek::scalar::Scalar; + /// use curve25519_dalek_ml::constants; + /// use curve25519_dalek_ml::traits::VartimeMultiscalarMul; + /// use curve25519_dalek_ml::ristretto::RistrettoPoint; + /// use curve25519_dalek_ml::scalar::Scalar; /// /// // Some scalars /// let a = Scalar::from(87329482u64); @@ -407,7 +407,7 @@ pub trait VartimePrecomputedMultiscalarMul: Sized { /// Trait for checking whether a point is on the curve. /// /// This trait is only for debugging/testing, since it should be -/// impossible for a `curve25519-dalek` user to construct an invalid +/// impossible for a `curve25519-dalek_ml` user to construct an invalid /// point. #[allow(dead_code)] pub(crate) trait ValidityCheck {