@@ -707,6 +707,78 @@ impl Neg for ProjectivePoint {
707
707
}
708
708
}
709
709
710
+ /// Constant representing the base field modulus
711
+ /// p = 2^{224}(2^{32} − 1) + 2^{192} + 2^{96} − 1
712
+ pub const MODULUS : U256 =
713
+ U256 :: from_be_hex ( "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff" ) ;
714
+
715
+ /// Example base field element.
716
+ #[ derive( Clone , Copy , Debug ) ]
717
+ pub struct FieldElement ( pub ( crate ) U256 ) ;
718
+
719
+ /// Internal field element representation.
720
+ #[ cfg( target_pointer_width = "32" ) ]
721
+ type FeWords = [ u32 ; 8 ] ;
722
+
723
+ /// Internal field element representation.
724
+ #[ cfg( target_pointer_width = "64" ) ]
725
+ type FeWords = [ u64 ; 4 ] ;
726
+
727
+ impl_field_element ! (
728
+ FieldElement ,
729
+ FieldBytes ,
730
+ U256 ,
731
+ MODULUS ,
732
+ FeWords ,
733
+ p256_from_montgomery,
734
+ p256_to_montgomery,
735
+ p256_add,
736
+ p256_sub,
737
+ p256_mul,
738
+ p256_opp,
739
+ p256_square
740
+ ) ;
741
+
742
+ impl FieldElement {
743
+ /// Returns the multiplicative inverse of self, if self is non-zero.
744
+ pub fn invert ( & self ) -> CtOption < Self > {
745
+ unimplemented ! ( )
746
+ }
747
+
748
+ /// Returns the square root of self mod p, or `None` if no square root exists.
749
+ pub fn sqrt ( & self ) -> CtOption < Self > {
750
+ unimplemented ! ( )
751
+ }
752
+ }
753
+
754
+ const fn p256_from_montgomery ( _: & FeWords ) -> FeWords {
755
+ unimplemented ! ( )
756
+ }
757
+
758
+ const fn p256_to_montgomery ( w : & FeWords ) -> FeWords {
759
+ * w
760
+ }
761
+
762
+ const fn p256_add ( _: & FeWords , _: & FeWords ) -> FeWords {
763
+ unimplemented ! ( )
764
+ }
765
+
766
+ const fn p256_sub ( _: & FeWords , _: & FeWords ) -> FeWords {
767
+ unimplemented ! ( )
768
+ }
769
+
770
+ const fn p256_mul ( _: & FeWords , _: & FeWords ) -> FeWords {
771
+ unimplemented ! ( )
772
+ }
773
+
774
+ const fn p256_opp ( _: & FeWords ) -> FeWords {
775
+ unimplemented ! ( )
776
+ }
777
+
778
+ const fn p256_square ( _: & FeWords ) -> FeWords {
779
+ unimplemented ! ( )
780
+ }
781
+
710
782
#[ cfg( test) ]
711
783
mod tests {
712
784
use super :: Scalar ;
0 commit comments