Trait timing_shield::TpEq
[−]
[src]
pub trait TpEq<Rhs: ?Sized = Self> where
Rhs: , { fn tp_eq(&self, other: &Rhs) -> TpBool; fn tp_not_eq(&self, other: &Rhs) -> TpBool; }
A trait for performing equality tests on types with timing leak protection.
Important: implementations of this trait are only required to protect inputs that are already a
timing-protected type. For example, a.tp_eq(&b)
is allowed to leak a
if a
is a u32
,
instead of a timing-protected type like TpU32
.
Ideally, this trait will be removed in the future if/when Rust allows overloading of the ==
and !=
operators.
Required Methods
fn tp_eq(&self, other: &Rhs) -> TpBool
Compare self
with other
for equality without leaking the result.
Important: if either input is not a timing-protected type, this operation might leak the
value of that type. To prevent timing leaks, protect values before performing any operations
on them.
Equivalent to !a.tp_not_eq(&other)
fn tp_not_eq(&self, other: &Rhs) -> TpBool
Compare self
with other
for inequality without leaking the result.
Important: if either input is not a timing-protected type, this operation might leak the
value of that type. To prevent timing leaks, protect values before performing any operations
on them.
Equivalent to !a.tp_eq(&other)
Implementors
impl<T> TpEq for [T] where
T: TpEq,impl<T> TpEq for Vec<T> where
T: TpEq,impl TpEq<TpU8> for TpU8
impl TpEq<TpU8> for u8
impl TpEq<u8> for TpU8
impl TpEq for [TpU8]
impl TpEq<TpU16> for TpU16
impl TpEq<TpU16> for u16
impl TpEq<u16> for TpU16
impl TpEq for [TpU16]
impl TpEq<TpU32> for TpU32
impl TpEq<TpU32> for u32
impl TpEq<u32> for TpU32
impl TpEq for [TpU32]
impl TpEq<TpU64> for TpU64
impl TpEq<TpU64> for u64
impl TpEq<u64> for TpU64
impl TpEq for [TpU64]
impl TpEq<TpI8> for TpI8
impl TpEq<TpI8> for i8
impl TpEq<i8> for TpI8
impl TpEq for [TpI8]
impl TpEq<TpI16> for TpI16
impl TpEq<TpI16> for i16
impl TpEq<i16> for TpI16
impl TpEq for [TpI16]
impl TpEq<TpI32> for TpI32
impl TpEq<TpI32> for i32
impl TpEq<i32> for TpI32
impl TpEq for [TpI32]
impl TpEq<TpI64> for TpI64
impl TpEq<TpI64> for i64
impl TpEq<i64> for TpI64
impl TpEq for [TpI64]
impl TpEq<TpBool> for TpBool
impl TpEq<TpBool> for bool
impl TpEq<bool> for TpBool