mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-12 21:40:33 +00:00
Bump edition to 2024 and crate versions to prereleases (#775)
This represents the first breaking change in a new release series, bumping all crates to the 2024 edition of Rust. As such, the version numbers of all crates have been incremented to represent a new prerelease series: - `curve25519-dalek`: v5.0.0-pre - `ed25519-dalek`: v3.0.0-pre - `x25519-dalek`: v3.0.0-pre Note that this commit isn't intended to cut associated crate releases of these on crates.io, but is merely bumping the version numbers to denote there are pending breaking changes. This commit also includes rustfmt changes which were made as part of the 2024 edition. Also includes clippy fixes.
This commit is contained in:
parent
37d3ae99d3
commit
53df025bb3
29 changed files with 84 additions and 73 deletions
4
.github/workflows/curve25519-dalek.yml
vendored
4
.github/workflows/curve25519-dalek.yml
vendored
|
|
@ -130,7 +130,7 @@ jobs:
|
||||||
run: cargo test --no-default-features --features alloc,precomputed-tables,zeroize,group-bits --target x86_64-unknown-linux-gnu
|
run: cargo test --no-default-features --features alloc,precomputed-tables,zeroize,group-bits --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
msrv:
|
msrv:
|
||||||
name: Current MSRV is 1.60.0
|
name: Current MSRV is 1.85.0
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
@ -139,7 +139,7 @@ jobs:
|
||||||
- run: cargo update -Z minimal-versions
|
- run: cargo update -Z minimal-versions
|
||||||
# Now check that `cargo build` works with respect to the oldest possible
|
# Now check that `cargo build` works with respect to the oldest possible
|
||||||
# deps and the stated MSRV
|
# deps and the stated MSRV
|
||||||
- uses: dtolnay/rust-toolchain@1.60.0
|
- uses: dtolnay/rust-toolchain@1.85.0
|
||||||
- run: cargo build --no-default-features --features serde
|
- run: cargo build --no-default-features --features serde
|
||||||
# Also make sure the AVX2 build works
|
# Also make sure the AVX2 build works
|
||||||
- run: cargo build --target x86_64-unknown-linux-gnu
|
- run: cargo build --target x86_64-unknown-linux-gnu
|
||||||
|
|
|
||||||
4
.github/workflows/ed25519-dalek.yml
vendored
4
.github/workflows/ed25519-dalek.yml
vendored
|
|
@ -20,7 +20,7 @@ env:
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
msrv:
|
msrv:
|
||||||
name: Current MSRV is 1.81.0
|
name: Current MSRV is 1.85.0
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
@ -29,5 +29,5 @@ jobs:
|
||||||
- run: cargo update -Z minimal-versions
|
- run: cargo update -Z minimal-versions
|
||||||
# Now check that `cargo build` works with respect to the oldest possible
|
# Now check that `cargo build` works with respect to the oldest possible
|
||||||
# deps and the stated MSRV
|
# deps and the stated MSRV
|
||||||
- uses: dtolnay/rust-toolchain@1.81.0
|
- uses: dtolnay/rust-toolchain@1.85.0
|
||||||
- run: cargo build
|
- run: cargo build
|
||||||
|
|
|
||||||
4
.github/workflows/x25519-dalek.yml
vendored
4
.github/workflows/x25519-dalek.yml
vendored
|
|
@ -20,7 +20,7 @@ env:
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
msrv:
|
msrv:
|
||||||
name: Current MSRV is 1.60.0
|
name: Current MSRV is 1.85.0
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
@ -29,5 +29,5 @@ jobs:
|
||||||
- run: cargo update -Z minimal-versions
|
- run: cargo update -Z minimal-versions
|
||||||
# Now check that `cargo build` works with respect to the oldest possible
|
# Now check that `cargo build` works with respect to the oldest possible
|
||||||
# deps and the stated MSRV
|
# deps and the stated MSRV
|
||||||
- uses: dtolnay/rust-toolchain@1.60.0
|
- uses: dtolnay/rust-toolchain@1.85.0
|
||||||
- run: cargo build
|
- run: cargo build
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ name = "curve25519-dalek"
|
||||||
# - update CHANGELOG
|
# - update CHANGELOG
|
||||||
# - update README if required by semver
|
# - update README if required by semver
|
||||||
# - if README was updated, also update module documentation in src/lib.rs
|
# - if README was updated, also update module documentation in src/lib.rs
|
||||||
version = "4.1.3"
|
version = "5.0.0-pre"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
rust-version = "1.60.0"
|
rust-version = "1.85.0"
|
||||||
authors = ["Isis Lovecruft <isis@patternsinthevoid.net>",
|
authors = ["Isis Lovecruft <isis@patternsinthevoid.net>",
|
||||||
"Henry de Valence <hdevalence@hdevalence.ca>"]
|
"Henry de Valence <hdevalence@hdevalence.ca>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use rand::{rngs::OsRng, thread_rng, RngCore};
|
use rand::{RngCore, rngs::OsRng, thread_rng};
|
||||||
|
|
||||||
use criterion::{
|
use criterion::{
|
||||||
criterion_main, measurement::Measurement, BatchSize, BenchmarkGroup, BenchmarkId, Criterion,
|
BatchSize, BenchmarkGroup, BenchmarkId, Criterion, criterion_main, measurement::Measurement,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "digest")]
|
#[cfg(feature = "digest")]
|
||||||
use sha2::Sha512;
|
use sha2::Sha512;
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,9 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok("unstable_avx512") if !nightly => {
|
Ok("unstable_avx512") if !nightly => {
|
||||||
panic!("Could not override curve25519_dalek_backend to unstable_avx512, as this is nightly only");
|
panic!(
|
||||||
|
"Could not override curve25519_dalek_backend to unstable_avx512, as this is nightly only"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// default between serial / simd (if potentially capable)
|
// default between serial / simd (if potentially capable)
|
||||||
_ => match is_capable_simd(&target_arch, curve25519_dalek_bits) {
|
_ => match is_capable_simd(&target_arch, curve25519_dalek_bits) {
|
||||||
|
|
|
||||||
|
|
@ -558,7 +558,10 @@ impl Debug for AffineNielsPoint {
|
||||||
|
|
||||||
impl Debug for ProjectiveNielsPoint {
|
impl Debug for ProjectiveNielsPoint {
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
write!(f, "ProjectiveNielsPoint{{\n\tY_plus_X: {:?},\n\tY_minus_X: {:?},\n\tZ: {:?},\n\tT2d: {:?}\n}}",
|
write!(
|
||||||
&self.Y_plus_X, &self.Y_minus_X, &self.Z, &self.T2d)
|
f,
|
||||||
|
"ProjectiveNielsPoint{{\n\tY_plus_X: {:?},\n\tY_minus_X: {:?},\n\tZ: {:?},\n\tT2d: {:?}\n}}",
|
||||||
|
&self.Y_plus_X, &self.Y_minus_X, &self.Z, &self.T2d
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ use core::ops::{Add, Mul, Neg};
|
||||||
|
|
||||||
use crate::backend::serial::u64::field::FieldElement51;
|
use crate::backend::serial::u64::field::FieldElement51;
|
||||||
use crate::backend::vector::avx2::constants::{
|
use crate::backend::vector::avx2::constants::{
|
||||||
P_TIMES_16_HI, P_TIMES_16_LO, P_TIMES_2_HI, P_TIMES_2_LO,
|
P_TIMES_2_HI, P_TIMES_2_LO, P_TIMES_16_HI, P_TIMES_16_LO,
|
||||||
};
|
};
|
||||||
|
|
||||||
use curve25519_dalek_derive::unsafe_target_feature;
|
use curve25519_dalek_derive::unsafe_target_feature;
|
||||||
|
|
|
||||||
|
|
@ -106,13 +106,13 @@ use core::ops::{Mul, MulAssign};
|
||||||
|
|
||||||
#[cfg(feature = "digest")]
|
#[cfg(feature = "digest")]
|
||||||
use digest::{
|
use digest::{
|
||||||
consts::True, crypto_common::BlockSizeUser, generic_array::typenum::U64, typenum::IsGreater,
|
Digest, FixedOutput, HashMarker, consts::True, crypto_common::BlockSizeUser,
|
||||||
Digest, FixedOutput, HashMarker,
|
generic_array::typenum::U64, typenum::IsGreater,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "group")]
|
#[cfg(feature = "group")]
|
||||||
use {
|
use {
|
||||||
group::{cofactor::CofactorGroup, prime::PrimeGroup, GroupEncoding},
|
group::{GroupEncoding, cofactor::CofactorGroup, prime::PrimeGroup},
|
||||||
subtle::CtOption,
|
subtle::CtOption,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ use zeroize::Zeroize;
|
||||||
use crate::constants;
|
use crate::constants;
|
||||||
|
|
||||||
use crate::field::FieldElement;
|
use crate::field::FieldElement;
|
||||||
use crate::scalar::{clamp_integer, Scalar};
|
use crate::scalar::{Scalar, clamp_integer};
|
||||||
|
|
||||||
use crate::montgomery::MontgomeryPoint;
|
use crate::montgomery::MontgomeryPoint;
|
||||||
|
|
||||||
|
|
@ -141,8 +141,8 @@ use crate::backend::serial::curve_models::ProjectivePoint;
|
||||||
|
|
||||||
#[cfg(feature = "precomputed-tables")]
|
#[cfg(feature = "precomputed-tables")]
|
||||||
use crate::window::{
|
use crate::window::{
|
||||||
LookupTableRadix128, LookupTableRadix16, LookupTableRadix256, LookupTableRadix32,
|
LookupTableRadix16, LookupTableRadix32, LookupTableRadix64, LookupTableRadix128,
|
||||||
LookupTableRadix64,
|
LookupTableRadix256,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "precomputed-tables")]
|
#[cfg(feature = "precomputed-tables")]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use super::{CompressedEdwardsY, EdwardsPoint};
|
use super::{CompressedEdwardsY, EdwardsPoint};
|
||||||
use crate::traits::Identity;
|
use crate::traits::Identity;
|
||||||
use crate::{field::FieldElement, Scalar};
|
use crate::{Scalar, field::FieldElement};
|
||||||
use core::ops::Mul;
|
use core::ops::Mul;
|
||||||
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
|
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ use crate::constants;
|
||||||
|
|
||||||
#[cfg(feature = "digest")]
|
#[cfg(feature = "digest")]
|
||||||
use digest::{
|
use digest::{
|
||||||
core_api::BlockSizeUser,
|
|
||||||
generic_array::{typenum::U64, GenericArray},
|
|
||||||
typenum::{IsGreater, True},
|
|
||||||
Digest, FixedOutput, HashMarker,
|
Digest, FixedOutput, HashMarker,
|
||||||
|
core_api::BlockSizeUser,
|
||||||
|
generic_array::{GenericArray, typenum::U64},
|
||||||
|
typenum::{IsGreater, True},
|
||||||
};
|
};
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ use core::{
|
||||||
use crate::constants::{APLUS2_OVER_FOUR, MONTGOMERY_A, MONTGOMERY_A_NEG};
|
use crate::constants::{APLUS2_OVER_FOUR, MONTGOMERY_A, MONTGOMERY_A_NEG};
|
||||||
use crate::edwards::{CompressedEdwardsY, EdwardsPoint};
|
use crate::edwards::{CompressedEdwardsY, EdwardsPoint};
|
||||||
use crate::field::FieldElement;
|
use crate::field::FieldElement;
|
||||||
use crate::scalar::{clamp_integer, Scalar};
|
use crate::scalar::{Scalar, clamp_integer};
|
||||||
|
|
||||||
use crate::traits::Identity;
|
use crate::traits::Identity;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,17 +172,17 @@ use core::ops::{Mul, MulAssign};
|
||||||
#[cfg(any(test, feature = "rand_core"))]
|
#[cfg(any(test, feature = "rand_core"))]
|
||||||
use rand_core::CryptoRngCore;
|
use rand_core::CryptoRngCore;
|
||||||
|
|
||||||
#[cfg(feature = "digest")]
|
|
||||||
use digest::generic_array::typenum::U64;
|
|
||||||
#[cfg(feature = "digest")]
|
#[cfg(feature = "digest")]
|
||||||
use digest::Digest;
|
use digest::Digest;
|
||||||
|
#[cfg(feature = "digest")]
|
||||||
|
use digest::generic_array::typenum::U64;
|
||||||
|
|
||||||
use crate::constants;
|
use crate::constants;
|
||||||
use crate::field::FieldElement;
|
use crate::field::FieldElement;
|
||||||
|
|
||||||
#[cfg(feature = "group")]
|
#[cfg(feature = "group")]
|
||||||
use {
|
use {
|
||||||
group::{cofactor::CofactorGroup, prime::PrimeGroup, GroupEncoding},
|
group::{GroupEncoding, cofactor::CofactorGroup, prime::PrimeGroup},
|
||||||
rand_core::RngCore,
|
rand_core::RngCore,
|
||||||
subtle::CtOption,
|
subtle::CtOption,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -133,10 +133,10 @@ use rand_core::RngCore;
|
||||||
#[cfg(any(test, feature = "rand_core"))]
|
#[cfg(any(test, feature = "rand_core"))]
|
||||||
use rand_core::CryptoRngCore;
|
use rand_core::CryptoRngCore;
|
||||||
|
|
||||||
#[cfg(feature = "digest")]
|
|
||||||
use digest::generic_array::typenum::U64;
|
|
||||||
#[cfg(feature = "digest")]
|
#[cfg(feature = "digest")]
|
||||||
use digest::Digest;
|
use digest::Digest;
|
||||||
|
#[cfg(feature = "digest")]
|
||||||
|
use digest::generic_array::typenum::U64;
|
||||||
|
|
||||||
use subtle::Choice;
|
use subtle::Choice;
|
||||||
use subtle::ConditionallySelectable;
|
use subtle::ConditionallySelectable;
|
||||||
|
|
@ -1024,9 +1024,9 @@ impl Scalar {
|
||||||
debug_assert!(w <= 8);
|
debug_assert!(w <= 8);
|
||||||
|
|
||||||
let digits_count = match w {
|
let digits_count = match w {
|
||||||
4..=7 => (256 + w - 1) / w,
|
4..=7 => 256_usize.div_ceil(w),
|
||||||
// See comment in to_radix_2w on handling the terminal carry.
|
// See comment in to_radix_2w on handling the terminal carry.
|
||||||
8 => (256 + w - 1) / w + 1_usize,
|
8 => 256_usize.div_ceil(w) + 1_usize,
|
||||||
_ => panic!("invalid radix parameter"),
|
_ => panic!("invalid radix parameter"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1073,7 +1073,7 @@ impl Scalar {
|
||||||
|
|
||||||
let mut carry = 0u64;
|
let mut carry = 0u64;
|
||||||
let mut digits = [0i8; 64];
|
let mut digits = [0i8; 64];
|
||||||
let digits_count = (256 + w - 1) / w;
|
let digits_count = 256_usize.div_ceil(w);
|
||||||
#[allow(clippy::needless_range_loop)]
|
#[allow(clippy::needless_range_loop)]
|
||||||
for i in 0..digits_count {
|
for i in 0..digits_count {
|
||||||
// Construct a buffer of bits of the scalar, starting at `bit_offset`.
|
// Construct a buffer of bits of the scalar, starting at `bit_offset`.
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
use core::borrow::Borrow;
|
use core::borrow::Borrow;
|
||||||
|
|
||||||
use crate::scalar::{clamp_integer, Scalar};
|
use crate::scalar::{Scalar, clamp_integer};
|
||||||
use subtle::ConstantTimeEq;
|
use subtle::ConstantTimeEq;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ed25519-dalek"
|
name = "ed25519-dalek"
|
||||||
version = "2.1.1"
|
version = "3.0.0-pre"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
authors = [
|
authors = [
|
||||||
"isis lovecruft <isis@patternsinthevoid.net>",
|
"isis lovecruft <isis@patternsinthevoid.net>",
|
||||||
"Tony Arcieri <bascule@gmail.com>",
|
"Tony Arcieri <bascule@gmail.com>",
|
||||||
|
|
@ -16,7 +16,7 @@ keywords = ["cryptography", "ed25519", "curve25519", "signature", "ECC"]
|
||||||
categories = ["cryptography", "no-std"]
|
categories = ["cryptography", "no-std"]
|
||||||
description = "Fast and efficient ed25519 EdDSA key generations, signing, and verification in pure Rust."
|
description = "Fast and efficient ed25519 EdDSA key generations, signing, and verification in pure Rust."
|
||||||
exclude = [ ".gitignore", "TESTVECTORS", "VALIDATIONVECTORS", "res/*" ]
|
exclude = [ ".gitignore", "TESTVECTORS", "VALIDATIONVECTORS", "res/*" ]
|
||||||
rust-version = "1.81"
|
rust-version = "1.85"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustdoc-args = [
|
rustdoc-args = [
|
||||||
|
|
@ -26,7 +26,7 @@ rustdoc-args = [
|
||||||
features = ["batch", "digest", "hazmat", "pem", "serde"]
|
features = ["batch", "digest", "hazmat", "pem", "serde"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
curve25519-dalek = { version = "4", path = "../curve25519-dalek", default-features = false, features = ["digest"] }
|
curve25519-dalek = { version = "=5.0.0-pre", path = "../curve25519-dalek", default-features = false, features = ["digest"] }
|
||||||
ed25519 = { version = ">=2.2, <2.3", default-features = false }
|
ed25519 = { version = ">=2.2, <2.3", default-features = false }
|
||||||
signature = { version = ">=2.0, <2.3", optional = true, default-features = false }
|
signature = { version = ">=2.0, <2.3", optional = true, default-features = false }
|
||||||
sha2 = { version = "0.10", default-features = false }
|
sha2 = { version = "0.10", default-features = false }
|
||||||
|
|
@ -39,8 +39,8 @@ serde = { version = "1.0", default-features = false, optional = true }
|
||||||
zeroize = { version = "1.5", default-features = false, optional = true }
|
zeroize = { version = "1.5", default-features = false, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
curve25519-dalek = { version = "4", path = "../curve25519-dalek", default-features = false, features = ["digest", "rand_core"] }
|
curve25519-dalek = { version = "=5.0.0-pre", path = "../curve25519-dalek", default-features = false, features = ["digest", "rand_core"] }
|
||||||
x25519-dalek = { version = "2", path = "../x25519-dalek", default-features = false, features = ["static_secrets"] }
|
x25519-dalek = { version = "=3.0.0-pre", path = "../x25519-dalek", default-features = false, features = ["static_secrets"] }
|
||||||
blake2 = "0.10"
|
blake2 = "0.10"
|
||||||
sha3 = "0.10"
|
sha3 = "0.10"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
// Authors:
|
// Authors:
|
||||||
// - isis agora lovecruft <isis@patternsinthevoid.net>
|
// - isis agora lovecruft <isis@patternsinthevoid.net>
|
||||||
|
|
||||||
use criterion::{criterion_group, Criterion};
|
use criterion::{Criterion, criterion_group};
|
||||||
|
|
||||||
mod ed25519_benches {
|
mod ed25519_benches {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ use rand_core::RngCore;
|
||||||
|
|
||||||
use sha2::Sha512;
|
use sha2::Sha512;
|
||||||
|
|
||||||
|
use crate::VerifyingKey;
|
||||||
use crate::errors::InternalError;
|
use crate::errors::InternalError;
|
||||||
use crate::errors::SignatureError;
|
use crate::errors::SignatureError;
|
||||||
use crate::signature::InternalSignature;
|
use crate::signature::InternalSignature;
|
||||||
use crate::VerifyingKey;
|
|
||||||
|
|
||||||
/// Domain separation label to initialize the STROBE context.
|
/// Domain separation label to initialize the STROBE context.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use super::strobe::Strobe128;
|
|
||||||
use super::MERLIN_PROTOCOL_LABEL;
|
use super::MERLIN_PROTOCOL_LABEL;
|
||||||
|
use super::strobe::Strobe128;
|
||||||
|
|
||||||
fn encode_usize_as_u32(x: usize) -> [u8; 4] {
|
fn encode_usize_as_u32(x: usize) -> [u8; 4] {
|
||||||
u32::try_from(x).expect("usize too large").to_le_bytes()
|
u32::try_from(x).expect("usize too large").to_le_bytes()
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ use core::fmt::Debug;
|
||||||
|
|
||||||
use crate::{InternalError, SignatureError};
|
use crate::{InternalError, SignatureError};
|
||||||
|
|
||||||
use curve25519_dalek::scalar::{clamp_integer, Scalar};
|
use curve25519_dalek::scalar::{Scalar, clamp_integer};
|
||||||
|
|
||||||
use subtle::{Choice, ConstantTimeEq};
|
use subtle::{Choice, ConstantTimeEq};
|
||||||
#[cfg(feature = "zeroize")]
|
#[cfg(feature = "zeroize")]
|
||||||
|
|
@ -25,7 +25,7 @@ use zeroize::{Zeroize, ZeroizeOnDrop};
|
||||||
|
|
||||||
// These are used in the functions that are made public when the hazmat feature is set
|
// These are used in the functions that are made public when the hazmat feature is set
|
||||||
use crate::{Signature, VerifyingKey};
|
use crate::{Signature, VerifyingKey};
|
||||||
use curve25519_dalek::digest::{generic_array::typenum::U64, Digest};
|
use curve25519_dalek::digest::{Digest, generic_array::typenum::U64};
|
||||||
|
|
||||||
/// Contains the secret scalar and domain separator used for generating signatures.
|
/// Contains the secret scalar and domain separator used for generating signatures.
|
||||||
///
|
///
|
||||||
|
|
@ -258,7 +258,7 @@ mod test {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use rand::{rngs::OsRng, CryptoRng, RngCore};
|
use rand::{CryptoRng, RngCore, rngs::OsRng};
|
||||||
|
|
||||||
// Pick distinct, non-spec 512-bit hash functions for message and sig-context hashing
|
// Pick distinct, non-spec 512-bit hash functions for message and sig-context hashing
|
||||||
type CtxDigest = blake2::Blake2b512;
|
type CtxDigest = blake2::Blake2b512;
|
||||||
|
|
|
||||||
|
|
@ -285,10 +285,10 @@ pub use crate::signing::*;
|
||||||
pub use crate::verifying::*;
|
pub use crate::verifying::*;
|
||||||
|
|
||||||
// Re-export the `Signer` and `Verifier` traits from the `signature` crate
|
// Re-export the `Signer` and `Verifier` traits from the `signature` crate
|
||||||
|
pub use ed25519::Signature;
|
||||||
#[cfg(feature = "digest")]
|
#[cfg(feature = "digest")]
|
||||||
pub use ed25519::signature::{DigestSigner, DigestVerifier};
|
pub use ed25519::signature::{DigestSigner, DigestVerifier};
|
||||||
pub use ed25519::signature::{Signer, Verifier};
|
pub use ed25519::signature::{Signer, Verifier};
|
||||||
pub use ed25519::Signature;
|
|
||||||
|
|
||||||
#[cfg(feature = "pkcs8")]
|
#[cfg(feature = "pkcs8")]
|
||||||
pub use ed25519::pkcs8;
|
pub use ed25519::pkcs8;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use sha2::Sha512;
|
||||||
use subtle::{Choice, ConstantTimeEq};
|
use subtle::{Choice, ConstantTimeEq};
|
||||||
|
|
||||||
use curve25519_dalek::{
|
use curve25519_dalek::{
|
||||||
digest::{generic_array::typenum::U64, Digest},
|
digest::{Digest, generic_array::typenum::U64},
|
||||||
edwards::{CompressedEdwardsY, EdwardsPoint},
|
edwards::{CompressedEdwardsY, EdwardsPoint},
|
||||||
scalar::Scalar,
|
scalar::Scalar,
|
||||||
};
|
};
|
||||||
|
|
@ -42,12 +42,12 @@ use zeroize::{Zeroize, ZeroizeOnDrop};
|
||||||
#[cfg(feature = "hazmat")]
|
#[cfg(feature = "hazmat")]
|
||||||
use crate::verifying::StreamVerifier;
|
use crate::verifying::StreamVerifier;
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Signature,
|
||||||
constants::{KEYPAIR_LENGTH, SECRET_KEY_LENGTH},
|
constants::{KEYPAIR_LENGTH, SECRET_KEY_LENGTH},
|
||||||
errors::{InternalError, SignatureError},
|
errors::{InternalError, SignatureError},
|
||||||
hazmat::ExpandedSecretKey,
|
hazmat::ExpandedSecretKey,
|
||||||
signature::InternalSignature,
|
signature::InternalSignature,
|
||||||
verifying::VerifyingKey,
|
verifying::VerifyingKey,
|
||||||
Signature,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// ed25519 secret key as defined in [RFC8032 § 5.1.5]:
|
/// ed25519 secret key as defined in [RFC8032 § 5.1.5]:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use core::fmt::Debug;
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
|
|
||||||
use curve25519_dalek::{
|
use curve25519_dalek::{
|
||||||
digest::{generic_array::typenum::U64, Digest},
|
digest::{Digest, generic_array::typenum::U64},
|
||||||
edwards::{CompressedEdwardsY, EdwardsPoint},
|
edwards::{CompressedEdwardsY, EdwardsPoint},
|
||||||
montgomery::MontgomeryPoint,
|
montgomery::MontgomeryPoint,
|
||||||
scalar::Scalar,
|
scalar::Scalar,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use curve25519_dalek::edwards::CompressedEdwardsY;
|
||||||
use sha2::Sha512;
|
use sha2::Sha512;
|
||||||
|
|
||||||
use crate::verifying::RCompute;
|
use crate::verifying::RCompute;
|
||||||
use crate::{signature::InternalSignature, InternalError, SignatureError, VerifyingKey};
|
use crate::{InternalError, SignatureError, VerifyingKey, signature::InternalSignature};
|
||||||
|
|
||||||
/// An IUF verifier for ed25519.
|
/// An IUF verifier for ed25519.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ mod vectors {
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "digest"))]
|
#[cfg(not(feature = "digest"))]
|
||||||
use sha2::{digest::Digest, Sha512};
|
use sha2::{Sha512, digest::Digest};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
fs::File,
|
||||||
|
|
@ -104,7 +104,9 @@ mod vectors {
|
||||||
let sec_bytes = hex!("833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42");
|
let sec_bytes = hex!("833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42");
|
||||||
let pub_bytes = hex!("ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf");
|
let pub_bytes = hex!("ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf");
|
||||||
let msg_bytes = hex!("616263");
|
let msg_bytes = hex!("616263");
|
||||||
let sig_bytes = hex!("98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406");
|
let sig_bytes = hex!(
|
||||||
|
"98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406"
|
||||||
|
);
|
||||||
|
|
||||||
let signing_key = SigningKey::from_bytes(&sec_bytes);
|
let signing_key = SigningKey::from_bytes(&sec_bytes);
|
||||||
let expected_verifying_key = VerifyingKey::from_bytes(&pub_bytes).unwrap();
|
let expected_verifying_key = VerifyingKey::from_bytes(&pub_bytes).unwrap();
|
||||||
|
|
@ -268,20 +270,24 @@ mod vectors {
|
||||||
let signature = serialize_signature(&r, &s);
|
let signature = serialize_signature(&r, &s);
|
||||||
let vk = VerifyingKey::from_bytes(pubkey.compress().as_bytes()).unwrap();
|
let vk = VerifyingKey::from_bytes(pubkey.compress().as_bytes()).unwrap();
|
||||||
let sig = Signature::try_from(&signature[..]).unwrap();
|
let sig = Signature::try_from(&signature[..]).unwrap();
|
||||||
assert!(vk
|
assert!(
|
||||||
.verify_prehashed(message1.clone(), context_str, &sig)
|
vk.verify_prehashed(message1.clone(), context_str, &sig)
|
||||||
.is_ok());
|
.is_ok()
|
||||||
assert!(vk
|
);
|
||||||
.verify_prehashed(message2.clone(), context_str, &sig)
|
assert!(
|
||||||
.is_ok());
|
vk.verify_prehashed(message2.clone(), context_str, &sig)
|
||||||
|
.is_ok()
|
||||||
|
);
|
||||||
|
|
||||||
// Check that verify_prehashed_strict fails on both sigs
|
// Check that verify_prehashed_strict fails on both sigs
|
||||||
assert!(vk
|
assert!(
|
||||||
.verify_prehashed_strict(message1.clone(), context_str, &sig)
|
vk.verify_prehashed_strict(message1.clone(), context_str, &sig)
|
||||||
.is_err());
|
.is_err()
|
||||||
assert!(vk
|
);
|
||||||
.verify_prehashed_strict(message2.clone(), context_str, &sig)
|
assert!(
|
||||||
.is_err());
|
vk.verify_prehashed_strict(message2.clone(), context_str, &sig)
|
||||||
|
.is_err()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use ed25519::signature::Verifier;
|
use ed25519::signature::Verifier;
|
||||||
use ed25519_dalek::{Signature, VerifyingKey};
|
use ed25519_dalek::{Signature, VerifyingKey};
|
||||||
|
|
||||||
use serde::{de::Error as SError, Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer, de::Error as SError};
|
||||||
use std::{collections::BTreeSet as Set, fs::File};
|
use std::{collections::BTreeSet as Set, fs::File};
|
||||||
|
|
||||||
/// The set of edge cases that [`VerifyingKey::verify()`] permits.
|
/// The set of edge cases that [`VerifyingKey::verify()`] permits.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! Tests for converting Ed25519 keys into X25519 (Montgomery form) keys.
|
//! Tests for converting Ed25519 keys into X25519 (Montgomery form) keys.
|
||||||
|
|
||||||
use curve25519_dalek::scalar::{clamp_integer, Scalar};
|
use curve25519_dalek::scalar::{Scalar, clamp_integer};
|
||||||
use ed25519_dalek::SigningKey;
|
use ed25519_dalek::SigningKey;
|
||||||
use hex_literal::hex;
|
use hex_literal::hex;
|
||||||
use sha2::{Digest, Sha512};
|
use sha2::{Digest, Sha512};
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
name = "x25519-dalek"
|
name = "x25519-dalek"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
# Before changing this:
|
# Before changing this:
|
||||||
# - update version in README.md
|
# - update version in README.md
|
||||||
# - update html_root_url
|
# - update html_root_url
|
||||||
# - update CHANGELOG
|
# - update CHANGELOG
|
||||||
# - if any changes were made to README.md, mirror them in src/lib.rs docs
|
# - if any changes were made to README.md, mirror them in src/lib.rs docs
|
||||||
version = "2.0.1"
|
version = "3.0.0-pre"
|
||||||
authors = [
|
authors = [
|
||||||
"Isis Lovecruft <isis@patternsinthevoid.net>",
|
"Isis Lovecruft <isis@patternsinthevoid.net>",
|
||||||
"DebugSteven <debugsteven@gmail.com>",
|
"DebugSteven <debugsteven@gmail.com>",
|
||||||
|
|
@ -25,7 +25,7 @@ exclude = [
|
||||||
".travis.yml",
|
".travis.yml",
|
||||||
"CONTRIBUTING.md",
|
"CONTRIBUTING.md",
|
||||||
]
|
]
|
||||||
rust-version = "1.60"
|
rust-version = "1.85"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
travis-ci = { repository = "dalek-cryptography/x25519-dalek", branch = "master"}
|
travis-ci = { repository = "dalek-cryptography/x25519-dalek", branch = "master"}
|
||||||
|
|
@ -38,7 +38,7 @@ rustdoc-args = [
|
||||||
features = ["getrandom", "reusable_secrets", "serde", "static_secrets"]
|
features = ["getrandom", "reusable_secrets", "serde", "static_secrets"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
curve25519-dalek = { version = "4", path = "../curve25519-dalek", default-features = false }
|
curve25519-dalek = { version = "=5.0.0-pre", path = "../curve25519-dalek", default-features = false }
|
||||||
rand_core = { version = "0.6", default-features = false }
|
rand_core = { version = "0.6", default-features = false }
|
||||||
serde = { version = "1", default-features = false, optional = true, features = ["derive"] }
|
serde = { version = "1", default-features = false, optional = true, features = ["derive"] }
|
||||||
zeroize = { version = "1", default-features = false, optional = true }
|
zeroize = { version = "1", default-features = false, optional = true }
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
//! Benchmark the Diffie-Hellman operation.
|
//! Benchmark the Diffie-Hellman operation.
|
||||||
|
|
||||||
use criterion::{criterion_group, criterion_main, Criterion};
|
use criterion::{Criterion, criterion_group, criterion_main};
|
||||||
|
|
||||||
use rand_core::OsRng;
|
use rand_core::OsRng;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue