Skip to content

Commit

Permalink
Merge branch 'release/2.0' into hash_trait
Browse files Browse the repository at this point in the history
  • Loading branch information
rozbb committed Jan 16, 2023
2 parents d55cc35 + 8c455f5 commit 9007157
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- run: cargo test --target ${{ matrix.target }} --no-default-features --features alloc --lib
- run: cargo test --target ${{ matrix.target }}
- run: cargo test --target ${{ matrix.target }} --features batch
- run: cargo test --target ${{ matrix.target }} --features rand_core
- run: cargo test --target ${{ matrix.target }} --features serde
- run: cargo test --target ${{ matrix.target }} --features pem

Expand Down
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sha2 = { version = "0.10", default-features = false }
zeroize = { version = "1.5", default-features = false, optional = true }

[dev-dependencies]
curve25519-dalek = { version = "=4.0.0-pre.5", default-features = false, features = ["digest", "rand_core"] }
hex = "0.4"
bincode = "1.0"
serde_json = "1.0"
Expand All @@ -43,14 +44,14 @@ rand = "0.8"
rand_core = { version = "0.6.4", default-features = false }
serde = { version = "1.0", features = ["derive"] }
toml = { version = "0.5" }
curve25519-dalek = { version = "=4.0.0-pre.5", default-features = false, features = ["digest", "rand_core"] }

[[bench]]
name = "ed25519_benchmarks"
harness = false
required-features = ["rand_core"]

[features]
default = ["std", "rand_core", "zeroize"]
default = ["std", "zeroize"]
alloc = ["curve25519-dalek/alloc", "ed25519/alloc", "serde?/alloc", "zeroize/alloc"]
std = ["alloc", "ed25519/std", "serde?/std", "sha2/std"]

Expand All @@ -60,6 +61,7 @@ batch = ["alloc", "merlin", "rand_core"]
legacy_compatibility = []
pkcs8 = ["ed25519/pkcs8"]
pem = ["alloc", "ed25519/pem", "pkcs8"]
rand_core = ["dep:rand_core"]
serde = ["dep:serde", "serde_bytes", "ed25519/serde"]
zeroize = ["dep:zeroize", "curve25519-dalek/zeroize"]

Expand Down
7 changes: 4 additions & 3 deletions src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#[cfg(feature = "pkcs8")]
use ed25519::pkcs8::{self, DecodePrivateKey};

#[cfg(feature = "rand_core")]
#[cfg(any(test, feature = "rand_core"))]
use rand_core::CryptoRngCore;

#[cfg(feature = "serde")]
Expand Down Expand Up @@ -183,7 +183,7 @@ impl SigningKey {
/// The standard hash function used for most ed25519 libraries is SHA-512,
/// which is available with `use sha2::Sha512` as in the example above.
/// Other suitable hash functions include Keccak-512 and Blake2b-512.
#[cfg(feature = "rand_core")]
#[cfg(any(test, feature = "rand_core"))]
pub fn generate<R: CryptoRngCore + ?Sized>(csprng: &mut R) -> SigningKey {
let mut secret = SecretKey::default();
csprng.fill_bytes(&mut secret);
Expand All @@ -208,7 +208,8 @@ impl SigningKey {
///
/// # Examples
///
/// ```
#[cfg_attr(feature = "rand_core", doc = "```")]
#[cfg_attr(not(feature = "rand_core"), doc = "```ignore")]
/// use ed25519_dalek::Digest;
/// use ed25519_dalek::SigningKey;
/// use ed25519_dalek::Sha512;
Expand Down
4 changes: 1 addition & 3 deletions tests/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ use ed25519_dalek::*;
use hex::FromHex;
use hex_literal::hex;

#[cfg(feature = "rand_core")]
use sha2::Sha512;

#[cfg(test)]
mod vectors {
use super::*;
Expand Down Expand Up @@ -286,6 +283,7 @@ mod integrations {
use super::*;
use rand::rngs::OsRng;
use std::collections::HashMap;
use sha2::Sha512;

#[test]
fn sign_verify() {
Expand Down

0 comments on commit 9007157

Please sign in to comment.