Use namespaced/weak features; MSRV 1.60 (#235)
This enables activating the `alloc` and `std` features without unnecessarily pulling in optional dependencies like `rand` and `serde`. It also fixes tests for `--no-default-features` (w\ `--lib` only)
This commit is contained in:
parent
951d489d51
commit
f6a242a5b0
7
.github/workflows/rust.yml
vendored
7
.github/workflows/rust.yml
vendored
@ -26,7 +26,8 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- run: rustup target add ${{ matrix.target }}
|
- run: rustup target add ${{ matrix.target }}
|
||||||
- run: ${{ matrix.deps }}
|
- run: ${{ matrix.deps }}
|
||||||
- run: cargo test --target ${{ matrix.target }} --no-default-features --features alloc
|
- run: cargo test --target ${{ matrix.target }} --no-default-features --lib
|
||||||
|
- run: cargo test --target ${{ matrix.target }} --no-default-features --features alloc --lib
|
||||||
- run: cargo test --target ${{ matrix.target }}
|
- run: cargo test --target ${{ matrix.target }}
|
||||||
- run: cargo test --target ${{ matrix.target }} --features batch
|
- run: cargo test --target ${{ matrix.target }} --features batch
|
||||||
- run: cargo test --target ${{ matrix.target }} --features batch_deterministic
|
- run: cargo test --target ${{ matrix.target }} --features batch_deterministic
|
||||||
@ -47,7 +48,7 @@ jobs:
|
|||||||
run: cargo build --target x86_64-unknown-linux-gnu
|
run: cargo build --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
msrv:
|
msrv:
|
||||||
name: Current MSRV is 1.57.0
|
name: Current MSRV is 1.60.0
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@ -57,7 +58,7 @@ jobs:
|
|||||||
- run: cargo -Z minimal-versions check --no-default-features --features serde
|
- run: cargo -Z minimal-versions check --no-default-features --features serde
|
||||||
# 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.57.0
|
- uses: dtolnay/rust-toolchain@1.60.0
|
||||||
- run: cargo build
|
- run: cargo build
|
||||||
|
|
||||||
bench:
|
bench:
|
||||||
|
@ -7,5 +7,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
* Bumped MSRV from 1.41 to 1.56.1
|
* Bumped MSRV from 1.41 to 1.60.0
|
||||||
* Removed `ExpandedSecretKey` API ((#205)[https://github.com/dalek-cryptography/ed25519-dalek/pull/205])
|
* Removed `ExpandedSecretKey` API ((#205)[https://github.com/dalek-cryptography/ed25519-dalek/pull/205])
|
||||||
|
20
Cargo.toml
20
Cargo.toml
@ -12,7 +12,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", "res/*" ]
|
exclude = [ ".gitignore", "TESTVECTORS", "res/*" ]
|
||||||
rust-version = "1.57"
|
rust-version = "1.60"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
travis-ci = { repository = "dalek-cryptography/ed25519-dalek", branch = "master"}
|
travis-ci = { repository = "dalek-cryptography/ed25519-dalek", branch = "master"}
|
||||||
@ -29,19 +29,19 @@ ed25519 = { version = "=2.0.0-pre.1", default-features = false }
|
|||||||
merlin = { version = "3", default-features = false, optional = true }
|
merlin = { version = "3", default-features = false, optional = true }
|
||||||
rand = { version = "0.8", default-features = false, optional = true }
|
rand = { version = "0.8", default-features = false, optional = true }
|
||||||
rand_core = { version = "0.6", default-features = false, optional = true }
|
rand_core = { version = "0.6", default-features = false, optional = true }
|
||||||
serde_crate = { package = "serde", version = "1.0", default-features = false, optional = true }
|
serde = { version = "1.0", default-features = false, optional = true }
|
||||||
serde_bytes = { version = "0.11", optional = true }
|
serde_bytes = { version = "0.11", optional = true }
|
||||||
sha2 = { version = "0.10", default-features = false }
|
sha2 = { version = "0.10", default-features = false }
|
||||||
zeroize = { version = "1.5", default-features = false }
|
zeroize = { version = "1.5", default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hex = "^0.4"
|
hex = "0.4"
|
||||||
bincode = "1.0"
|
bincode = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
criterion = "0.3"
|
criterion = "0.3"
|
||||||
hex-literal = "0.3"
|
hex-literal = "0.3"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
serde_crate = { package = "serde", version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
toml = { version = "0.5" }
|
toml = { version = "0.5" }
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
@ -51,14 +51,16 @@ required-features = ["batch"]
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "rand"]
|
default = ["std", "rand"]
|
||||||
std = ["alloc", "ed25519/std", "serde_crate/std", "sha2/std", "rand/std"]
|
alloc = ["curve25519-dalek/alloc", "ed25519/alloc", "rand?/alloc", "serde?/alloc", "zeroize/alloc"]
|
||||||
alloc = ["curve25519-dalek/alloc", "ed25519/alloc", "rand/alloc", "zeroize/alloc"]
|
std = ["alloc", "ed25519/std", "rand?/std", "serde?/std", "sha2/std"]
|
||||||
serde = ["serde_crate", "serde_bytes", "ed25519/serde"]
|
|
||||||
|
asm = ["sha2/asm"]
|
||||||
batch = ["alloc", "merlin", "rand/std"]
|
batch = ["alloc", "merlin", "rand/std"]
|
||||||
# This feature enables deterministic batch verification.
|
# This feature enables deterministic batch verification.
|
||||||
batch_deterministic = ["alloc", "merlin", "rand", "rand_core"]
|
batch_deterministic = ["alloc", "merlin", "rand"]
|
||||||
asm = ["sha2/asm"]
|
|
||||||
# This features turns off stricter checking for scalar malleability in signatures
|
# This features turns off stricter checking for scalar malleability in signatures
|
||||||
legacy_compatibility = []
|
legacy_compatibility = []
|
||||||
pkcs8 = ["ed25519/pkcs8"]
|
pkcs8 = ["ed25519/pkcs8"]
|
||||||
pem = ["alloc", "ed25519/pem", "pkcs8"]
|
pem = ["alloc", "ed25519/pem", "pkcs8"]
|
||||||
|
rand = ["dep:rand", "dep:rand_core"]
|
||||||
|
serde = ["dep:serde", "serde_bytes", "ed25519/serde"]
|
||||||
|
@ -18,7 +18,7 @@ version = "1"
|
|||||||
|
|
||||||
# Minimum Supported Rust Version
|
# Minimum Supported Rust Version
|
||||||
|
|
||||||
This crate requires Rust 1.57.0 at a minimum. 1.x releases of this crate supported an MSRV of 1.41.
|
This crate requires Rust 1.60.0 at a minimum. Older 1.x releases of this crate supported an MSRV of 1.41.
|
||||||
|
|
||||||
In the future, MSRV changes will be accompanied by a minor version bump.
|
In the future, MSRV changes will be accompanied by a minor version bump.
|
||||||
|
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
//! Batch signature verification.
|
//! Batch signature verification.
|
||||||
|
|
||||||
|
#[cfg(all(feature = "batch", feature = "batch_deterministic"))]
|
||||||
|
compile_error!("`batch` and `batch_deterministic` features are mutually exclusive");
|
||||||
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
|
@ -254,9 +254,6 @@ extern crate alloc;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate std;
|
extern crate std;
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
extern crate serde_crate as serde;
|
|
||||||
|
|
||||||
pub use ed25519;
|
pub use ed25519;
|
||||||
|
|
||||||
#[cfg(any(feature = "batch", feature = "batch_deterministic"))]
|
#[cfg(any(feature = "batch", feature = "batch_deterministic"))]
|
||||||
|
@ -16,6 +16,7 @@ use ed25519_dalek::*;
|
|||||||
use hex::FromHex;
|
use hex::FromHex;
|
||||||
use hex_literal::hex;
|
use hex_literal::hex;
|
||||||
|
|
||||||
|
#[cfg(feature = "rand")]
|
||||||
use sha2::Sha512;
|
use sha2::Sha512;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -193,7 +194,7 @@ mod vectors {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(feature = "rand")]
|
||||||
mod integrations {
|
mod integrations {
|
||||||
use super::*;
|
use super::*;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
@ -312,8 +313,8 @@ mod integrations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, feature = "serde"))]
|
#[cfg(all(test, feature = "serde"))]
|
||||||
#[derive(Debug, serde_crate::Serialize, serde_crate::Deserialize)]
|
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(crate = "serde_crate")]
|
#[serde(crate = "serde")]
|
||||||
struct Demo {
|
struct Demo {
|
||||||
signing_key: SigningKey,
|
signing_key: SigningKey,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user