From 23623f57ed26315834d6b2ab5b4901563e55105a Mon Sep 17 00:00:00 2001 From: Charles Edward Gagnon <76854355+carloskiki@users.noreply.github.com> Date: Sun, 6 Jul 2025 11:02:27 -0400 Subject: [PATCH] ecdsa: remove implementations of `PrehashSignature` (#1007) --- ecdsa/CHANGELOG.md | 5 +++++ ecdsa/src/der.rs | 10 ---------- ecdsa/src/hazmat.rs | 25 ++----------------------- 3 files changed, 7 insertions(+), 33 deletions(-) diff --git a/ecdsa/CHANGELOG.md b/ecdsa/CHANGELOG.md index 77609d8..e94b910 100644 --- a/ecdsa/CHANGELOG.md +++ b/ecdsa/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Removed +- `signature::PrehashSignature` implementation for `Signature` ([#1007]) + ## 0.16.9 (2023-11-16) ### Changed - Loosen `signature` bound to `2.0, <2.3` ([#756]) diff --git a/ecdsa/src/der.rs b/ecdsa/src/der.rs index a8d8cfa..89ca193 100644 --- a/ecdsa/src/der.rs +++ b/ecdsa/src/der.rs @@ -393,16 +393,6 @@ fn find_scalar_range(outer: &[u8], inner: &[u8]) -> Result> { Ok(Range { start, end }) } -#[cfg(all(feature = "digest", feature = "hazmat"))] -impl signature::PrehashSignature for Signature -where - C: EcdsaCurve + crate::hazmat::DigestAlgorithm, - MaxSize: ArraySize, - as Add>::Output: Add + ArraySize, -{ - type Digest = C::Digest; -} - #[cfg(all(test, feature = "arithmetic"))] mod tests { use elliptic_curve::dev::MockCurve; diff --git a/ecdsa/src/hazmat.rs b/ecdsa/src/hazmat.rs index ad64400..d1f87f4 100644 --- a/ecdsa/src/hazmat.rs +++ b/ecdsa/src/hazmat.rs @@ -28,30 +28,18 @@ use { }; #[cfg(feature = "digest")] -use { - elliptic_curve::FieldBytesSize, - signature::{ - PrehashSignature, - digest::{Digest, FixedOutput, FixedOutputReset, block_api::BlockSizeUser}, - }, -}; +use signature::digest::{Digest, FixedOutput, FixedOutputReset, block_api::BlockSizeUser}; #[cfg(feature = "rfc6979")] use elliptic_curve::FieldBytesEncoding; -#[cfg(any(feature = "arithmetic", feature = "digest"))] +#[cfg(any(feature = "arithmetic", feature = "rfc6979"))] use crate::{Signature, elliptic_curve::array::ArraySize}; /// Bind a preferred [`Digest`] algorithm to an elliptic curve type. /// /// Generally there is a preferred variety of the SHA-2 family used with ECDSA /// for a particular elliptic curve. -/// -/// This trait can be used to specify it, and with it receive a blanket impl of -/// [`PrehashSignature`], used by [`signature_derive`][1]) for the [`Signature`] -/// type for a particular elliptic curve. -/// -/// [1]: https://github.com/RustCrypto/traits/tree/master/signature/derive #[cfg(feature = "digest")] pub trait DigestAlgorithm: EcdsaCurve { /// Preferred digest to use when computing ECDSA signatures for this @@ -59,15 +47,6 @@ pub trait DigestAlgorithm: EcdsaCurve { type Digest: BlockSizeUser + Digest + FixedOutput + FixedOutputReset; } -#[cfg(feature = "digest")] -impl PrehashSignature for Signature -where - C: DigestAlgorithm, - as core::ops::Add>::Output: ArraySize, -{ - type Digest = C::Digest; -} - /// Partial implementation of the `bits2int` function as defined in /// [RFC6979 § 2.3.2] as well as [SEC1] § 2.3.8. ///