diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/signature/src | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/signature/src')
-rw-r--r-- | vendor/signature/src/encoding.rs | 31 | ||||
-rw-r--r-- | vendor/signature/src/error.rs | 7 | ||||
-rw-r--r-- | vendor/signature/src/hazmat.rs | 21 | ||||
-rw-r--r-- | vendor/signature/src/keypair.rs | 24 | ||||
-rw-r--r-- | vendor/signature/src/lib.rs | 105 | ||||
-rw-r--r-- | vendor/signature/src/prehash_signature.rs | 31 | ||||
-rw-r--r-- | vendor/signature/src/signature.rs | 68 | ||||
-rw-r--r-- | vendor/signature/src/signer.rs | 64 | ||||
-rw-r--r-- | vendor/signature/src/verifier.rs | 15 |
9 files changed, 156 insertions, 210 deletions
diff --git a/vendor/signature/src/encoding.rs b/vendor/signature/src/encoding.rs new file mode 100644 index 000000000..8bc475b01 --- /dev/null +++ b/vendor/signature/src/encoding.rs @@ -0,0 +1,31 @@ +//! Encoding support. + +#[cfg(feature = "alloc")] +use alloc::vec::Vec; + +/// Support for decoding/encoding signatures as bytes. +pub trait SignatureEncoding: + Clone + Sized + for<'a> TryFrom<&'a [u8]> + TryInto<Self::Repr> +{ + /// Byte representation of a signature. + type Repr: 'static + AsRef<[u8]> + Clone + Send + Sync; + + /// Encode signature as its byte representation. + fn to_bytes(&self) -> Self::Repr { + self.clone() + .try_into() + .ok() + .expect("signature encoding error") + } + + /// Encode signature as a byte vector. + #[cfg(feature = "alloc")] + fn to_vec(&self) -> Vec<u8> { + self.to_bytes().as_ref().to_vec() + } + + /// Get the length of this signature when encoded. + fn encoded_len(&self) -> usize { + self.to_bytes().as_ref().len() + } +} diff --git a/vendor/signature/src/error.rs b/vendor/signature/src/error.rs index 06e22d527..1bfaf33bf 100644 --- a/vendor/signature/src/error.rs +++ b/vendor/signature/src/error.rs @@ -22,11 +22,8 @@ pub type Result<T> = core::result::Result<T, Error>; /// /// [BB'06]: https://en.wikipedia.org/wiki/Daniel_Bleichenbacher #[derive(Default)] +#[non_exhaustive] pub struct Error { - /// Prevent from being instantiated as `Error {}` when the `std` feature - /// is disabled - _private: (), - /// Source of the error (if applicable). #[cfg(feature = "std")] source: Option<Box<dyn std::error::Error + Send + Sync + 'static>>, @@ -45,12 +42,10 @@ impl Error { /// cases are for propagating errors related to external signers, e.g. /// communication/authentication errors with HSMs, KMS, etc. #[cfg(feature = "std")] - #[cfg_attr(docsrs, doc(cfg(feature = "std")))] pub fn from_source( source: impl Into<Box<dyn std::error::Error + Send + Sync + 'static>>, ) -> Self { Self { - _private: (), source: Some(source.into()), } } diff --git a/vendor/signature/src/hazmat.rs b/vendor/signature/src/hazmat.rs index 8119225c6..d2f3e9523 100644 --- a/vendor/signature/src/hazmat.rs +++ b/vendor/signature/src/hazmat.rs @@ -5,18 +5,14 @@ //! //! Using them incorrectly can introduce security vulnerabilities. Please //! carefully read the documentation before attempting to use them. -//! -//! To use them, enable the `hazmat-preview` crate feature. Note that this -//! feature is semi-unstable and not subject to regular 1.x SemVer guarantees. -//! However, any breaking changes will be accompanied with a minor version bump. -use crate::{Error, Signature}; +use crate::Error; -#[cfg(feature = "rand-preview")] -use crate::rand_core::{CryptoRng, RngCore}; +#[cfg(feature = "rand_core")] +use crate::rand_core::CryptoRngCore; /// Sign the provided message prehash, returning a digital signature. -pub trait PrehashSigner<S: Signature> { +pub trait PrehashSigner<S> { /// Attempt to sign the given message digest, returning a digital signature /// on success, or an error if something went wrong. /// @@ -33,9 +29,8 @@ pub trait PrehashSigner<S: Signature> { } /// Sign the provided message prehash using the provided external randomness source, returning a digital signature. -#[cfg(feature = "rand-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "rand-preview")))] -pub trait RandomizedPrehashSigner<S: Signature> { +#[cfg(feature = "rand_core")] +pub trait RandomizedPrehashSigner<S> { /// Attempt to sign the given message digest, returning a digital signature /// on success, or an error if something went wrong. /// @@ -50,13 +45,13 @@ pub trait RandomizedPrehashSigner<S: Signature> { /// implementation to decide. fn sign_prehash_with_rng( &self, - rng: impl CryptoRng + RngCore, + rng: &mut impl CryptoRngCore, prehash: &[u8], ) -> Result<S, Error>; } /// Verify the provided message prehash using `Self` (e.g. a public key) -pub trait PrehashVerifier<S: Signature> { +pub trait PrehashVerifier<S> { /// Use `Self` to verify that the provided signature for a given message /// `prehash` is authentic. /// diff --git a/vendor/signature/src/keypair.rs b/vendor/signature/src/keypair.rs index 6d9f947c6..d4795f2f9 100644 --- a/vendor/signature/src/keypair.rs +++ b/vendor/signature/src/keypair.rs @@ -1,17 +1,29 @@ //! Signing keypairs. -use crate::Signature; - /// Signing keypair with an associated verifying key. /// /// This represents a type which holds both a signing key and a verifying key. -pub trait Keypair<S: Signature>: AsRef<Self::VerifyingKey> { +pub trait Keypair { /// Verifying key type for this keypair. - type VerifyingKey; + type VerifyingKey: Clone; /// Get the verifying key which can verify signatures produced by the /// signing key portion of this keypair. - fn verifying_key(&self) -> &Self::VerifyingKey { - self.as_ref() + fn verifying_key(&self) -> Self::VerifyingKey; +} + +/// Signing keypair with an associated verifying key. +/// +/// This represents a type which holds both a signing key and a verifying key. +pub trait KeypairRef: AsRef<Self::VerifyingKey> { + /// Verifying key type for this keypair. + type VerifyingKey: Clone; +} + +impl<K: KeypairRef> Keypair for K { + type VerifyingKey = <Self as KeypairRef>::VerifyingKey; + + fn verifying_key(&self) -> Self::VerifyingKey { + self.as_ref().clone() } } diff --git a/vendor/signature/src/lib.rs b/vendor/signature/src/lib.rs index ab504c2ac..ba1feb494 100644 --- a/vendor/signature/src/lib.rs +++ b/vendor/signature/src/lib.rs @@ -4,9 +4,16 @@ html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg", html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg" )] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![forbid(unsafe_code)] -#![warn(missing_docs, rust_2018_idioms, unused_qualifications)] +#![warn( + clippy::mod_module_files, + clippy::unwrap_used, + missing_docs, + rust_2018_idioms, + unused_lifetimes, + unused_qualifications +)] //! # Design //! @@ -43,24 +50,14 @@ //! ## Implementation //! //! To accomplish the above goals, the [`Signer`] and [`Verifier`] traits -//! provided by this are generic over a [`Signature`] return value, and use -//! generic parameters rather than associated types. Notably, they use such -//! a parameter for the return value, allowing it to be inferred by the type -//! checker based on the desired signature type. -//! -//! The [`Signature`] trait is bounded on `AsRef<[u8]>`, enforcing that -//! signature types are thin wrappers around a "bag-of-bytes" -//! serialization. Inspiration for this approach comes from the Ed25519 -//! signature system, which was based on the observation that past -//! systems were not prescriptive about how signatures should be represented -//! on-the-wire, and that lead to a proliferation of different wire formats -//! and confusion about which ones should be used. This crate aims to provide -//! similar simplicity by minimizing the number of steps involved to obtain -//! a serializable signature. +//! provided by this are generic over a signature value, and use generic +//! parameters rather than associated types. Notably, they use such a parameter +//! for the return value, allowing it to be inferred by the type checker based +//! on the desired signature type. //! //! ## Alternatives considered //! -//! This crate is based on over two years of exploration of how to encapsulate +//! This crate is based on many years of exploration of how to encapsulate //! digital signature systems in the most flexible, developer-friendly way. //! During that time many design alternatives were explored, tradeoffs //! compared, and ultimately the provided API was selected. @@ -73,10 +70,7 @@ //! - "Bag-of-bytes" serialization precludes signature providers from using //! their own internal representation of a signature, which can be helpful //! for many reasons (e.g. advanced signature system features like batch -//! verification). Alternatively each provider could define its own signature -//! type, using a marker trait to identify the particular signature algorithm, -//! have `From` impls for converting to/from `[u8; N]`, and a marker trait -//! for identifying a specific signature algorithm. +//! verification). //! - Associated types, rather than generic parameters of traits, could allow //! more customization of the types used by a particular signature system, //! e.g. using custom error types. @@ -108,8 +102,8 @@ //! //! ## Unstable features //! -//! Despite being post-1.0, this crate includes a number of off-by-default -//! unstable features named `*-preview`, each of which depends on a pre-1.0 +//! Despite being post-1.0, this crate includes off-by-default unstable +//! optional features, each of which depends on a pre-1.0 //! crate. //! //! These features are considered exempt from SemVer. See the @@ -117,21 +111,21 @@ //! //! The following unstable features are presently supported: //! -//! - `derive-preview`: for implementers of signature systems using -//! [`DigestSigner`] and [`DigestVerifier`], the `derive-preview` feature -//! can be used to derive [`Signer`] and [`Verifier`] traits which prehash -//! the input message using the [`PrehashSignature::Digest`] algorithm for -//! a given [`Signature`] type. When the `derive-preview` feature is enabled +//! - `derive`: for implementers of signature systems using [`DigestSigner`] +//! and [`DigestVerifier`], the `derive` feature can be used to +//! derive [`Signer`] and [`Verifier`] traits which prehash the input +//! message using the [`PrehashSignature::Digest`] algorithm for +//! a given signature type. When the `derive` feature is enabled //! import the proc macros with `use signature::{Signer, Verifier}` and then //! add a `derive(Signer)` or `derive(Verifier)` attribute to the given //! digest signer/verifier type. Enabling this feature also enables `digest` //! support (see immediately below). -//! - `digest-preview`: enables the [`DigestSigner`] and [`DigestVerifier`] +//! - `digest`: enables the [`DigestSigner`] and [`DigestVerifier`] //! traits which are based on the [`Digest`] trait from the [`digest`] crate. //! These traits are used for representing signature systems based on the //! [Fiat-Shamir heuristic] which compute a random challenge value to sign //! by computing a cryptographically secure digest of the input message. -//! - `rand-preview`: enables the [`RandomizedSigner`] trait for signature +//! - `rand_core`: enables the [`RandomizedSigner`] trait for signature //! systems which rely on a cryptographically secure random number generator //! for security. //! @@ -143,53 +137,32 @@ //! [`Digest`]: https://docs.rs/digest/latest/digest/trait.Digest.html //! [Fiat-Shamir heuristic]: https://en.wikipedia.org/wiki/Fiat%E2%80%93Shamir_heuristic +#[cfg(feature = "alloc")] +extern crate alloc; #[cfg(feature = "std")] extern crate std; -#[cfg(all(feature = "signature_derive", not(feature = "derive-preview")))] -compile_error!( - "The `signature_derive` feature should not be enabled directly. \ - Use the `derive-preview` feature instead." -); - -#[cfg(all(feature = "digest", not(feature = "digest-preview")))] -compile_error!( - "The `digest` feature should not be enabled directly. \ - Use the `digest-preview` feature instead." -); - -#[cfg(all(feature = "rand_core", not(feature = "rand-preview")))] -compile_error!( - "The `rand_core` feature should not be enabled directly. \ - Use the `rand-preview` feature instead." -); - -#[cfg(feature = "hazmat-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "hazmat-preview")))] pub mod hazmat; +mod encoding; mod error; mod keypair; -mod signature; mod signer; mod verifier; -#[cfg(feature = "derive-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "derive-preview")))] -pub use signature_derive::{Signer, Verifier}; +#[cfg(feature = "digest")] +mod prehash_signature; -#[cfg(all(feature = "derive-preview", feature = "digest-preview"))] -#[cfg_attr( - docsrs, - doc(cfg(all(feature = "derive-preview", feature = "digest-preview"))) -)] -pub use signature_derive::{DigestSigner, DigestVerifier}; +pub use crate::{encoding::*, error::*, keypair::*, signer::*, verifier::*}; -#[cfg(feature = "digest-preview")] -pub use digest; +#[cfg(feature = "derive")] +pub use derive::{Signer, Verifier}; -#[cfg(feature = "rand-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "rand-preview")))] -pub use rand_core; +#[cfg(all(feature = "derive", feature = "digest"))] +pub use derive::{DigestSigner, DigestVerifier}; -pub use crate::{error::*, keypair::*, signature::*, signer::*, verifier::*}; +#[cfg(feature = "digest")] +pub use {crate::prehash_signature::*, digest}; + +#[cfg(feature = "rand_core")] +pub use rand_core; diff --git a/vendor/signature/src/prehash_signature.rs b/vendor/signature/src/prehash_signature.rs new file mode 100644 index 000000000..d9a86456d --- /dev/null +++ b/vendor/signature/src/prehash_signature.rs @@ -0,0 +1,31 @@ +//! `PrehashSignature` trait. + +/// For intra-doc link resolution. +#[allow(unused_imports)] +use crate::{ + signer::{DigestSigner, Signer}, + verifier::{DigestVerifier, Verifier}, +}; + +/// Marker trait for `Signature` types computable as `𝐒(𝐇(𝒎))` +/// i.e. ones which prehash a message to be signed as `𝐇(𝒎)` +/// +/// Where: +/// +/// - `𝐒`: signature algorithm +/// - `𝐇`: hash (a.k.a. digest) function +/// - `𝒎`: message +/// +/// This approach is relatively common in signature schemes based on the +/// [Fiat-Shamir heuristic]. +/// +/// For signature types that implement this trait, when the `derive` crate +/// feature is enabled a custom derive for [`Signer`] is available for any +/// types that impl [`DigestSigner`], and likewise for deriving [`Verifier`] for +/// types which impl [`DigestVerifier`]. +/// +/// [Fiat-Shamir heuristic]: https://en.wikipedia.org/wiki/Fiat%E2%80%93Shamir_heuristic +pub trait PrehashSignature { + /// Preferred `Digest` algorithm to use when computing this signature type. + type Digest: digest::Digest; +} diff --git a/vendor/signature/src/signature.rs b/vendor/signature/src/signature.rs deleted file mode 100644 index 29aa0b845..000000000 --- a/vendor/signature/src/signature.rs +++ /dev/null @@ -1,68 +0,0 @@ -//! Signature traits - -use crate::error::Error; -use core::fmt::Debug; - -/// For intra-doc link resolution -#[cfg(feature = "digest-preview")] -#[allow(unused_imports)] -use crate::{ - signer::{DigestSigner, Signer}, - verifier::{DigestVerifier, Verifier}, -}; - -/// Trait impl'd by concrete types that represent digital signatures. -/// -/// Signature types *must* (as mandated by the `AsRef<[u8]>` bound) be a thin -/// wrapper around the "bag-of-bytes" serialized form of a signature which can -/// be directly parsed from or written to the "wire". -/// -/// Inspiration for this approach comes from the Ed25519 signature system, -/// which adopted it based on the observation that past signature systems -/// were not prescriptive about how signatures should be represented -/// on-the-wire, and that lead to a proliferation of different wire formats and -/// confusion about which ones should be used. -/// -/// The [`Signature`] trait aims to provide similar simplicity by minimizing -/// the number of steps involved to obtain a serializable signature and -/// ideally ensuring there is one signature type for any given signature system -/// shared by all "provider" crates. -/// -/// For signature systems which require a more advanced internal representation -/// (e.g. involving decoded scalars or decompressed elliptic curve points) it's -/// recommended that "provider" libraries maintain their own internal signature -/// type and use `From` bounds to provide automatic conversions. -pub trait Signature: AsRef<[u8]> + Debug + Sized { - /// Parse a signature from its byte representation - fn from_bytes(bytes: &[u8]) -> Result<Self, Error>; - - /// Borrow a byte slice representing the serialized form of this signature - fn as_bytes(&self) -> &[u8] { - self.as_ref() - } -} - -/// Marker trait for `Signature` types computable as `𝐒(𝐇(𝒎))` -/// i.e. ones which prehash a message to be signed as `𝐇(𝒎)` -/// -/// Where: -/// -/// - `𝐒`: signature algorithm -/// - `𝐇`: hash (a.k.a. digest) function -/// - `𝒎`: message -/// -/// This approach is relatively common in signature schemes based on the -/// [Fiat-Shamir heuristic]. -/// -/// For signature types that implement this trait, when the `derive-preview` -/// Cargo feature is enabled a custom derive for [`Signer`] is available for any -/// types that impl [`DigestSigner`], and likewise for deriving [`Verifier`] for -/// types which impl [`DigestVerifier`]. -/// -/// [Fiat-Shamir heuristic]: https://en.wikipedia.org/wiki/Fiat%E2%80%93Shamir_heuristic -#[cfg(feature = "digest-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "digest-preview")))] -pub trait PrehashSignature: Signature { - /// Preferred `Digest` algorithm to use when computing this signature type. - type Digest: digest::Digest; -} diff --git a/vendor/signature/src/signer.rs b/vendor/signature/src/signer.rs index c025711fe..b339ddf59 100644 --- a/vendor/signature/src/signer.rs +++ b/vendor/signature/src/signer.rs @@ -1,16 +1,16 @@ //! Traits for generating digital signatures -use crate::{error::Error, Signature}; +use crate::error::Error; -#[cfg(feature = "digest-preview")] +#[cfg(feature = "digest")] use crate::digest::Digest; -#[cfg(feature = "rand-preview")] -use crate::rand_core::{CryptoRng, RngCore}; +#[cfg(feature = "rand_core")] +use crate::rand_core::CryptoRngCore; /// Sign the provided message bytestring using `Self` (e.g. a cryptographic key /// or connection to an HSM), returning a digital signature. -pub trait Signer<S: Signature> { +pub trait Signer<S> { /// Sign the given message and return a digital signature fn sign(&self, msg: &[u8]) -> S { self.try_sign(msg).expect("signature operation failed") @@ -24,10 +24,11 @@ pub trait Signer<S: Signature> { fn try_sign(&self, msg: &[u8]) -> Result<S, Error>; } -/// Sign the provided message bytestring using `&mut Self` (e.g., an evolving -/// cryptographic key), returning a digital signature. -pub trait SignerMut<S: Signature> { - /// Sign the given message, update the state, and return a digital signature +/// Sign the provided message bytestring using `&mut Self` (e.g. an evolving +/// cryptographic key such as a stateful hash-based signature), returning a +/// digital signature. +pub trait SignerMut<S> { + /// Sign the given message, update the state, and return a digital signature. fn sign(&mut self, msg: &[u8]) -> S { self.try_sign(msg).expect("signature operation failed") } @@ -40,12 +41,8 @@ pub trait SignerMut<S: Signature> { fn try_sign(&mut self, msg: &[u8]) -> Result<S, Error>; } -// Blanket impl of SignerMut for all Signer types -impl<T, S> SignerMut<S> for T -where - T: Signer<S>, - S: Signature, -{ +/// Blanket impl of [`SignerMut`] for all [`Signer`] types. +impl<S, T: Signer<S>> SignerMut<S> for T { fn try_sign(&mut self, msg: &[u8]) -> Result<S, Error> { T::try_sign(self, msg) } @@ -70,13 +67,8 @@ where /// API accepts a [`Digest`] instance, rather than a raw digest value. /// /// [Fiat-Shamir heuristic]: https://en.wikipedia.org/wiki/Fiat%E2%80%93Shamir_heuristic -#[cfg(feature = "digest-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "digest-preview")))] -pub trait DigestSigner<D, S> -where - D: Digest, - S: Signature, -{ +#[cfg(feature = "digest")] +pub trait DigestSigner<D: Digest, S> { /// Sign the given prehashed message [`Digest`], returning a signature. /// /// Panics in the event of a signing error. @@ -91,11 +83,10 @@ where } /// Sign the given message using the provided external randomness source. -#[cfg(feature = "rand-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "rand-preview")))] -pub trait RandomizedSigner<S: Signature> { +#[cfg(feature = "rand_core")] +pub trait RandomizedSigner<S> { /// Sign the given message and return a digital signature - fn sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> S { + fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S { self.try_sign_with_rng(rng, msg) .expect("signature operation failed") } @@ -105,32 +96,23 @@ pub trait RandomizedSigner<S: Signature> { /// /// The main intended use case for signing errors is when communicating /// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens. - fn try_sign_with_rng(&self, rng: impl CryptoRng + RngCore, msg: &[u8]) -> Result<S, Error>; + fn try_sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> Result<S, Error>; } /// Combination of [`DigestSigner`] and [`RandomizedSigner`] with support for /// computing a signature over a digest which requires entropy from an RNG. -#[cfg(all(feature = "digest-preview", feature = "rand-preview"))] -#[cfg_attr(docsrs, doc(cfg(feature = "digest-preview")))] -#[cfg_attr(docsrs, doc(cfg(feature = "rand-preview")))] -pub trait RandomizedDigestSigner<D, S> -where - D: Digest, - S: Signature, -{ +#[cfg(all(feature = "digest", feature = "rand_core"))] +pub trait RandomizedDigestSigner<D: Digest, S> { /// Sign the given prehashed message `Digest`, returning a signature. /// /// Panics in the event of a signing error. - fn sign_digest_with_rng(&self, rng: impl CryptoRng + RngCore, digest: D) -> S { + fn sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) -> S { self.try_sign_digest_with_rng(rng, digest) .expect("signature operation failed") } /// Attempt to sign the given prehashed message `Digest`, returning a /// digital signature on success, or an error if something went wrong. - fn try_sign_digest_with_rng( - &self, - rng: impl CryptoRng + RngCore, - digest: D, - ) -> Result<S, Error>; + fn try_sign_digest_with_rng(&self, rng: &mut impl CryptoRngCore, digest: D) + -> Result<S, Error>; } diff --git a/vendor/signature/src/verifier.rs b/vendor/signature/src/verifier.rs index 4d6efbc2b..65409a929 100644 --- a/vendor/signature/src/verifier.rs +++ b/vendor/signature/src/verifier.rs @@ -1,12 +1,12 @@ //! Trait for verifying digital signatures -use crate::{error::Error, Signature}; +use crate::error::Error; -#[cfg(feature = "digest-preview")] +#[cfg(feature = "digest")] use crate::digest::Digest; /// Verify the provided message bytestring using `Self` (e.g. a public key) -pub trait Verifier<S: Signature> { +pub trait Verifier<S> { /// Use `Self` to verify that the provided signature for a given message /// bytestring is authentic. /// @@ -34,13 +34,8 @@ pub trait Verifier<S: Signature> { /// API accepts a [`Digest`] instance, rather than a raw digest value. /// /// [Fiat-Shamir heuristic]: https://en.wikipedia.org/wiki/Fiat%E2%80%93Shamir_heuristic -#[cfg(feature = "digest-preview")] -#[cfg_attr(docsrs, doc(cfg(feature = "digest-preview")))] -pub trait DigestVerifier<D, S> -where - D: Digest, - S: Signature, -{ +#[cfg(feature = "digest")] +pub trait DigestVerifier<D: Digest, S> { /// Verify the signature against the given [`Digest`] output. fn verify_digest(&self, digest: D, signature: &S) -> Result<(), Error>; } |