diff --git a/elliptic-curve/src/scalar.rs b/elliptic-curve/src/scalar.rs index 78946fe02..18bb9f92b 100644 --- a/elliptic-curve/src/scalar.rs +++ b/elliptic-curve/src/scalar.rs @@ -1,6 +1,7 @@ //! Scalar types use crate::{ops::Invert, Arithmetic, Curve, ElementBytes, FromBytes}; +use core::ops::Deref; use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption}; #[cfg(feature = "rand")] @@ -64,6 +65,17 @@ where impl Copy for NonZeroScalar where C: Curve + Arithmetic {} +impl Deref for NonZeroScalar +where + C: Curve + Arithmetic, +{ + type Target = C::Scalar; + + fn deref(&self) -> &C::Scalar { + &self.scalar + } +} + impl FromBytes for NonZeroScalar where C: Curve + Arithmetic,