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 |
|---|---|---|
|
yes |
Use the platform malloc/free. Init is a no-op. |
|
no |
TLSF allocator over a caller-provided RAM block ( |
|
no |
Implies |
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)
#include "krypteia.h"
static uint8_t heap[8192];
int main(void) {
krypteia_init(heap, sizeof(heap));
// ... use arcana or quantica APIs ...
}
License
Apache-2.0