oa::core::memory

Module published by the oa::core module.

MdRust public API

Public Functions

pub fn copy(destination: &mut [u8], source: &[u8]) -> Result<()>
pub fn copy_streaming(destination: &mut [u8], source: &[u8]) -> Result<()>
pub fn equal(left: &[u8], right: &[u8]) -> bool
pub fn equal_constant_time(left: &[u8], right: &[u8]) -> bool
pub fn zero_secure(bytes: &mut [u8])

Function Documentation

pub fn copy(destination: &mut [u8], source: &[u8]) -> Result<()>
Copy one complete byte slice into another non-overlapping slice. Small dynamic copies use fixed compiler-known blocks. Qualified medium copies use cached SIMD stores; bulk copies retain the platform implementation. Errors Returns an error when the slices have different lengths.
pub fn copy_streaming(destination: &mut [u8], source: &[u8]) -> Result<()>
Copy one complete byte slice using an explicit one-way streaming policy. The destination must not be consumed by the CPU soon. On a qualified x86-64 target, medium-sized copies use non-temporal stores. Other sizes use cached stores, preferring the platform routine above the small-copy range. Errors Returns an error when the slices have different lengths.
pub fn equal( left: &[u8], right: &[u8] ) -> bool
Compare two byte slices with ordinary early-exit semantics.
pub fn equal_constant_time( left: &[u8], right: &[u8] ) -> bool
Compare equal-length byte slices without content-dependent early exit. Different public lengths may return immediately. For equal lengths, every byte is visited before the result is produced. This is a bounded primitive, not a claim of system-wide constant-time behavior on every platform.
pub fn zero_secure( bytes: &mut [u8] )
Erase every byte through observable stores. Unlike ordinary filling or zeroing, these writes are retained even when the compiler can prove the destination is not subsequently read. This does not erase copies held elsewhere or guarantee removal from caches or swap.