Skip to content

Commit 5332de2

Browse files
committed
signature crate: 1.0 stabilization proposal
The motivation for 1.0 stabilization of the `signature` crate is the upcoming 1.0 release of `ed25519-dalek`. In order to promote Ed25519 interoperability, it would be great if `ed25519-dalek` could use the traits from this crate along with the `ed25519::Signature` type from the `ed25519` crate. To get there, I think we need to do a 1.0 release of this crate, as well as the `ed25519` crate. The main impediment towards doing so is the `digest` crate is presently stuck at v0.8. It would be nice to be able to continue upgrading it, especially to a 1.0 release, but that would otherwise be a semver breaking change. To allow agility around `digest`, and `signatory_derive` which depends on it, this commit places access to both under the `digest-preview` and `derive-preview` Cargo features respectively, and calls them out as not covered under SemVer and subject to change, but breaking changes will be done with a minor version bump.
1 parent 0284dec commit 5332de2

File tree

10 files changed

+63
-17
lines changed

10 files changed

+63
-17
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ rust:
77
- beta
88
- nightly
99

10+
env:
11+
global:
12+
- RUSTFLAGS="-D warnings"
13+
1014
script:
1115
- cargo test --verbose --release
1216
- cargo test --verbose --all-features --release

ecdsa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ categories = ["cryptography", "no-std"]
1010
keywords = ["crypto", "ecc", "ecdsa", "signature", "signing"]
1111

1212
[dependencies]
13-
signature = { version = "0.3", path = "../signature-crate" }
13+
signature = { version = "1.0.0-pre", path = "../signature-crate" }

ed25519/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories = ["cryptography", "no-std"]
1212
keywords = ["crypto", "curve25519", "ecc", "signature", "signing"]
1313

1414
[dependencies]
15-
signature = { version = "0.3", path = "../signature-crate", default-features = false }
15+
signature = { version = "1.0.0-pre", path = "../signature-crate", default-features = false }
1616

1717
[features]
1818
default = ["alloc"]

ed25519/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl Signature {
3838

3939
/// Return the inner byte array
4040
pub fn to_bytes(&self) -> [u8; SIGNATURE_LENGTH] {
41-
self.0.clone()
41+
self.0
4242
}
4343
}
4444

signature-crate/Cargo.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "signature"
33
description = "Traits for cryptographic signature algorithms (e.g. ECDSA, Ed25519)"
4-
version = "0.3.0" # Also update html_root_url in lib.rs when bumping this
4+
version = "1.0.0-pre" # Also update html_root_url in lib.rs when bumping this
55
authors = ["RustCrypto Developers"]
66
license = "Apache-2.0 OR MIT"
77
documentation = "https://docs.rs/signature"
@@ -20,6 +20,11 @@ hex-literal = "0.2"
2020
sha2 = { version = "0.8", default-features = false }
2121

2222
[features]
23-
default = ["digest", "std"]
24-
alloc = []
25-
std = ["alloc"]
23+
default = ["std"]
24+
alloc = []
25+
derive-preview = ["digest-preview", "signature_derive"]
26+
digest-preview = ["digest"]
27+
std = ["alloc"]
28+
29+
[package.metadata.docs.rs]
30+
all-features = true

signature-crate/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,21 @@ Support is also planned for the [`ecdsa`][3] and [`rsa`][4] crates.
1414

1515
[Documentation][docs-link]
1616

17-
## Requirements
17+
## Minimum Supported Rust Version
1818

19-
- Rust **1.36+**
19+
All crates in this repository support Rust **1.36** or higher.
20+
21+
Minimum supported Rust version can be changed in the future, but it will be
22+
done with a minor version bump.
23+
24+
## SemVer Policy
25+
26+
- All on-by-default features of this library are covered by SemVer
27+
- MSRV is considered exempt from SemVer as noted above
28+
- The off-by-default features `derive-preview` and `digest-preview` are
29+
unstable "preview" features which are also considered exempt from SemVer.
30+
Breaking changes to these features will, like MSRV, be done with a minor
31+
version bump.
2032

2133
## License
2234

signature-crate/src/lib.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
//! Traits which provide generic, object-safe APIs for generating and verifying
22
//! digital signatures, which provide message authentication using public-key
33
//! cryptography.
4+
//!
5+
//! ## Minimum Supported Rust Version
6+
//!
7+
//! Rust **1.36** or higher.
8+
//!
9+
//! Minimum supported Rust version can be changed in the future, but it will be
10+
//! done with a minor version bump.
11+
//!
12+
//! ## SemVer Policy
13+
//!
14+
//! - All on-by-default features of this library are covered by SemVer
15+
//! - MSRV is considered exempt from SemVer as noted above
16+
//! - The off-by-default features `derive-preview` and `digest-preview` are
17+
//! unstable "preview" features which are also considered exempt from SemVer.
18+
//! Breaking changes to these features will, like MSRV, be done with a minor
19+
//! version bump.
420
521
#![no_std]
622
#![forbid(unsafe_code)]
@@ -14,16 +30,16 @@ extern crate alloc;
1430
#[macro_use]
1531
extern crate std;
1632

17-
#[cfg(feature = "signature_derive")]
33+
#[cfg(feature = "derive-preview")]
1834
#[allow(unused_imports)]
1935
#[macro_use]
2036
extern crate signature_derive;
2137

22-
#[cfg(feature = "signature_derive")]
38+
#[cfg(feature = "derive-preview")]
2339
#[doc(hidden)]
2440
pub use signature_derive::{Signer, Verifier};
2541

26-
#[cfg(feature = "digest")]
42+
#[cfg(feature = "digest-preview")]
2743
pub use digest;
2844

2945
mod error;

signature-crate/src/signer.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Traits for generating digital signatures
22
3-
#[cfg(feature = "digest")]
3+
#[cfg(feature = "digest-preview")]
44
use crate::digest::Digest;
55
use crate::{error::Error, Signature};
66

@@ -21,7 +21,10 @@ pub trait Signer<S: Signature> {
2121
}
2222

2323
/// Sign the given prehashed message `Digest` using `Self`.
24-
#[cfg(feature = "digest")]
24+
///
25+
/// This trait is only available when the `digest-preview` cargo feature is
26+
/// enabled.
27+
#[cfg(feature = "digest-preview")]
2528
pub trait DigestSigner<D, S>
2629
where
2730
D: Digest,

signature-crate/src/verifier.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Trait for verifying digital signatures
22
3-
#[cfg(feature = "digest")]
3+
#[cfg(feature = "digest-preview")]
44
use crate::digest::Digest;
55
use crate::{error::Error, Signature};
66

@@ -15,7 +15,13 @@ pub trait Verifier<S: Signature> {
1515

1616
/// Verify the provided signature for the given prehashed message `Digest`
1717
/// is authentic.
18-
#[cfg(feature = "digest")]
18+
///
19+
/// This trait is only available when the `digest-preview` cargo feature is
20+
/// enabled.
21+
///
22+
/// It accepts a [`Digest`] instance, as opposed to a raw digest byte array,
23+
/// as the security of signature algorithms built on hash functions
24+
#[cfg(feature = "digest-preview")]
1925
pub trait DigestVerifier<D, S>
2026
where
2127
D: Digest,

signature-crate/tests/signature_derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// "Tests" for code generated by `signature_derive`
2-
#[cfg(all(test, feature = "signature_derive"))]
2+
#[cfg(all(test, feature = "derive-preview"))]
33
mod tests {
44
use digest::{generic_array::GenericArray, Digest};
55
use hex_literal::hex;

0 commit comments

Comments
 (0)