HardwareSecurityConfig

Struct HardwareSecurityConfig 

Source
pub struct HardwareSecurityConfig {
    pub cache_protection: bool,
    pub power_protection: bool,
    pub em_protection: bool,
    pub dummy_operations: usize,
}
Expand description

Configuration for hardware-level side-channel countermeasures.

This struct allows fine-grained control over which hardware security countermeasures are applied. Different attack vectors may require different combinations of protections, and this configuration enables performance tuning by selectively enabling countermeasures.

§Fields

  • cache_protection: Protects against cache timing attacks via memory access normalization
  • power_protection: Protects against power analysis via consumption balancing
  • em_protection: Protects against electromagnetic analysis via signal balancing
  • dummy_operations: Number of additional operations for timing/power balancing

§Security vs Performance Trade-offs

  • Cache Protection: Moderate performance impact, essential for shared systems
  • Power Protection: Low performance impact, critical for embedded systems
  • EM Protection: Higher performance impact, mainly for high-security environments

§Default Configuration

The default configuration enables cache and power protection but disables EM protection due to its higher performance cost. EM protection can be enabled when operating in high-threat environments.

§Usage

use clock_curve_math::ct::hardware::HardwareSecurityConfig;

let config = HardwareSecurityConfig {
    cache_protection: true,
    power_protection: true,
    em_protection: false, // Too expensive for most applications
    dummy_operations: 5,  // Minimal balancing operations
};

Fields§

§cache_protection: bool

Enable cache timing countermeasures.

When enabled, memory access patterns are normalized and cache lines are flushed before/after operations to prevent cache timing attacks.

§power_protection: bool

Enable power analysis countermeasures.

When enabled, dummy operations are performed to balance power consumption and prevent power analysis attacks that analyze current draw patterns.

§em_protection: bool

Enable electromagnetic countermeasures.

When enabled, operations are balanced to prevent electromagnetic analysis attacks that analyze electromagnetic emissions from the processor.

§dummy_operations: usize

Number of dummy operations for balancing.

Controls how many additional dummy operations are performed for timing and power balancing. Higher values provide better protection but impact performance. Typical values range from 5-20 depending on security needs.

Trait Implementations§

Source§

impl Clone for HardwareSecurityConfig

Source§

fn clone(&self) -> HardwareSecurityConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for HardwareSecurityConfig

Source§

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

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

impl Default for HardwareSecurityConfig

Source§

fn default() -> Self

Creates a default hardware security configuration.

The default configuration provides a good balance between security and performance for most cryptographic applications. It enables the most critical countermeasures while keeping performance impact reasonable.

§Default Settings
  • cache_protection: true - Essential for shared computing environments
  • power_protection: true - Important for embedded and IoT devices
  • em_protection: false - Disabled due to performance cost; enable for high-security
  • dummy_operations: 10 - Moderate balancing operations
§Usage
use clock_curve_math::ct::hardware::HardwareSecurityConfig;

// Use default configuration (recommended for most applications)
let config = HardwareSecurityConfig::default();

// Or customize specific settings
let custom_config = HardwareSecurityConfig {
    em_protection: true, // Enable for high-security environments
    ..HardwareSecurityConfig::default()
};

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> 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.