Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions elliptic-curve/src/scalar.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down Expand Up @@ -64,6 +65,17 @@ where

impl<C> Copy for NonZeroScalar<C> where C: Curve + Arithmetic {}

impl<C> Deref for NonZeroScalar<C>
where
C: Curve + Arithmetic,
{
type Target = C::Scalar;

fn deref(&self) -> &C::Scalar {
&self.scalar
}
}

impl<C> FromBytes for NonZeroScalar<C>
where
C: Curve + Arithmetic,
Expand Down