Trait timing_shield::TpOrd
[−]
[src]
pub trait TpOrd<Rhs: ?Sized = Self> where
Rhs: , { fn tp_lt(&self, other: &Rhs) -> TpBool; fn tp_lt_eq(&self, other: &Rhs) -> TpBool; fn tp_gt(&self, other: &Rhs) -> TpBool; fn tp_gt_eq(&self, other: &Rhs) -> TpBool; }
A trait for performing comparisons 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_lt(&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_lt(&self, other: &Rhs) -> TpBool
Compute self < other
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.
fn tp_lt_eq(&self, other: &Rhs) -> TpBool
Compute self <= other
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.
fn tp_gt(&self, other: &Rhs) -> TpBool
Compute self > other
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.
fn tp_gt_eq(&self, other: &Rhs) -> TpBool
Compute self >= other
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.
Implementors
impl TpOrd<TpU8> for TpU8
impl TpOrd<TpU8> for u8
impl TpOrd<u8> for TpU8
impl TpOrd<TpU16> for TpU16
impl TpOrd<TpU16> for u16
impl TpOrd<u16> for TpU16
impl TpOrd<TpU32> for TpU32
impl TpOrd<TpU32> for u32
impl TpOrd<u32> for TpU32
impl TpOrd<TpU64> for TpU64
impl TpOrd<TpU64> for u64
impl TpOrd<u64> for TpU64
impl TpOrd<TpI8> for TpI8
impl TpOrd<TpI8> for i8
impl TpOrd<i8> for TpI8
impl TpOrd<TpI16> for TpI16
impl TpOrd<TpI16> for i16
impl TpOrd<i16> for TpI16
impl TpOrd<TpI32> for TpI32
impl TpOrd<TpI32> for i32
impl TpOrd<i32> for TpI32
impl TpOrd<TpI64> for TpI64
impl TpOrd<TpI64> for i64
impl TpOrd<i64> for TpI64