Loading openssl/src/asn1.rs +19 −19 Original line number Diff line number Diff line Loading @@ -166,7 +166,7 @@ impl Asn1Type { /// [`diff`]: struct.Asn1TimeRef.html#method.diff /// [`Asn1TimeRef`]: struct.Asn1TimeRef.html #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] pub struct TimeDiff { /// Difference in days pub days: c_int, Loading Loading @@ -199,7 +199,7 @@ foreign_type_and_impl_send_sync! { impl Asn1TimeRef { /// Find difference between two times #[corresponds(ASN1_TIME_diff)] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] pub fn diff(&self, compare: &Self) -> Result<TimeDiff, ErrorStack> { let mut days = 0; let mut secs = 0; Loading @@ -215,7 +215,7 @@ impl Asn1TimeRef { /// Compare two times #[corresponds(ASN1_TIME_compare)] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] pub fn compare(&self, other: &Self) -> Result<Ordering, ErrorStack> { let d = self.diff(other)?; if d.days > 0 || d.secs > 0 { Loading @@ -229,7 +229,7 @@ impl Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq for Asn1TimeRef { fn eq(&self, other: &Asn1TimeRef) -> bool { self.diff(other) Loading @@ -238,7 +238,7 @@ impl PartialEq for Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq<Asn1Time> for Asn1TimeRef { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) Loading @@ -247,7 +247,7 @@ impl PartialEq<Asn1Time> for Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialEq<Asn1Time> for &'a Asn1TimeRef { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) Loading @@ -256,21 +256,21 @@ impl<'a> PartialEq<Asn1Time> for &'a Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd for Asn1TimeRef { fn partial_cmp(&self, other: &Asn1TimeRef) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd<Asn1Time> for Asn1TimeRef { fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialOrd<Asn1Time> for &'a Asn1TimeRef { fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering> { self.compare(other).ok() Loading Loading @@ -352,9 +352,9 @@ impl Asn1Time { /// Creates a new time corresponding to the specified X509 time string. /// /// Requires OpenSSL 1.1.1 or newer. /// Requires BoringSSL or OpenSSL 1.1.1 or newer. #[corresponds(ASN1_TIME_set_string_X509)] #[cfg(ossl111)] #[cfg(any(ossl111, boringssl))] pub fn from_str_x509(s: &str) -> Result<Asn1Time, ErrorStack> { unsafe { let s = CString::new(s).unwrap(); Loading @@ -367,7 +367,7 @@ impl Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq for Asn1Time { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) Loading @@ -376,7 +376,7 @@ impl PartialEq for Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq<Asn1TimeRef> for Asn1Time { fn eq(&self, other: &Asn1TimeRef) -> bool { self.diff(other) Loading @@ -385,7 +385,7 @@ impl PartialEq<Asn1TimeRef> for Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time { fn eq(&self, other: &&'a Asn1TimeRef) -> bool { self.diff(other) Loading @@ -394,21 +394,21 @@ impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd for Asn1Time { fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd<Asn1TimeRef> for Asn1Time { fn partial_cmp(&self, other: &Asn1TimeRef) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time { fn partial_cmp(&self, other: &&'a Asn1TimeRef) -> Option<Ordering> { self.compare(other).ok() Loading Loading @@ -809,7 +809,7 @@ mod tests { } #[test] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] fn time_eq() { let a = Asn1Time::from_str("99991231235959Z").unwrap(); let b = Asn1Time::from_str("99991231235959Z").unwrap(); Loading @@ -828,7 +828,7 @@ mod tests { } #[test] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] fn time_ord() { let a = Asn1Time::from_str("99991231235959Z").unwrap(); let b = Asn1Time::from_str("99991231235959Z").unwrap(); Loading Loading
openssl/src/asn1.rs +19 −19 Original line number Diff line number Diff line Loading @@ -166,7 +166,7 @@ impl Asn1Type { /// [`diff`]: struct.Asn1TimeRef.html#method.diff /// [`Asn1TimeRef`]: struct.Asn1TimeRef.html #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] pub struct TimeDiff { /// Difference in days pub days: c_int, Loading Loading @@ -199,7 +199,7 @@ foreign_type_and_impl_send_sync! { impl Asn1TimeRef { /// Find difference between two times #[corresponds(ASN1_TIME_diff)] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] pub fn diff(&self, compare: &Self) -> Result<TimeDiff, ErrorStack> { let mut days = 0; let mut secs = 0; Loading @@ -215,7 +215,7 @@ impl Asn1TimeRef { /// Compare two times #[corresponds(ASN1_TIME_compare)] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] pub fn compare(&self, other: &Self) -> Result<Ordering, ErrorStack> { let d = self.diff(other)?; if d.days > 0 || d.secs > 0 { Loading @@ -229,7 +229,7 @@ impl Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq for Asn1TimeRef { fn eq(&self, other: &Asn1TimeRef) -> bool { self.diff(other) Loading @@ -238,7 +238,7 @@ impl PartialEq for Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq<Asn1Time> for Asn1TimeRef { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) Loading @@ -247,7 +247,7 @@ impl PartialEq<Asn1Time> for Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialEq<Asn1Time> for &'a Asn1TimeRef { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) Loading @@ -256,21 +256,21 @@ impl<'a> PartialEq<Asn1Time> for &'a Asn1TimeRef { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd for Asn1TimeRef { fn partial_cmp(&self, other: &Asn1TimeRef) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd<Asn1Time> for Asn1TimeRef { fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialOrd<Asn1Time> for &'a Asn1TimeRef { fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering> { self.compare(other).ok() Loading Loading @@ -352,9 +352,9 @@ impl Asn1Time { /// Creates a new time corresponding to the specified X509 time string. /// /// Requires OpenSSL 1.1.1 or newer. /// Requires BoringSSL or OpenSSL 1.1.1 or newer. #[corresponds(ASN1_TIME_set_string_X509)] #[cfg(ossl111)] #[cfg(any(ossl111, boringssl))] pub fn from_str_x509(s: &str) -> Result<Asn1Time, ErrorStack> { unsafe { let s = CString::new(s).unwrap(); Loading @@ -367,7 +367,7 @@ impl Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq for Asn1Time { fn eq(&self, other: &Asn1Time) -> bool { self.diff(other) Loading @@ -376,7 +376,7 @@ impl PartialEq for Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialEq<Asn1TimeRef> for Asn1Time { fn eq(&self, other: &Asn1TimeRef) -> bool { self.diff(other) Loading @@ -385,7 +385,7 @@ impl PartialEq<Asn1TimeRef> for Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time { fn eq(&self, other: &&'a Asn1TimeRef) -> bool { self.diff(other) Loading @@ -394,21 +394,21 @@ impl<'a> PartialEq<&'a Asn1TimeRef> for Asn1Time { } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd for Asn1Time { fn partial_cmp(&self, other: &Asn1Time) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl PartialOrd<Asn1TimeRef> for Asn1Time { fn partial_cmp(&self, other: &Asn1TimeRef) -> Option<Ordering> { self.compare(other).ok() } } #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] impl<'a> PartialOrd<&'a Asn1TimeRef> for Asn1Time { fn partial_cmp(&self, other: &&'a Asn1TimeRef) -> Option<Ordering> { self.compare(other).ok() Loading Loading @@ -809,7 +809,7 @@ mod tests { } #[test] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] fn time_eq() { let a = Asn1Time::from_str("99991231235959Z").unwrap(); let b = Asn1Time::from_str("99991231235959Z").unwrap(); Loading @@ -828,7 +828,7 @@ mod tests { } #[test] #[cfg(ossl102)] #[cfg(any(ossl102, boringssl))] fn time_ord() { let a = Asn1Time::from_str("99991231235959Z").unwrap(); let b = Asn1Time::from_str("99991231235959Z").unwrap(); Loading