From 56b8b7acdf6d76291f8cbff56241fb15063befd3 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Wed, 17 Jan 2024 21:20:52 +0000 Subject: [PATCH] ecdsa: move `EcdsaCurve` trait to toplevel (#791) Moves the trait added in #787 out of the `hazmat` module and into the toplevel, so it's available regardless of whether or not the `hazmat` feature has been enabled. --- ecdsa/src/hazmat.rs | 8 -------- ecdsa/src/lib.rs | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ecdsa/src/hazmat.rs b/ecdsa/src/hazmat.rs index d3149418..013dde9a 100644 --- a/ecdsa/src/hazmat.rs +++ b/ecdsa/src/hazmat.rs @@ -43,14 +43,6 @@ use elliptic_curve::{FieldBytesEncoding, ScalarPrimitive}; #[cfg(any(feature = "arithmetic", feature = "digest"))] use crate::{elliptic_curve::array::ArraySize, Signature}; -/// Marker trait for elliptic curves intended for use with ECDSA. -pub trait EcdsaCurve: PrimeCurve { - /// Does this curve use low-S normalized signatures? - /// - /// This is typically `false`. See [`Signature::normalize_s`] for more information. - const NORMALIZE_S: bool; -} - /// Try to sign the given prehashed message using ECDSA. /// /// This trait is intended to be implemented on a type with access to the diff --git a/ecdsa/src/lib.rs b/ecdsa/src/lib.rs index 2a351825..5c216d96 100644 --- a/ecdsa/src/lib.rs +++ b/ecdsa/src/lib.rs @@ -166,6 +166,14 @@ const SHA384_OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("2.16.840.1.10 #[cfg(feature = "digest")] const SHA512_OID: ObjectIdentifier = ObjectIdentifier::new_unwrap("2.16.840.1.101.3.4.2.3"); +/// Marker trait for elliptic curves intended for use with ECDSA. +pub trait EcdsaCurve: PrimeCurve { + /// Does this curve use low-S normalized signatures? + /// + /// This is typically `false`. See [`Signature::normalize_s`] for more information. + const NORMALIZE_S: bool; +} + /// Size of a fixed sized signature for the given elliptic curve. pub type SignatureSize = as Add>::Output;