krypteia-memory — TLSF allocator for the krypteia workspace
Memory allocator for the krypteia cryptographic workspace, configurable between two backends:
os-alloc(default) — forwardalloc/deallocto the platformmalloc/free. Initialisation is a no-op. Suitable for hosted targets (Linux, macOS, Windows) where the C runtime is already there.self-alloc— a TLSF (Two-Level Segregated Fit) allocator running over a caller- provided RAM block. Single-init, nostd, noOsRng, predictable O(1)alloc/dealloc. Suitable for bare-metal targets (STM32 M0 / M4 / M33, ESP32-C3 RISC-V) where no OS heap exists and crypto allocations need to come from a known, bounded region.
Cargo features
| Feature | Default | Effect |
|---|---|---|
os-alloc |
yes | Use the platform malloc/free. Init is a no-op. |
self-alloc |
no | TLSF allocator over a caller-provided RAM block (no_std). |
global-alloc |
no | Implies self-alloc and registers as #[global_allocator] for FFI consumers (arcana_ffi, quantica_ffi). |
Enable exactly one allocator backend per build. os-alloc
is the default; self-alloc and global-alloc are mutually
exclusive with it.
Usage from C (bare-metal)
static uint8_t heap;
int
License
Apache-2.0