Commit da2333a 1 parent 2bdca99 commit da2333a Copy full SHA for da2333a
File tree 3 files changed +510
-0
lines changed
3 files changed +510
-0
lines changed Original file line number Diff line number Diff line change @@ -707,6 +707,73 @@ 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
+ type FeWords = [ u64 ; 4 ] ;
721
+
722
+ impl_field_element ! (
723
+ FieldElement ,
724
+ FieldBytes ,
725
+ U256 ,
726
+ MODULUS ,
727
+ FeWords ,
728
+ p256_from_montgomery,
729
+ p256_to_montgomery,
730
+ p256_add,
731
+ p256_sub,
732
+ p256_mul,
733
+ p256_opp,
734
+ p256_square
735
+ ) ;
736
+
737
+ impl FieldElement {
738
+ /// Returns the multiplicative inverse of self, if self is non-zero.
739
+ pub fn invert ( & self ) -> CtOption < Self > {
740
+ unimplemented ! ( )
741
+ }
742
+
743
+ /// Returns the square root of self mod p, or `None` if no square root exists.
744
+ pub fn sqrt ( & self ) -> CtOption < Self > {
745
+ unimplemented ! ( )
746
+ }
747
+ }
748
+
749
+ const fn p256_from_montgomery ( _: & FeWords ) -> FeWords {
750
+ unimplemented ! ( )
751
+ }
752
+
753
+ const fn p256_to_montgomery ( w : & FeWords ) -> FeWords {
754
+ * w
755
+ }
756
+
757
+ const fn p256_add ( _: & FeWords , _: & FeWords ) -> FeWords {
758
+ unimplemented ! ( )
759
+ }
760
+
761
+ const fn p256_sub ( _: & FeWords , _: & FeWords ) -> FeWords {
762
+ unimplemented ! ( )
763
+ }
764
+
765
+ const fn p256_mul ( _: & FeWords , _: & FeWords ) -> FeWords {
766
+ unimplemented ! ( )
767
+ }
768
+
769
+ const fn p256_opp ( _: & FeWords ) -> FeWords {
770
+ unimplemented ! ( )
771
+ }
772
+
773
+ const fn p256_square ( _: & FeWords ) -> FeWords {
774
+ unimplemented ! ( )
775
+ }
776
+
710
777
#[ cfg( test) ]
711
778
mod tests {
712
779
use super :: Scalar ;
Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ pub mod ops;
71
71
#[ cfg( feature = "sec1" ) ]
72
72
pub mod sec1;
73
73
74
+ #[ macro_use]
75
+ mod macros;
76
+
74
77
mod error;
75
78
mod point;
76
79
mod scalar;
You can’t perform that action at this time.
0 commit comments