Skip to content

Commit

Permalink
merge in changes from dalek
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Lodder <[email protected]>
  • Loading branch information
mikelodder7 committed Feb 17, 2024
1 parent a808bc6 commit 710adeb
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 44 deletions.
5 changes: 2 additions & 3 deletions curve25519-dalek/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>",
"Henry de Valence <[email protected]>",
"Michael Lodder <[email protected]>"]
Expand Down Expand Up @@ -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 }
Expand Down
8 changes: 4 additions & 4 deletions curve25519-dalek/src/edwards.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions curve25519-dalek/src/ristretto.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
28 changes: 14 additions & 14 deletions curve25519-dalek/src/scalar.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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> = Scalar::from_canonical_bytes(one_as_bytes).into();
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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::<Sha512>(b"Abolish ICE");
Expand Down Expand Up @@ -529,7 +529,7 @@ impl From<u64> for Scalar {
/// # Example
///
/// ```
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ml::scalar::Scalar;
///
/// let fourtytwo = Scalar::from(42u64);
/// let six = Scalar::from(6u64);
Expand Down Expand Up @@ -589,7 +589,7 @@ impl Scalar {
///
/// ```
/// # fn main() {
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ml::scalar::Scalar;
///
/// use rand_core::OsRng;
///
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -684,7 +684,7 @@ impl Scalar {
/// # Example
///
/// ```
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ml::scalar::Scalar;
///
/// let s: Scalar = Scalar::ZERO;
///
Expand All @@ -699,7 +699,7 @@ impl Scalar {
/// # Example
///
/// ```
/// use curve25519_dalek::scalar::Scalar;
/// use curve25519_dalek_ml::scalar::Scalar;
///
/// let s: Scalar = Scalar::ZERO;
///
Expand All @@ -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([
Expand Down Expand Up @@ -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),
Expand Down
28 changes: 14 additions & 14 deletions curve25519-dalek/src/traits.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 710adeb

Please sign in to comment.