The RP2040 micro-controller features dual ARM Cortex-M0+ cores. In Q-Safe, we exploit this architecture to implement physical security boundaries inside a single package: Core 0 runs the main gateway logic (handling networking, I/O, and message passing), while Core 1 acts as a dedicated cryptographic coprocessor.

Core Isolation and Inter-Core SIO

Key material and decryption states are kept entirely in Core 1's memory space. Core 0 cannot read Core 1's registers or private memory region directly during execution. To execute cryptographic operations (such as ML-KEM encapsulation or decapsulation), Core 0 sends requests to Core 1 via the hardware SIO (Single-cycle IO) FIFO block.

// Core 0: request decapsulation
sio_fifo_write(CMD_DECAPSULATE);
sio_fifo_write(ciphertext_ptr);

// Core 1: wait and execute
let cmd = sio_fifo_read();
if cmd == CMD_DECAPSULATE {
    let ct = read_ciphertext(sio_fifo_read());
    let shared_secret = ml_kem_decapsulate(ct, &private_key);
    sio_fifo_write(shared_secret_ptr);
}

The FIFO has a depth of 8 slots and is fully synchronized in hardware, generating interrupts when data is available. This guarantees lock-free, zero-contention communication. Because all secret keys live strictly within Core 1's stack and are zeroed immediately after use, even a compromised Core 0 gateway cannot leak the private keys — it can only request standard operations, which are hardware rate-limited and audit-logged by Core 1.