Expand description
Cache-timing attack mitigations.
This module provides utilities to mitigate cache-timing side-channel attacks in cryptographic implementations.
§Features
- Constant-time table lookups: Table lookups that don’t leak information via cache
- Cache-oblivious algorithms: Data access patterns independent of cache parameters
- Prefetching strategies: Reduce timing variation by prefetching data
- Constant-time selection: Select values without branching or variable memory access
§Example
use chie_crypto::cache_timing::ConstantTimeLookup;
// Create a lookup table
let table = [0u8, 1, 2, 3, 4, 5, 6, 7];
let lookup = ConstantTimeLookup::new(&table);
// Constant-time lookup (doesn't leak index via cache)
let value = lookup.get(3);
assert_eq!(value, 3);Structs§
- Byte
Lookup - Constant-time byte array lookup
- Cache
Aligned - Cache-line aligned buffer
- Constant
Time Lookup - Constant-time table lookup
Enums§
- Cache
Timing Error - Cache-timing mitigation errors
Functions§
- conditional_
swap - Constant-time conditional swap
- constant_
time_ clamp_ index - Constant-time array index clamping
- constant_
time_ memcmp - Constant-time memory comparison
- prefetch_
array ⚠ - Prefetch multiple memory locations
- prefetch_
read ⚠ - Prefetch memory locations to reduce timing variation
Type Aliases§
- Cache
Timing Result - Result type for cache-timing operations