ecdsa: remove implementations of PrehashSignature (#1007)

This commit is contained in:
Charles Edward Gagnon
2025-07-06 11:02:27 -04:00
committed by GitHub
parent 698356ed97
commit 23623f57ed
3 changed files with 7 additions and 33 deletions
+5
View File
@@ -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])
-10
View File
@@ -393,16 +393,6 @@ fn find_scalar_range(outer: &[u8], inner: &[u8]) -> Result<Range<usize>> {
Ok(Range { start, end })
}
#[cfg(all(feature = "digest", feature = "hazmat"))]
impl<C> signature::PrehashSignature for Signature<C>
where
C: EcdsaCurve + crate::hazmat::DigestAlgorithm,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
{
type Digest = C::Digest;
}
#[cfg(all(test, feature = "arithmetic"))]
mod tests {
use elliptic_curve::dev::MockCurve;
+2 -23
View File
@@ -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<C> PrehashSignature for Signature<C>
where
C: DigestAlgorithm,
<FieldBytesSize<C> 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.
///