P0·Foundations P1·Digital HW P2·PQC Theory P3·Crypto HW P4·Security HW P5·Perf Arch P6·PCB P7·Firmware P8·Integration P9·Grand Build
Dart+Rust+ Verilog
PQForge · From Learner to HSM Designer · Dart + Rust Edition

Build thefastest PQC HSMon earth.

A 15-month mastery course — digital logic → FIPS 140-3 Level 4 post-quantum hardware. Implemented strictly in Dart and Rust, with Verilog/SystemVerilog for hardware description.

◆ Dart — algorithms, tooling, testing
⬡ Rust — firmware, HSM drivers, FFI
◈ Verilog — RTL, FPGA accelerators
ML-KEM
0
M+ key gen / sec
ML-DSA
0
M+ sig gen / sec
SLH-DSA
0
M+ sig gen / sec
FNDSA
0
M+ key gen / sec
TOTAL TARGET
0
M+ ops / sec · FIPS 140-3 Level 4
⚡ Live Throughput Calculator ◆ Dart + ⬡ Rust Edition
Tiles allocated 128
Clock frequency 500 MHz
Pipeline depth 3 stages
Masking overhead 1× (order)
ML-KEM
12.8M
ML-DSA
9.7M
SLH-DSA
5.1M
FNDSA
8.3M
TOTAL OPS/SEC 35.9M
128 tiles · 500 MHz · depth-3 pipeline · 1st-order masking
PHASE 0
Mathematical & Programming Foundations
The bedrock everything is built on. Do not skip this.
⏱ Weeks 1–4 ◆ Dart ⬡ Rust SageMath via FFI
Mathematics you must own
Linear Algebra
  • Vectors, matrices, dot products
  • Modular arithmetic: Z_q arithmeticCentral to every PQC algorithm
  • Polynomial rings: Z_q[x]/(x^n + 1)The ring used in ML-KEM, ML-DSA, FALCON
  • Lattices: basis, shortest vector, duality
  • LWE problem: s·A + e ≡ b (mod q)The hard problem ML-KEM relies on
Number Theory
  • Modular inverses (extended Euclidean)
  • Chinese Remainder Theorem
  • Primitive roots and cyclic groups
  • NTT primes: q = 3329 (Kyber), q = 8380417 (Dilithium)Must satisfy q ≡ 1 mod 2n for NTT to work
  • Hash functions as random oracles
Programming Prerequisites
  • Dart — your primary scripting, algorithm prototyping, and test harness languagedart:typed_data for byte-level buffer manipulation; dart:ffi for native calls
  • Rust — constant-time crypto primitives, firmware, PKCS#11 driverNo secret-dependent branches. Rust borrow checker enforces no aliasing of key material
  • SageMath via Dart FFI — polynomial ring arithmetic, lattice toolssage: R.<x> = ZZ['x']; R.quotient(x^256 + 1)
  • Bit manipulation: shifts, masks, XOR, rotate — learn in both Dart and Rust
  • Constant-time programmingNo secret-dependent branches or memory access — Rust's type system helps enforce this
Dart NTT implementation — your first proof of understanding
dart
/// NTT over Z_3329 in Dart — the computational core of ML-KEM and ML-DSA
import 'dart:typed_data';

const int q = 3329 // ML-KEM modulus
const int omega = 17 // primitive 256th root of unity mod 3329
const int n = 256 // polynomial degree

int modpow(int base, int exp, int mod) {
int result = 1;
base %= mod;
while (exp > 0) {
if (exp & 1 == 1) result = result * base % mod;
exp >>= 1;
base = base * base % mod;
}
return result;
}

/// Cooley-Tukey NTT butterfly — O(n log n)
Int32List ntt(Int32List f) {
final res = Int32List.fromList(f);
for (var len = 1; len < n; len <<= 1) {
final w = modpow(omega, n ~/ (2 * len), q);
for (var i = 0; i < n; i += 2 * len) {
int wn = 1;
for (var j = 0; j < len; j++) {
final u = res[i + j];
final v = res[i + j + len] * wn % q;
res[i + j] = (u + v) % q;
res[i + j + len] = (u - v + q) % q;
wn = wn * w % q;
}
}
}
return res;
}

/// Pointwise multiply in NTT domain — O(n)
Int32List polyMulNTT(Int32List a, Int32List b) {
final hatA = ntt(a), hatB = ntt(b);
return Int32List.fromList(
List.generate(n, (i) => hatA[i] * hatB[i] % q)
);
}
Resources
MILESTONE PROJECT · P0
Implement NTT in Dart, verified against NIST ML-KEM-512 KATs

This single algorithm is the computational core of 3 of your 4 target algorithms. Implement it in Dart with full test coverage against NIST Known Answer Test vectors.

  • Step 1 Find primitive 256th root of unity ω mod 3329 in Dart
  • Step 2 Implement bit-reversal permutation
  • Step 3 Cooley-Tukey butterfly iteration
  • Step 4 Inverse NTT + verify a == intt(ntt(a))
  • Step 5 Port to Rust for constant-time version
  • Step 6 Verify both against CRYSTALS-Kyber reference KATs
PHASE 1
Digital Design & HDL
Logic design, Verilog/SystemVerilog, and your first FPGA.
⏱ Months 1–3 FPGA: Xilinx Artix-7 (Arty A7) Vivado · GTKWave · Icarus
Combinational Logic
  • Boolean algebra, truth tables, K-maps
  • Multiplexers, adders, carry-lookahead
  • Barrett & Montgomery multipliersYou'll reuse these constantly for modular arithmetic
  • Timing analysis: critical path, slack
Sequential Logic
  • D flip-flops, registers, shift registers
  • Finite state machines (Mealy/Moore)
  • Pipelines: stages, hazards, stall/flush
  • Deep pipeline design for throughputGoal: 1 result per clock cycle
  • Clock domain crossing (CDC)
Verilog / SystemVerilog
  • Module hierarchy, ports, wire vs reg
  • Always blocks, assign, generate
  • Parameterized modulesOne multiplier for any bit width
  • Testbench writing, $display, $monitor
  • Avoid latches — always synchronous reset
FPGA Fundamentals
  • CLB, LUT, DSP48, BRAM architecture
  • Vivado: synthesis, implementation, bitstream
  • Constraints: .xdc, I/O, timing
  • ILA for hardware debugging
  • Resource reportsLUT%, DSP%, BRAM% — critical for dense designs
Montgomery multiplier in Verilog + verified by Rust testbench
verilog
// Parameterized Montgomery multiplier — workhorse of modular crypto
module montgomery_mult #(
parameter W = 12, // bit width
parameter N = 3329, // modulus (ML-KEM)
parameter R = 4096 // R = 2^12 > N
) (
input clk, rst,
input [W-1:0] a, b,
output reg [W-1:0] result,
output reg valid
);
// Computes a*b*R^-1 mod N in constant time — no data-dependent branching
Rust verification harness for RTL output
rust
/// Rust golden-reference for Montgomery multiply verification
const Q: u32 = 3329;
const Q_INV: u32 = 3327; // Q^(-1) mod 2^12
const R: u32 = 4096; // 2^12

#[inline(always)]
pub fn montgomery_reduce(a: i64) -> i16 {
let t = (a as i32).wrapping_mul(Q_INV as i32) as i64;
let u = (a - t * Q as i64) >> 16;
u as i16 // result in (-Q/2, Q/2] — constant time guaranteed
}

#[cfg(test)]
mod tests {
use super::*;
#[test]
fn verify_against_rtl_output() {
// Load Verilog simulation output, verify every result
let rtl_results = std::fs::read("sim_output.bin").unwrap();
// Compare byte-for-byte — any mismatch = RTL bug
}
}
MILESTONE PROJECT · P1
Arty A7 UART → Montgomery Multiplier, verified by Dart + Rust harness
  • Week 1–2 Blinky → 7-seg → UART echo in Verilog
  • Week 3–4 Barrett reduction in Verilog with Dart test harness
  • Week 5–6 Parameterized Montgomery multiplier + Rust testbench
  • Week 7–8 Verify 10k multiply-mod-3329 results match Dart reference 1:1
Resources
PHASE 2
Post-Quantum Cryptography — Deep Theory
You can't accelerate what you don't understand. Know every operation cold.
⏱ Months 2–4 (parallel with P1) NIST FIPS 203/204/205/206 ◆ Dart reference impl
Algorithm deep dives
ML-KEM
FIPS 203 · Kyber
Hard problemModule-LWE
RingZ_3329[x]/(x^256+1)
Core opNTT polynomial mul
Variants512 / 768 / 1024
BottleneckMatVec × NTT
HW target<100 cycles / encap
ML-DSA
FIPS 204 · Dilithium
Hard problemModule-SIS + LWE
RingZ_8380417[x]/(x^256+1)
Core opNTT + rejection sample
Variants44 / 65 / 87
BottleneckRejection sampling loop
HW target<200 cycles / sign
SLH-DSA
FIPS 205 · SPHINCS+
Hard problemHash function security
Core opWOTS+ / FORS / HT
HashSHA-256 or SHAKE-256
Bottleneck~100k hash calls/sign
HW targetParallel hash trees
AdvantageConservative, hash-only
FNDSA
FIPS 206 · FALCON
Hard problemNTRU lattice
RingZ[x]/(x^n+1), n=512/1024
Core opFFT-based NTT + Gauss sample
ChallengeGaussian sampling (float)
HW targetFixed-point FFT, CDT table
Key pointSmallest signatures
Operations to implement in Rust (with NIST test vectors)
For ML-KEM & ML-DSA in Rust
  • NTT forward/inverse — Cooley-Tukey butterfly, twiddle factorsuse subtle crate for constant-time ops
  • Polynomial mul — pointwise in NTT domain (O(n log n))
  • Compress/Decompress — rounding to fewer bits
  • CBD sampler — centered binomial distributiontrivial in Rust: XOR + popcount on random bytes
  • Expand (SHAKE-128/256) — deterministic matrix generation
  • Power2Round / HighBits / LowBits — Dilithium-specific
For SLH-DSA in Rust
  • F, H, T_l, PRF — four hash functions (SHA-2/SHAKE via sha2 crate)
  • WOTS+ chain — iterated hash chain, length n
  • XMSS tree — binary Merkle tree, implement leaf parallel
  • FORS — few-times signature for message digest
  • HT (hypertree) — d layers of XMSS trees
  • Key insight: all parallelizable via Rayon crate
For FNDSA (FALCON) in Rust
  • FFT over Z_p — use fixed-point in Rust; avoid f64 for timing security
  • NTRU keygen — LLL/BKZ reduction; computationally heavy
  • Gaussian sampler — CDT table lookup, constant-time critical
  • Fast Fourier Sampling — tree-based trapdoor
  • Use zeroize crate on all secret material
  • Hardware decision: fixed-point FFT preferred for timing security
MILESTONE PROJECT · P2
All 4 algorithms in Rust, passing 100% of NIST KATs. Dart test driver.
  • KAT Files Download NIST Known Answer Tests for FIPS 203/204/205/206
  • ML-KEM Rust impl, add #[inline(never)] on hot loops for profiling
  • ML-DSA Profile rejection sampling loop — this determines latency variance
  • SLH-DSA Count hash calls per operation — this is your HW budget
  • FNDSA Constant-time Gaussian sampler — no timing variance allowed
  • Dart driver Call Rust via dart:ffi, run all KATs, report pass/fail
Resources
PHASE 3
Cryptographic Hardware Accelerators
Turn your Rust/Dart understanding into silicon. This is where throughput is born.
⏱ Months 3–6 FPGA: Xilinx Kintex-7 / Alveo U50 ⬡ Rust testbenches
NTT Core Design
  • Butterfly unit: 2 multiplications + 2 additions per butterfly
  • Input: 256 × 12-bit coefficients (ML-KEM) or 23-bit (ML-DSA)
  • Pipeline: multiply → reduce → add/sub; 3 stages per butterfly
  • Target: 1 NTT in 256 clock cycles (one butterfly/cycle)
  • Twiddle ROM: 128 entries in Montgomery form, Verilog readmemh
  • Montgomery reduction after every multiply — no overflow
ML-KEM Accelerator
  • Module: k×k matrix × k vector (k=2,3,4 for -512/-768/-1024)
  • Parallelism: k² NTT units running simultaneously
  • Pipeline: KeyGen → Encap → Decap
  • CBD noise sampler: trivial in HW — 64-byte XOR + popcount
  • Integrate SHAKE-128 core for matrix expansion (XOF)
  • Target: 12M keygen/sec → 83ns per operation
SLH-DSA Hash Engine Array
  • Core: parallel SHA-256 engines (~64 cycles/block each)
  • WOTS+ chains: 32 independent chains, each 16 hashes deep
  • XMSS tree: leaves are independent → massive parallelism
  • FORS: 14 trees × 2^9 leaves → all parallel
  • Architecture: 128 SHA-256 cores simultaneously
  • Target: 5M sign/sec → 200ns per op
FNDSA FFT Accelerator
  • Decision: 64-bit fixed-point FFT (avoid float — timing security)
  • FFT butterfly: complex multiply (2 FP mul + 2 FP add)
  • Use DSP48E2 blocks for fixed-point complex multiply
  • Gaussian sampler: CDT table in BRAM, constant-time lookup
  • No data-dependent timing in sampler — verified by Rust side-channel sim
  • Target: 8.3M keygen/sec → 120ns per op
Parallelism strategy → 36M ops/sec
TechniqueDescriptionGainWhere used
Deep pipeline Split op into N stages; N results in flight simultaneously N× NTT butterfly, SHA-256 core
128-tile tiling 128 independent accelerator tiles, each one key op 128× All algorithms — main PQForge strategy
Vectorization 4–8 NTT coefficients per cycle with wide datapaths 4–8× NTT inner loop
Task queuing Rust work-stealing queue fills all tiles continuously 95%+ util HSM dispatch layer
Memory interleaving Bank NTT coefficient RAM so parallel access never conflicts No stalls All NTT access patterns
MILESTONE PROJECT · P3
Single-tile ML-KEM-512 accelerator on Alveo U50 — 1M+ ops/sec
  • Step 1 Verilog: 12-bit Montgomery mul, verified vs Rust
  • Step 2 NTT core: full 256-point, verified vs NIST KATs
  • Step 3 ML-KEM-512 KeyGen: SHAKE-128 → expand → NTT → noise
  • Step 4 Encap + Decap pipelines
  • Step 5 Rust driver reads results via PCIe/UART, runs KAT check
  • Step 6 Profile DSP48 utilization; optimize for max clock frequency
Resources
PHASE 4
Hardware Security Primitives
Fast is worthless if attackable. Build a fortress around your silicon.
⏱ Months 4–7 ChipWhisperer-Lite ⬡ Rust: subtle + zeroize
TRNG Design
  • Ring oscillator entropy source — thermal noise in CMOS inverters
  • Multiple oscillators at different frequencies → XOR outputs
  • Min-entropy estimation per NIST SP 800-90B
  • Health tests: repetition count test, adaptive proportion test
  • Conditioning: SHAKE-256, AES-256-CTR_DRBG
  • Implement DRBG as Verilog FSM; Rust driver reads entropy pool
Side-Channel Defense
  • Attack: DPA/CPA — power traces correlate with key hamming weight
  • Defense: Boolean masking — split secret s into s = s0 XOR s1
  • Every NTT operation runs on both shares independently
  • Rust: use subtle::Choice for constant-time select
  • Shuffling: process polynomial coefficients in random order
  • FIPS 140-3 L4: 2nd-order masking required
Tamper Detection
  • Active mesh: ~20µm copper traces over all circuitry
  • Continuous mesh resistance monitoring
  • Environmental sensors: voltage, temp, frequency, light
  • Zeroization engine: Verilog FSM clears all key material <100µs
  • Battery-backed: sensors active even without external power
  • FIPS 140-3 L4: environmental attack protection mandatory
Secure Key Storage
  • Key material never leaves secure boundary in plaintext
  • Rust: all key structs implement Drop via zeroize::Zeroize
  • AES-256-GCM wrapping key in battery-backed SRAM
  • KEK derived from: TRNG seed XOR PUF response
  • Key hierarchy: Master → Domain → Session
  • One zeroization signal clears entire key tree
FIPS 140-3 Level 4 requirements
RequirementLevel 3Level 4 (target)
Physical security Tamper-evident + response Active mesh + ENV attack protection
Side-channel Not specified Must mitigate (EMA, DPA) — 2nd order masking
Operating env Standard Voltage/temp/freq protection
Key mgmt Zeroize on tamper Proactive zeroize, battery-backed
Algorithms NIST approved NIST + PQC (FIPS 203/204/205/206)
MILESTONE PROJECT · P4
Ring-oscillator TRNG + 1st-order masked NTT on ChipWhisperer. Rust TVLA harness.
  • Step 1 16-oscillator TRNG on FPGA; Rust SP 800-90B health tests
  • Step 2 Capture 1M power traces of unmasked NTT butterfly
  • Step 3 Rust CPA attack — confirm key leaks from unmasked version
  • Step 4 Implement 1st-order masked butterfly (two shares in Verilog
  • Step 5 Re-run Rust CPA — confirm 1st-order attack fails at 1M traces
  • Step 6 Measure masking overhead: target <3× performance cost
Resources
PHASE 5
High-Performance System Architecture
How to connect 128 tiles at 36M ops/sec without any bottleneck.
⏱ Months 5–8 HBM3E · PCIe Gen5 · RoCEv2 ⬡ Rust: DPDK bindings
Live simulator — target throughput model
PQForge HSM — Simulated Throughput
LIVE SIM
ML-KEM
0
key gen / sec
ML-DSA
0
sig gen / sec
SLH-DSA
0
sig gen / sec
FNDSA
0
key gen / sec
TOTAL OPS/SEC
0
128 TILES ACTIVE
0 / 128
HBM3E Memory Architecture
  • HBM3E: up to 1.2 TB/s bandwidth per stack
  • 16 pseudo-channels per stack, each independently addressable
  • Zero-contention: each tile owns dedicated channels
  • Per-tile map: coefficients + key buffer + scratch
  • ECC: SECDED on all key material storage lanes
  • Rust driver: maps HBM channels as memory-mapped regions via UIO
Tile Interconnect Fabric
  • All-to-all crossbar for 128 tiles: 128×128 non-blocking switch
  • 2 TB/s aggregate: 128 × 16 GB/s bidirectional links
  • Credit-based flow control (no head-of-line blocking)
  • Network-on-chip (NoC): fat-tree topology in Verilog
  • AXI4 / AXI-S protocol between tiles
  • Rust async task per tile; Tokio runtime for scheduling
Host Interface
  • PCIe Gen5 ×16: 128 GB/s host interface
  • CXL 3.0: memory-semantic key access
  • 400/800GbE: direct network key-gen without host CPU
  • RDMA (RoCEv2): zero-copy key delivery
  • Rust: DPDK bindings for kernel-bypass network path
Throughput math: path to 36M ops/sec
Algorithm Cycles/op 500 MHz tiles 1-tile ops/s Tiles → target
ML-KEM-768 83 500 MHz 6.0M 2 tiles → 12M/s
ML-DSA-65 103 500 MHz 4.8M 2 tiles → 9.7M/s
SLH-DSA-128f 196 500 MHz 2.5M 2 tiles → 5.1M/s
FNDSA-512 120 500 MHz 4.1M 2 tiles → 8.3M/s
TOTAL———8 tiles → 35M/s ✓
Resources
PHASE 6
PCB Design & Physical Engineering
Take your architecture off the dev board and build production hardware.
⏱ Months 7–10 KiCad 8 (free) 8–12 layer HDI PCB
PCB Stack-up (8-layer)
  • L1: Components + Signal (high density, tamper mesh)
  • L2: GND — solid copper pour, primary reference plane
  • L3: Signal 1 (horizontal routing)
  • L4: Power (split planes by voltage domain)
  • L5: Signal 2 (vertical routing)
  • L6: GND — return path for L5
  • L7: Signal 3 + Power
  • L8: Bottom + internal tamper mesh
  • Via-in-pad with copper fill for BGA fanout (ENIG finish)
High-Speed Signal Integrity
  • Impedance control: 50Ω single-ended, 100Ω differential
  • USB, PCIe, QSPI: route matched within ±0.1mm
  • DDR4/HBM: length matching ±25ps (≈5mm on FR4)
  • 3W rule: trace spacing ≥ 3× trace width
  • Back-drill vias for PCIe Gen4+ (removes stub resonance)
  • Simulate: Saturn PCB Toolkit (free) or HyperLynx
Power Delivery + Thermal
  • Buck regulators: 12V → 3.3V → 1.8V → 1.0V (core)
  • 100nF + 10µF decoupling per power pin (ceramic)
  • N+1 hot-swap OR-ing controllers (LTC4370)
  • Per-rail monitoring: INA226 read via Rust I2C driver
  • Heat pipes: vapor-chamber → fins + fan
  • Per-tile thermal monitoring via FPGA thermal diode
Titan Nano bring-up milestones
1

Schematic capture in KiCad

MCU + SE + NFC + USB-C. Dart generates test vectors for USB enumeration test.

2

Component placement + ground plane

Place MCU, SE, crystal, decoupling caps. Flood fill GND L2. Run DRC — zero errors.

3

Route high-speed signals

USB differential pair, SPI to SE, UART debug. Controlled impedance on USB.

4

Order from JLCPCB (~$50 for 5 boards)

ENIG finish, PCBA service for SMD components. 8-layer HDI prototype.

5

Bring-up with Rust firmware

Power sequence check. UART debug first (Rust embassy-rs no_std). Progress to SPI, USB, NFC.

6

Dart integration test suite

Dart serial/USB test driver exercises every PKCS#11 operation from the host side.

Resources
PHASE 7
Firmware, Software Stack & HSM API
Strictly Rust for firmware. Dart for the host-side driver and test tooling.
⏱ Months 8–11 ⬡ Rust no_std + embassy-rs ◆ Dart PKCS#11 client
Secure Boot in Rust
  • Stage 0: ROM bootloader in Rust (no_std, no heap)
  • Stage 1: ML-DSA signature verify of Stage 2 image
  • Stage 2: HSM firmware, measured boot, extend PCR
  • Anti-rollback: monotonic counter in fused OTP
  • Update path: Dart tooling signs firmware; Rust verifies before flashing
  • All Rust boot stages: #![no_std] #![no_main]
PKCS#11 v3.0 in Rust + Dart
  • Rust: implement C_GenerateKeyPair for all 4 PQC algorithms
  • Rust: C_Sign, C_Verify, C_Encrypt, C_Decrypt — all constant-time
  • Dart: dart:ffi bindings to Rust PKCS#11 shared library
  • Dart: PQForge client SDK — developer-facing API
  • Session management: SO (Security Officer) vs User roles
  • Audit log: Rust writes HMAC-chained log; Dart reads and renders
Key Lifecycle in Rust
  • States: Pre-activation → Active → Suspended → Destroyed
  • KMIP 2.1 protocol: Rust server (axum + rustls)
  • Key wrapping: AES-256-KWAP or ML-KEM encapsulation
  • Rust: all key structs derive Zeroize + ZeroizeOnDrop
  • Export policy: never plaintext export — Rust type system enforces
  • Dart: fleet management dashboard and key lifecycle UI
High-Performance Network Path
  • Rust: DPDK bindings via dpdk-sys crate for kernel bypass
  • Custom UDP protocol: 64-byte request, 2KB response
  • RDMA via RoCEv2: zero-copy key delivery, <5µs latency
  • TLS 1.3 with hybrid classical + PQC key exchange (rustls)
  • Load balancing: Rust work-stealing queue to tile dispatcher
  • Dart: async client SDK wraps the network protocol
Rust PKCS#11 key generation skeleton
rust
#![no_std]  // HSM firmware: no standard library
use zeroize::{Zeroize, ZeroizeOnDrop}
use subtle::ConstantTimeEq;

/// ML-KEM decapsulation key — zeroized on drop, always
#[derive(Zeroize, ZeroizeOnDrop)]
pub struct MlKemDk(Box<[u8; 2400]>

/// Generate ML-KEM key pair on hardware accelerator tile
pub fn c_generate_mlkem_keypair(
h_session: CK_SESSION_HANDLE,
tile_id: u8,
) -> Result<(MlKemEk, MlKemDk), CryptokiError> {
let entropy = trng::read_64_bytes(tile_id)?; // ring-osc TRNG
let (ek, dk) = accelerator::mlkem_keygen(tile_id, &entropy)?;
trng::zeroize_entropy_buffer(&entropy); // immediately wipe
Ok((ek, dk))
// dk.zeroize() called automatically on drop — Rust guarantees this
}
Dart PKCS#11 client via dart:ffi
dart
import 'dart:ffi';
import 'package:ffi/ffi.dart';

/// PQForge Dart SDK — wraps Rust PKCS#11 shared library
class PQForgeClient {
final DynamicLibrary _lib;
late final _GenerateKeyPairFn _generateKeyPair;

PQForgeClient({String libPath = 'libpqforge.so'})
: _lib = DynamicLibrary.open(libPath) {
_generateKeyPair = _lib
.lookup<NativeFunction<_CGenerateKeyPair>>('C_GenerateKeyPair')
.asFunction();
}

/// Generate ML-KEM-768 key pair — async, hardware-accelerated
Future<MlKemKeyPair> generateMlKemKeyPair({int level = 768 }) async {
return compute(_generateKeyPairIsolate, level); // off main isolate
}
}
Resources
PHASE 8
Integration, Verification & Certification
How to prove your HSM does exactly what it claims — and nothing it doesn't.
⏱ Months 10–13 ◆ Dart test orchestrator ⬡ Rust TVLA harness
Algorithm Verification
  • All 4 algorithms: 100% NIST KAT pass via Dart test driver
  • Cross-check: Rust firmware sign → Dart verify (and vice versa)
  • Compare vs liboqs, pqclean, BoringSSL reference impls
  • Edge cases: all-zero seed, max-length messages
  • Timing uniformity: 1M ops via Dart, stddev <0.1%
Side-Channel Validation
  • TVLA: Welch's t-test on 1M power traces (Rust implementation)
  • |t| < 4.5 required across all traces for FIPS 140-3 L4
  • EMA: near-field probe, Rust analysis pipeline on captured data
  • Timing oracle: Dart measures 10M op timings, checks independence
  • Equipment: Rigol DHO1074 (~$400) + ChipWhisperer
Physical Security Testing
  • Tamper mesh continuity: Rust daemon monitors resistance 24/7
  • Zeroization test: trigger tamper; Dart verifies key material cleared <100µs
  • Environmental: -40°C to +85°C; Dart runs full KAT suite at each temp
  • Battery removal: sensors active for 72h confirmed
  • Dart generates final test report: PDF with all pass/fail evidence
Performance Validation
  • Dart: sustained 1-hour benchmark, all 4 algorithms simultaneously
  • Latency: Dart measures p99.9 — must be <1ms per operation
  • Memory: Rust HBM utilization monitor; must stay <70%
  • Error rate: 0 cryptographic errors in 1 billion operations
  • Redundancy: remove PSU at full load; Dart verifies 0 dropped ops
FIPS 140-3 Validation Roadmap
1

CMVP Pre-submission

Select accredited lab (SGS, Leidos, UL, Acumen). Costs $50k–200k+ for full validation.

2

Security Policy Document

Documents every security claim, role, service, algorithm. Dart tooling generates initial template from code annotations.

3

Algorithm Testing (ACVTS)

NIST ACVTS online system. Dart client automates all test vector submissions. All algorithms must pass before lab submission.

4

Lab Testing

Independent verification of all FIPS 140-3 requirements. Typically 6–18 months.

5

NIST Review & Certificate

NIST/CCCS review lab report. Certificate issued — check cmvp.nist.gov for current queue times.

Resources
PHASE 9
Grand Project: PQForge HSM v1
Everything comes together. Design, build, and benchmark your full-system HSM prototype.
⏱ Months 12–18 Alveo U280 → Custom PCB ⬡ Rust firmware ◆ Dart SDK + tests
Build sequence
1

Single ML-KEM-768 tile on Alveo U280

NTT + noise sampler + SHAKE-128 + key storage. Rust PCIe driver. Target: 4M keygen/sec at 400MHz. Dart KAT test suite confirms correctness.

2

Multi-algorithm tile: all 4 in one tile

Shared SHA-3 core, shared memory, Verilog algorithm-dispatch FSM. Rust verifies all pass KATs. Measure resource utilization per tile.

3

8-tile system with Rust scheduler + PCIe DMA

Rust async work-stealing dispatcher. Benchmark: 8× single-tile throughput. Latency p99 <5ms via Dart load tester.

4

TRNG, 2nd-order masking, Rust TVLA harness

Ring-oscillator TRNG per tile. 2nd-order masked NTT butterfly in Verilog. Run Rust TVLA — confirm |t| < 4.5.

5

Rust PKCS#11 + Dart SDK + OpenSSL provider

C_GenerateKeyPair, C_Sign, C_Verify all 4 algorithms. Dart integration tests. OpenSSL 3 provider wrapper in Rust. Benchmark TLS handshake throughput end-to-end.

6

Custom PCB: PQForge Titan X-class

12-layer HDI. FPGA + LPDDR5 + NVMe + 10GbE + tamper mesh. KiCad → JLCPCB → bring-up with Rust embassy-rs firmware → validate vs Alveo baseline.

7

Full 2U rack HSM chassis

4–8 custom boards in rack. 400GbE network. Redundant PSU. IPMI management via Rust BMC firmware. Target: 10M+ ops/sec sustained on initial prototype.

PQForge HSM — Final Design Specification

Design-to-Build Specification

Compute

  • Architecture 128× FPGA/ASIC tiles
  • ML-KEM tile NTT-256 pipelined
  • SLH-DSA tile 128× SHA-256 parallel
  • FNDSA tile Fixed-point FFT-512
  • Clock fabric 500 MHz
  • TRNG Per-tile ring oscillator

Memory

  • Per-tile BRAM 256KB zero-contention
  • Shared memory HBM3E 1.2 TB/s
  • Key storage AES-256 battery NVRAM
  • Vault capacity 1M key objects
  • ECC SECDED all paths

Software Stack

  • Firmware Rust no_std + embassy
  • PKCS#11 Rust implementation
  • Host SDK Dart + dart:ffi
  • Network driver Rust + DPDK bindings
  • Test framework Dart (all KATs)

Security

  • Certification FIPS 140-3 Level 4
  • Tamper Active mesh + ENV sensors
  • Side-channel 2nd-order masking
  • Zeroize <100µs on tamper
  • Secure boot ML-DSA signed stages
  • Redundancy N+1 × 2000W PSU