Skip to main content

SideChannelProtection

Struct SideChannelProtection 

Source
pub struct SideChannelProtection {
    pub timing_protection: bool,
    pub power_analysis_protection: bool,
    pub cache_attack_protection: bool,
    pub fault_injection_protection: bool,
}
Expand description

Side-channel protection configuration

Fields§

§timing_protection: bool

Enable timing attack protection

§power_analysis_protection: bool

Enable power analysis protection

§cache_attack_protection: bool

Enable cache attack protection

§fault_injection_protection: bool

Enable fault injection protection

Implementations§

Source§

impl SideChannelProtection

Source

pub fn new() -> Self

Create a new side-channel protection configuration

Source

pub fn strict() -> Self

Create a strict side-channel protection configuration

Source

pub fn permissive() -> Self

Create a permissive side-channel protection configuration

Source

pub fn secure_key_compare(&self, a: &[u8], b: &[u8]) -> bool

Protected key comparison with timing attack resistance

Source

pub fn secure_key_select(&self, choice: u8, a: &[u8], b: &[u8]) -> Vec<u8>

Protected key selection with timing attack resistance

Source

pub fn secure_memory_access<'a, T>( &self, data: &'a [T], index: usize, ) -> Option<&'a T>

Protected memory access with cache attack resistance

Source

pub fn secure_memory_access_mut<'a, T>( &self, data: &'a mut [T], index: usize, ) -> Option<&'a mut T>

Protected memory access with cache attack resistance (mutable)

Source

pub fn secure_conditional_execute<F>(&self, condition: bool, func: F) -> bool
where F: FnOnce() -> bool,

Protected conditional execution with timing attack resistance

Source

pub fn secure_conditional_execute_no_return<F>(&self, condition: bool, func: F)
where F: FnOnce(),

Protected conditional execution with timing attack resistance (no return value)

Source

pub fn secure_loop<F>(&self, iterations: usize, func: F)
where F: FnMut(usize) -> bool,

Protected loop with timing attack resistance

Source

pub fn secure_array_access<'a, T>( &self, array: &'a [T], index: usize, ) -> Option<&'a T>

Protected array access with bounds checking and timing attack resistance

Source

pub fn secure_array_access_mut<'a, T>( &self, array: &'a mut [T], index: usize, ) -> Option<&'a mut T>

Protected array access with bounds checking and timing attack resistance (mutable)

Source

pub fn secure_string_compare(&self, a: &str, b: &str) -> bool

Protected string comparison with timing attack resistance

Source

pub fn secure_integer_compare(&self, a: u64, b: u64) -> bool

Protected integer comparison with timing attack resistance

Source

pub fn secure_integer_add(&self, a: u64, b: u64) -> u64

Protected integer addition with timing attack resistance

Source

pub fn secure_integer_sub(&self, a: u64, b: u64) -> u64

Protected integer subtraction with timing attack resistance

Source

pub fn secure_integer_mul(&self, a: u64, b: u64) -> u64

Protected integer multiplication with timing attack resistance

Source

pub fn secure_integer_div(&self, a: u64, b: u64) -> u64

Protected integer division with timing attack resistance

Source

pub fn secure_integer_mod(&self, a: u64, b: u64) -> u64

Protected integer modulo with timing attack resistance

Source

pub fn secure_bitwise_and(&self, a: u64, b: u64) -> u64

Protected bitwise AND with timing attack resistance

Source

pub fn secure_bitwise_or(&self, a: u64, b: u64) -> u64

Protected bitwise OR with timing attack resistance

Source

pub fn secure_bitwise_xor(&self, a: u64, b: u64) -> u64

Protected bitwise XOR with timing attack resistance

Source

pub fn secure_bitwise_not(&self, a: u64) -> u64

Protected bitwise NOT with timing attack resistance

Source

pub fn secure_left_shift(&self, a: u64, amount: u32) -> u64

Protected left shift with timing attack resistance

Source

pub fn secure_right_shift(&self, a: u64, amount: u32) -> u64

Protected right shift with timing attack resistance

Source

pub fn secure_rotate_left(&self, a: u64, amount: u32) -> u64

Protected rotate left with timing attack resistance

Source

pub fn secure_rotate_right(&self, a: u64, amount: u32) -> u64

Protected rotate right with timing attack resistance

Source

pub fn secure_conditional_assign<T: ConditionallySelectable>( &self, condition: bool, value: &mut T, new_value: T, )

Protected conditional assignment with timing attack resistance

Source

pub fn secure_conditional_increment(&self, condition: bool, value: &mut u64)

Protected conditional increment with timing attack resistance

Source

pub fn secure_conditional_decrement(&self, condition: bool, value: &mut u64)

Protected conditional decrement with timing attack resistance

Source

pub fn secure_conditional_add( &self, condition: bool, value: &mut u64, addend: u64, )

Protected conditional add with timing attack resistance

Source

pub fn secure_conditional_subtract( &self, condition: bool, value: &mut u64, subtrahend: u64, )

Protected conditional subtract with timing attack resistance

Source

pub fn secure_conditional_multiply( &self, condition: bool, value: &mut u64, multiplier: u64, )

Protected conditional multiply with timing attack resistance

Source

pub fn secure_conditional_divide( &self, condition: bool, value: &mut u64, divisor: u64, )

Protected conditional divide with timing attack resistance

Source

pub fn secure_conditional_modulo( &self, condition: bool, value: &mut u64, divisor: u64, )

Protected conditional modulo with timing attack resistance

Source

pub fn secure_conditional_bitwise_and( &self, condition: bool, value: &mut u64, mask: u64, )

Protected conditional bitwise AND with timing attack resistance

Source

pub fn secure_conditional_bitwise_or( &self, condition: bool, value: &mut u64, mask: u64, )

Protected conditional bitwise OR with timing attack resistance

Source

pub fn secure_conditional_bitwise_xor( &self, condition: bool, value: &mut u64, mask: u64, )

Protected conditional bitwise XOR with timing attack resistance

Source

pub fn secure_conditional_bitwise_not(&self, condition: bool, value: &mut u64)

Protected conditional bitwise NOT with timing attack resistance

Source

pub fn secure_conditional_left_shift( &self, condition: bool, value: &mut u64, amount: u32, )

Protected conditional left shift with timing attack resistance

Source

pub fn secure_conditional_right_shift( &self, condition: bool, value: &mut u64, amount: u32, )

Protected conditional right shift with timing attack resistance

Source

pub fn secure_conditional_rotate_left( &self, condition: bool, value: &mut u64, amount: u32, )

Protected conditional rotate left with timing attack resistance

Source

pub fn secure_conditional_rotate_right( &self, condition: bool, value: &mut u64, amount: u32, )

Protected conditional rotate right with timing attack resistance

Trait Implementations§

Source§

impl Clone for SideChannelProtection

Source§

fn clone(&self) -> SideChannelProtection

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SideChannelProtection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SideChannelProtection

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SideChannelProtection

Source§

fn eq(&self, other: &SideChannelProtection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SideChannelProtection

Source§

impl Eq for SideChannelProtection

Source§

impl StructuralPartialEq for SideChannelProtection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more