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

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)

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