Expand description
Shared memory allocator for the krypteia cryptographic workspace.
This crate provides the workspace allocator — a TLSF heap over a
caller-provided RAM block, or a thin shim over the platform
malloc/free. On targets without an OS heap it is registered as
the #[global_allocator] (via the global-alloc feature) by
arcana_ffi and tessera_ffi. quantica_ffi does not depend on
this crate — the post-quantum FFI performs no heap allocation of
its own.
§Feature flags
| Feature | Behaviour |
|---|---|
os-alloc | The platform provides malloc/free. Init is a no-op. Default. |
self-alloc | TLSF allocator over a caller-provided RAM block (no_std). |
global-alloc | Implies self-alloc and registers it as #[global_allocator] for the FFI crates. |
Enable exactly one allocator backend. os-alloc (the default)
and self-alloc are mutually exclusive (enforced by a
compile_error! below); global-alloc is a superset of
self-alloc.
§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 …
}Structs§
- MemStats
- Memory allocation statistics.
Functions§
- krypteia_
init ⚠ - No-op initialiser for
os-allocmode (the platform heap needs no setup). - memory_
stats - Returns zeroed stats in
os-allocmode (the OS tracks its own heap; we have no visibility).