Skip to content

Commit 8b9ed18

Browse files
committed
ed448-goldilocks: expose CurveWithScalar
1 parent 425e867 commit 8b9ed18

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

ed448-goldilocks/src/field.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ mod element;
22
mod scalar;
33

44
pub(crate) use element::*;
5-
pub(crate) use scalar::CurveWithScalar;
65
pub use scalar::{
7-
MODULUS_LIMBS, NZ_ORDER, ORDER, Scalar, ScalarBytes, WIDE_ORDER, WideScalarBytes,
6+
CurveWithScalar, MODULUS_LIMBS, NZ_ORDER, ORDER, Scalar, ScalarBytes, WIDE_ORDER,
7+
WideScalarBytes,
88
};
99

1010
use crate::curve::twedwards::extended::ExtendedPoint as TwExtendedPoint;

ed448-goldilocks/src/field/scalar.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@ pub type ScalarBytes<C> = Array<u8, <C as CurveWithScalar>::ReprSize>;
4141
/// The number of bytes needed to represent the safely create a scalar from a random bytes
4242
pub type WideScalarBytes<C> = Array<u8, Prod<<C as CurveWithScalar>::ReprSize, U2>>;
4343

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

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

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

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

ed448-goldilocks/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ pub use edwards::{
6060
AffinePoint, CompressedEdwardsY, EdwardsPoint, EdwardsScalar, EdwardsScalarBytes,
6161
WideEdwardsScalarBytes,
6262
};
63-
pub use field::{MODULUS_LIMBS, ORDER, Scalar, WIDE_ORDER};
6463
pub use montgomery::{MontgomeryPoint, ProjectiveMontgomeryPoint};
64+
pub use field::{CurveWithScalar, MODULUS_LIMBS, ORDER, Scalar, WIDE_ORDER};
6565
pub use ristretto::{CompressedRistretto, RistrettoPoint};
6666
#[cfg(feature = "signing")]
6767
pub use sign::*;

0 commit comments

Comments
 (0)