Hello,
I have developed an implementation of ML-KEM, the standardized post-quantum key-encapsulation mechanism defined in FIPS 203. It uses an architecture intended to make the algorithm practical in constrained systems and RTOS environments.
The implementation is written in portable C11. Its core is independent of a particular operating system and relies only on the C standard library or equivalent facilities supplied by an environment-specific port. Thin ports are currently provided for Linux userspace, the Linux kernel, and FreeRTOS.
The main architectural properties are:
-
Small and predictable stack usage: slightly above 1 KiB in the measured configurations, although the exact value depends on the compiler, target architecture, and build configuration.
-
No dynamic memory allocation on the encapsulation or decapsulation hot paths.
-
Explicit memory ownership and lifecycle management. Working memory is provisioned when the relevant key context is created and is retained, reused, wiped, and released together with that context.
-
A reusable pool of decapsulation contexts. The caller selects the maximum number of simultaneous decapsulation operations when creating the secret-key context.
-
Controllable memory/throughput trade-off. Increasing the number of pool slots permits more concurrent decapsulations, while reducing it lowers the persistent memory requirement.
-
Concurrency without increasing per-operation stack usage or requesting additional memory from the environment during decapsulation.
The purpose of the pool is to combine low stack usage with controlled parallelism. Instead of allocating a large temporary workspace for every operation, each decapsulation temporarily acquires a preallocated slot. Therefore, the application can choose its concurrency limit according to the available memory and expected workload while keeping memory consumption bounded throughout the lifetime of the key.
I have also created and tested a concrete FreeRTOS port using the CORTEX_MPS2_QEMU_IAR_GCC demonstration project. The test configuration emulated an Arm MPS2 AN385 platform with a Cortex-M3 processor using QEMU; testing was not performed on physical hardware.
Repository:
Current release (v1.4.0):
I would be interested in feedback from FreeRTOS and embedded developers on the following questions:
-
Is this memory model useful for real RTOS or constrained-device workloads?
-
Is selecting the decapsulation concurrency limit at key creation a reasonable interface for such environments?
-
Are there other FreeRTOS-specific integration concerns or target configurations that would be valuable to test?