diff --git a/ecdsa/Cargo.toml b/ecdsa/Cargo.toml index 03272b5..2bda115 100644 --- a/ecdsa/Cargo.toml +++ b/ecdsa/Cargo.toml @@ -32,6 +32,8 @@ sha2 = { version = "0.10", default-features = false } [features] default = ["digest"] alloc = ["signature/alloc"] +std = ["alloc", "elliptic-curve/std", "signature/std"] + arithmetic = ["elliptic-curve/arithmetic"] dev = ["arithmetic", "digest", "elliptic-curve/dev", "hazmat"] digest = ["signature/digest-preview"] @@ -39,9 +41,8 @@ hazmat = [] pkcs8 = ["elliptic-curve/pkcs8", "der"] pem = ["elliptic-curve/pem", "pkcs8"] serde = ["elliptic-curve/serde", "serdect"] -sign = ["arithmetic", "digest", "hazmat", "rfc6979"] -std = ["alloc", "elliptic-curve/std", "signature/std"] -verify = ["arithmetic", "digest", "hazmat"] +signing = ["arithmetic", "digest", "hazmat", "rfc6979"] +verifying = ["arithmetic", "digest", "hazmat"] [package.metadata.docs.rs] all-features = true diff --git a/ecdsa/src/lib.rs b/ecdsa/src/lib.rs index 009ba24..d7d7325 100644 --- a/ecdsa/src/lib.rs +++ b/ecdsa/src/lib.rs @@ -71,10 +71,10 @@ pub mod dev; #[cfg_attr(docsrs, doc(cfg(feature = "hazmat")))] pub mod hazmat; -#[cfg(feature = "sign")] +#[cfg(feature = "signing")] mod signing; -#[cfg(feature = "verify")] +#[cfg(feature = "verifying")] mod verifying; pub use crate::recovery::RecoveryId; @@ -85,12 +85,12 @@ pub use elliptic_curve::{self, sec1::EncodedPoint, PrimeCurve}; // Re-export the `signature` crate (and select types) pub use signature::{self, Error, Result, SignatureEncoding}; -#[cfg(feature = "sign")] -#[cfg_attr(docsrs, doc(cfg(feature = "sign")))] +#[cfg(feature = "signing")] +#[cfg_attr(docsrs, doc(cfg(feature = "signing")))] pub use crate::signing::SigningKey; -#[cfg(feature = "verify")] -#[cfg_attr(docsrs, doc(cfg(feature = "verify")))] +#[cfg(feature = "verifying")] +#[cfg_attr(docsrs, doc(cfg(feature = "verifying")))] pub use crate::verifying::VerifyingKey; use core::{ diff --git a/ecdsa/src/recovery.rs b/ecdsa/src/recovery.rs index 0c7c0cb..c7fee32 100644 --- a/ecdsa/src/recovery.rs +++ b/ecdsa/src/recovery.rs @@ -2,7 +2,7 @@ use crate::{Error, Result}; -#[cfg(feature = "verify")] +#[cfg(feature = "verifying")] use { crate::{ hazmat::{bits2field, DigestPrimitive, VerifyPrimitive}, @@ -71,8 +71,8 @@ impl RecoveryId { } } -#[cfg(feature = "verify")] -#[cfg_attr(docsrs, doc(cfg(feature = "verify")))] +#[cfg(feature = "verifying")] +#[cfg_attr(docsrs, doc(cfg(feature = "verifying")))] impl RecoveryId { /// Given a public key, message, and signature, use trial recovery /// to determine if a suitable recovery ID exists, or return an error @@ -157,8 +157,8 @@ impl From for u8 { } } -#[cfg(feature = "verify")] -#[cfg_attr(docsrs, doc(cfg(feature = "verify")))] +#[cfg(feature = "verifying")] +#[cfg_attr(docsrs, doc(cfg(feature = "verifying")))] impl VerifyingKey where C: PrimeCurve + ProjectiveArithmetic, diff --git a/ecdsa/src/signing.rs b/ecdsa/src/signing.rs index 6c442bd..b20f977 100644 --- a/ecdsa/src/signing.rs +++ b/ecdsa/src/signing.rs @@ -38,7 +38,7 @@ use crate::elliptic_curve::{ AffinePoint, }; -#[cfg(feature = "verify")] +#[cfg(feature = "verifying")] use {crate::VerifyingKey, elliptic_curve::PublicKey, signature::KeypairRef}; /// ECDSA signing key. Generic over elliptic curves. @@ -46,7 +46,7 @@ use {crate::VerifyingKey, elliptic_curve::PublicKey, signature::KeypairRef}; /// Requires an [`elliptic_curve::ProjectiveArithmetic`] impl on the curve, and a /// [`SignPrimitive`] impl on its associated `Scalar` type. #[derive(Clone)] -#[cfg_attr(docsrs, doc(cfg(feature = "sign")))] +#[cfg_attr(docsrs, doc(cfg(feature = "signing")))] pub struct SigningKey where C: PrimeCurve + ProjectiveArithmetic, @@ -57,7 +57,7 @@ where secret_scalar: NonZeroScalar, /// Verifying key which corresponds to this signing key. - #[cfg(feature = "verify")] + #[cfg(feature = "verifying")] verifying_key: VerifyingKey, } @@ -96,8 +96,8 @@ where } /// Get the [`VerifyingKey`] which corresponds to this [`SigningKey`]. - #[cfg(feature = "verify")] - #[cfg_attr(docsrs, doc(cfg(feature = "verify")))] + #[cfg(feature = "verifying")] + #[cfg_attr(docsrs, doc(cfg(feature = "verifying")))] pub fn verifying_key(&self) -> &VerifyingKey { &self.verifying_key } @@ -274,8 +274,8 @@ where // Other trait impls // -#[cfg(feature = "verify")] -#[cfg_attr(docsrs, doc(cfg(feature = "verify")))] +#[cfg(feature = "verifying")] +#[cfg_attr(docsrs, doc(cfg(feature = "verifying")))] impl AsRef> for SigningKey where C: PrimeCurve + ProjectiveArithmetic, @@ -348,12 +348,12 @@ where SignatureSize: ArrayLength, { fn from(secret_scalar: NonZeroScalar) -> Self { - #[cfg(feature = "verify")] + #[cfg(feature = "verifying")] let public_key = PublicKey::from_secret_scalar(&secret_scalar); Self { secret_scalar, - #[cfg(feature = "verify")] + #[cfg(feature = "verifying")] verifying_key: public_key.into(), } } @@ -424,7 +424,7 @@ where { } -#[cfg(feature = "verify")] +#[cfg(feature = "verifying")] impl From> for VerifyingKey where C: PrimeCurve + ProjectiveArithmetic, @@ -436,7 +436,7 @@ where } } -#[cfg(feature = "verify")] +#[cfg(feature = "verifying")] impl From<&SigningKey> for VerifyingKey where C: PrimeCurve + ProjectiveArithmetic, @@ -448,8 +448,8 @@ where } } -#[cfg(feature = "verify")] -#[cfg_attr(docsrs, doc(cfg(feature = "verify")))] +#[cfg(feature = "verifying")] +#[cfg_attr(docsrs, doc(cfg(feature = "verifying")))] impl KeypairRef for SigningKey where C: PrimeCurve + ProjectiveArithmetic, diff --git a/ecdsa/src/verifying.rs b/ecdsa/src/verifying.rs index b36fa16..1683d65 100644 --- a/ecdsa/src/verifying.rs +++ b/ecdsa/src/verifying.rs @@ -46,7 +46,7 @@ use serdect::serde::{de, ser, Deserialize, Serialize}; /// /// The serialization leverages the encoding used by the [`PublicKey`] type, /// which is a binary-oriented ASN.1 DER encoding. -#[cfg_attr(docsrs, doc(cfg(feature = "verify")))] +#[cfg_attr(docsrs, doc(cfg(feature = "verifying")))] #[derive(Clone, Debug)] pub struct VerifyingKey where