pub fn secure_alloc(size: usize) -> Option<*mut u8>Expand description
Secure memory allocation with enhanced security features
Allocates memory securely with proper alignment, zeroing, and protection. Implements secure memory allocation best practices including:
- Proper alignment for security-sensitive data
- Memory zeroing to prevent data leakage
- Compiler barriers to prevent optimization
- Memory protection where available
§Arguments
size- Size of memory to allocatealignment- Memory alignment (defaults to cache line size for security)
§Returns
Some(ptr)if allocation succeeds,Noneotherwise
§Security
This function allocates memory securely and zeros it to prevent data leakage from previous allocations. Uses cache-line alignment to prevent side-channel attacks through cache timing.