Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions ed448-goldilocks/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ mod element;
mod scalar;

pub(crate) use element::*;
pub(crate) use scalar::CurveWithScalar;
pub use scalar::{
MODULUS_LIMBS, NZ_ORDER, ORDER, Scalar, ScalarBytes, WIDE_ORDER, WideScalarBytes,
CurveWithScalar, MODULUS_LIMBS, NZ_ORDER, ORDER, Scalar, ScalarBytes, WIDE_ORDER,
WideScalarBytes,
};

use crate::curve::twedwards::extended::ExtendedPoint as TwExtendedPoint;
Expand Down
5 changes: 5 additions & 0 deletions ed448-goldilocks/src/field/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ pub type ScalarBytes<C> = Array<u8, <C as CurveWithScalar>::ReprSize>;
/// The number of bytes needed to represent the safely create a scalar from a random bytes
pub type WideScalarBytes<C> = Array<u8, Prod<<C as CurveWithScalar>::ReprSize, U2>>;

/// Representation of a curve scalar for either Ed448 or Decaf448
pub trait CurveWithScalar: 'static + CurveArithmetic + Send + Sync {
/// The size of the scalar for the given curve
type ReprSize: ArraySize<ArrayType<u8>: Copy> + Mul<U2, Output: ArraySize<ArrayType<u8>: Copy>>;

/// Create a scalar from the wide representation
fn from_bytes_mod_order_wide(input: &WideScalarBytes<Self>) -> Scalar<Self>;

/// Create a scalar from its serialization
fn from_canonical_bytes(bytes: &ScalarBytes<Self>) -> CtOption<Scalar<Self>>;

/// Return the serialization for a given scalar
fn to_repr(scalar: &Scalar<Self>) -> ScalarBytes<Self>;
}

Expand Down
2 changes: 1 addition & 1 deletion ed448-goldilocks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub use edwards::{
AffinePoint, CompressedEdwardsY, EdwardsPoint, EdwardsScalar, EdwardsScalarBytes,
WideEdwardsScalarBytes,
};
pub use field::{MODULUS_LIMBS, ORDER, Scalar, WIDE_ORDER};
pub use field::{CurveWithScalar, MODULUS_LIMBS, ORDER, Scalar, WIDE_ORDER};
pub use montgomery::{MontgomeryPoint, ProjectiveMontgomeryPoint};
pub use ristretto::{CompressedRistretto, RistrettoPoint};
#[cfg(feature = "signing")]
Expand Down