Module secure_memory

Module secure_memory 

Source
Expand description

Secure memory management for cryptographic operations

§Secure Memory Management for Cryptographic Operations

This module provides memory-protected storage for cryptographic keys and sensitive data. All allocations are automatically zeroized on drop and protected against memory dumps.

§Security Features

  • Automatic zeroization on drop (prevents key recovery)
  • Memory locking to prevent swapping to disk
  • Protected allocation regions
  • Constant-time comparison operations
  • Guard pages to detect buffer overflows

§Performance Features

  • Pool-based allocation to reduce fragmentation
  • Batch allocation for multiple keys
  • Efficient reuse of protected memory regions
  • Minimal overhead for secure operations

Structs§

PoolStats
Statistics for secure memory pool
SecureMemory
Secure memory container that automatically zeroizes on drop
SecureMemoryPool
Pool for managing secure memory allocations
SecureString
Secure string with automatic zeroization
SecureVec
Secure vector with automatic zeroization

Enums§

SecureMemoryError
Error types for secure memory operations

Functions§

allocate_secure
Convenience function to allocate secure memory from global pool
global_secure_pool
Get the global secure memory pool
secure_string_with_capacity
Convenience function to create a secure string from global pool
secure_vec_with_capacity
Convenience function to create a secure vector from global pool