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 normalizationpower_protection: Protects against power analysis via consumption balancingem_protection: Protects against electromagnetic analysis via signal balancingdummy_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: boolEnable 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: boolEnable 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: boolEnable electromagnetic countermeasures.
When enabled, operations are balanced to prevent electromagnetic analysis attacks that analyze electromagnetic emissions from the processor.
dummy_operations: usizeNumber 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
impl Clone for HardwareSecurityConfig
Source§fn clone(&self) -> HardwareSecurityConfig
fn clone(&self) -> HardwareSecurityConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HardwareSecurityConfig
impl Debug for HardwareSecurityConfig
Source§impl Default for HardwareSecurityConfig
impl Default for HardwareSecurityConfig
Source§fn default() -> Self
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 environmentspower_protection: true- Important for embedded and IoT devicesem_protection: false- Disabled due to performance cost; enable for high-securitydummy_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()
};