@@ -871,7 +871,7 @@ pub trait ConstantTimeGreater {
871871///
872872///```
873873/// use subtle::{
874- /// Choice, IteratedOperation, ConstantTimeEq, IteratedEq, ConstantTimeGreater, IteratedGreater ,
874+ /// Choice, IteratedOperation, ConstantTimeEq, IteratedEq, ConstantTimeGreater, LexicographicIteratedGreater ,
875875/// };
876876///
877877/// struct S { pub len: usize, pub live: bool };
@@ -885,7 +885,7 @@ pub trait ConstantTimeGreater {
885885/// }
886886/// impl ConstantTimeGreater for S {
887887/// fn ct_gt(&self, other: &Self) -> Choice {
888- /// let mut x = IteratedGreater ::initiate();
888+ /// let mut x = LexicographicIteratedGreater ::initiate();
889889/// x.apply_gt(&(self.len as u64), &(other.len as u64));
890890/// x.apply_gt(&(self.live as u8), &(other.live as u8));
891891/// x.extract_result()
@@ -900,24 +900,24 @@ pub trait ConstantTimeGreater {
900900/// assert_eq!(1, s2.ct_gt(&s1).unwrap_u8());
901901/// assert_eq!(1, s3.ct_gt(&s2).unwrap_u8());
902902///```
903- pub struct IteratedGreater {
903+ pub struct LexicographicIteratedGreater {
904904 was_gt : Choice ,
905905 was_lt : Choice ,
906906}
907907
908- impl IteratedOperation for IteratedGreater {
908+ impl IteratedOperation for LexicographicIteratedGreater {
909909 fn initiate ( ) -> Self {
910910 Self {
911- was_gt : Choice :: from ( 0 ) ,
912- was_lt : Choice :: from ( 0 ) ,
911+ was_gt : Choice :: of_bool ( false ) ,
912+ was_lt : Choice :: of_bool ( false ) ,
913913 }
914914 }
915915 fn extract_result ( self ) -> Choice {
916916 self . was_gt . into ( )
917917 }
918918}
919919
920- impl IteratedGreater {
920+ impl LexicographicIteratedGreater {
921921 /// Unconditionally modify internal state with result of two directed "greater" comparisons.
922922 #[ inline]
923923 pub fn apply_gt < T : ConstantTimeGreater + ?Sized > ( & mut self , a : & T , b : & T ) {
@@ -1022,7 +1022,7 @@ impl<T: ConstantTimeGreater + ConstantTimeEq> ConstantTimeGreater for [T] {
10221022 }
10231023 }
10241024
1025- let mut x = IteratedGreater :: initiate ( ) ;
1025+ let mut x = LexicographicIteratedGreater :: initiate ( ) ;
10261026 for ( ai, bi) in self . iter ( ) . zip ( _rhs. iter ( ) ) {
10271027 x. apply_gt ( ai, bi) ;
10281028 }
@@ -1077,8 +1077,8 @@ pub trait ConstantTimeLess: ConstantTimeGreater {
10771077///
10781078///```
10791079/// use subtle::{
1080- /// Choice, IteratedOperation, ConstantTimeEq, IteratedEq, ConstantTimeGreater, IteratedGreater ,
1081- /// ConstantTimeLess, IteratedLess ,
1080+ /// Choice, IteratedOperation, ConstantTimeEq, IteratedEq, ConstantTimeGreater, LexicographicIteratedGreater ,
1081+ /// ConstantTimeLess, LexicographicIteratedLess ,
10821082/// };
10831083///
10841084/// struct S { pub len: usize, pub live: bool };
@@ -1092,15 +1092,15 @@ pub trait ConstantTimeLess: ConstantTimeGreater {
10921092/// }
10931093/// impl ConstantTimeGreater for S {
10941094/// fn ct_gt(&self, other: &Self) -> Choice {
1095- /// let mut x = IteratedGreater ::initiate();
1095+ /// let mut x = LexicographicIteratedGreater ::initiate();
10961096/// x.apply_gt(&(self.len as u64), &(other.len as u64));
10971097/// x.apply_gt(&(self.live as u8), &(other.live as u8));
10981098/// x.extract_result()
10991099/// }
11001100/// }
11011101/// impl ConstantTimeLess for S {
11021102/// fn ct_lt(&self, other: &Self) -> Choice {
1103- /// let mut x = IteratedLess ::initiate();
1103+ /// let mut x = LexicographicIteratedLess ::initiate();
11041104/// x.apply_lt(&(self.len as u64), &(other.len as u64));
11051105/// x.apply_lt(&(self.live as u8), &(other.live as u8));
11061106/// x.extract_result()
@@ -1115,24 +1115,24 @@ pub trait ConstantTimeLess: ConstantTimeGreater {
11151115/// assert_eq!(1, s2.ct_gt(&s1).unwrap_u8());
11161116/// assert_eq!(1, s2.ct_lt(&s3).unwrap_u8());
11171117///```
1118- pub struct IteratedLess {
1118+ pub struct LexicographicIteratedLess {
11191119 was_lt : Choice ,
11201120 was_gt : Choice ,
11211121}
11221122
1123- impl IteratedOperation for IteratedLess {
1123+ impl IteratedOperation for LexicographicIteratedLess {
11241124 fn initiate ( ) -> Self {
11251125 Self {
1126- was_lt : Choice :: from ( 0 ) ,
1127- was_gt : Choice :: from ( 0 ) ,
1126+ was_lt : Choice :: of_bool ( false ) ,
1127+ was_gt : Choice :: of_bool ( false ) ,
11281128 }
11291129 }
11301130 fn extract_result ( self ) -> Choice {
11311131 self . was_lt . into ( )
11321132 }
11331133}
11341134
1135- impl IteratedLess {
1135+ impl LexicographicIteratedLess {
11361136 /// Unconditionally modify internal state with result of two directed "less" comparisons.
11371137 #[ inline]
11381138 pub fn apply_lt < T : ConstantTimeLess + ?Sized > ( & mut self , a : & T , b : & T ) {
0 commit comments