From 3a67e63545b25566aa08db5e69663d650626acc8 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 26 Oct 2019 09:12:24 -0700 Subject: [PATCH] signature: Remove `alloc` feature; MSRV 1.31+ The only thing the `signature` crate uses `alloc` for is the `Signature::to_vec` method, which is trivially accomplished otherwise as `sig.as_ref().to_vec()` or various other ways. By getting rid of it, we can completely get rid of the `alloc` feature, and with that reduce the MSRV back to 1.31. It might be worth considering a 1.0 release with a higher MSRV so we can leverage `TryFrom`, but for now, this provides wider compatibility by removing a single (mis)feature. --- .travis.yml | 2 +- README.md | 4 ++-- ed25519/Cargo.toml | 4 ---- ed25519/README.md | 4 ++-- signature-crate/Cargo.toml | 3 +-- signature-crate/README.md | 4 ++-- signature-crate/src/lib.rs | 5 +---- signature-crate/src/signature.rs | 12 ++---------- 8 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 504b899..0d7ec32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: rust cache: cargo rust: - - 1.36.0 + - 1.31.0 - stable - beta - nightly diff --git a/README.md b/README.md index 9e6a0df..ab26ff1 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ for bare-metal or WebAssembly programming. ## Minimum Supported Rust Version -All crates in this repository support Rust **1.36** or higher. In future minimum +All crates in this repository support Rust **1.31** or higher. In future minimum supported Rust version can be changed, but it will be done with the minor version bump. @@ -51,7 +51,7 @@ dual licensed as above, without any additional terms or conditions. [build-link]: https://travis-ci.org/RustCrypto/signatures [deps-image]: https://deps.rs/repo/github/RustCrypto/signatures/status.svg [deps-link]: https://deps.rs/repo/github/RustCrypto/signatures -[rustc-image]: https://img.shields.io/badge/rustc-1.36+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.31+-blue.svg [//]: # (general links) diff --git a/ed25519/Cargo.toml b/ed25519/Cargo.toml index e7e2066..ab43005 100644 --- a/ed25519/Cargo.toml +++ b/ed25519/Cargo.toml @@ -13,7 +13,3 @@ keywords = ["crypto", "curve25519", "ecc", "signature", "signing"] [dependencies] signature = { version = "1.0.0-pre.0", path = "../signature-crate", default-features = false } - -[features] -default = ["alloc"] -alloc = ["signature/alloc"] diff --git a/ed25519/README.md b/ed25519/README.md index 29c3d7d..a139f01 100644 --- a/ed25519/README.md +++ b/ed25519/README.md @@ -23,7 +23,7 @@ Ed25519 implementations, including HSMs or Cloud KMS services. ## Requirements -- Rust **1.36+** +- Rust **1.31+** ## License @@ -47,7 +47,7 @@ dual licensed as above, without any additional terms or conditions. [docs-image]: https://docs.rs/ed25519/badge.svg [docs-link]: https://docs.rs/ed25519/ [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.36+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.31+-blue.svg [build-image]: https://travis-ci.org/RustCrypto/signatures.svg?branch=master [build-link]: https://travis-ci.org/RustCrypto/signatures diff --git a/signature-crate/Cargo.toml b/signature-crate/Cargo.toml index e4c5587..e29b841 100644 --- a/signature-crate/Cargo.toml +++ b/signature-crate/Cargo.toml @@ -21,10 +21,9 @@ sha2 = { version = "0.8", default-features = false } [features] default = ["std"] -alloc = [] derive-preview = ["digest-preview", "signature_derive"] digest-preview = ["digest"] -std = ["alloc"] +std = [] [package.metadata.docs.rs] all-features = true diff --git a/signature-crate/README.md b/signature-crate/README.md index 401e911..03a59fd 100644 --- a/signature-crate/README.md +++ b/signature-crate/README.md @@ -16,7 +16,7 @@ Support is also planned for the [`ecdsa`][3] and [`rsa`][4] crates. ## Minimum Supported Rust Version -All crates in this repository support Rust **1.36** or higher. +All crates in this repository support Rust **1.31** or higher. Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump. @@ -52,7 +52,7 @@ dual licensed as above, without any additional terms or conditions. [docs-image]: https://docs.rs/signature/badge.svg [docs-link]: https://docs.rs/signature/ [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.36+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.31+-blue.svg [build-image]: https://travis-ci.org/RustCrypto/signatures.svg?branch=master [build-link]: https://travis-ci.org/RustCrypto/signatures diff --git a/signature-crate/src/lib.rs b/signature-crate/src/lib.rs index 2685930..3d1b802 100644 --- a/signature-crate/src/lib.rs +++ b/signature-crate/src/lib.rs @@ -4,7 +4,7 @@ //! //! ## Minimum Supported Rust Version //! -//! Rust **1.36** or higher. +//! Rust **1.31** or higher. //! //! Minimum supported Rust version can be changed in the future, but it will be //! done with a minor version bump. @@ -23,9 +23,6 @@ #![forbid(unsafe_code)] #![warn(missing_docs, rust_2018_idioms, unused_qualifications)] -#[cfg(feature = "alloc")] -extern crate alloc; - #[cfg(feature = "std")] #[macro_use] extern crate std; diff --git a/signature-crate/src/signature.rs b/signature-crate/src/signature.rs index 96a9f27..8331634 100644 --- a/signature-crate/src/signature.rs +++ b/signature-crate/src/signature.rs @@ -1,8 +1,7 @@ -use core::fmt::Debug; +//! Signature traits use crate::error::Error; -#[cfg(feature = "alloc")] -use alloc::vec::Vec; +use core::fmt::Debug; /// Trait impl'd by concrete types that represent digital signatures pub trait Signature: AsRef<[u8]> + Debug + Sized { @@ -14,13 +13,6 @@ pub trait Signature: AsRef<[u8]> + Debug + Sized { fn as_slice(&self) -> &[u8] { self.as_ref() } - - /// Convert this signature into a byte vector - #[cfg(feature = "alloc")] - #[inline] - fn into_vec(self) -> Vec { - self.as_slice().into() - } } /// Marker trait for `Signature` types computable as `S(H(m))`