Accelerator for Crystals-Dilithium with Dual-Core Parallelism on ESP32
Abstract
Dilithium is a lattice-based digital signature scheme selected in the post-quantum cryptography (PQC) standardization process by the National Institute of Standards and Technology (NIST). To address the inefficiency issue, a targeted acceleration scheme for Dilithium is designed by combining the hardware characteristics of the ESP32. Based on the dual-core architecture of the ESP32, the algorithm scheduling is optimized to enable dual-thread parallel acceleration instead of single-thread execution. In addition, the Keccak hash module is optimized and adapted using the official 32-bit C implementation from XKCP, replacing the original generic C code. The full Dilithium algorithm is integrated and verified in the ESP-IDF development environment, and system stability is guaranteed by reasonably configuring compilation parameters and optimizing task scheduling. After comprehensive optimization, the total latency is reduced to 127.59 ms. Specifically, the optimized execution latencies for key generation, signature generation, and signature verification are 20.29 ms, 85.47 ms, and 21.83 ms, respectively, achieving latency reductions of 56.94%, 32.12%, and 52.79% compared with the AES-modified version of Dilithium. Experimental results demonstrate that using the original SHAKE algorithm reduces the total latency by more than 35% compared with the AES-modified version. With dual-core parallelism and the optimized Keccak function, the total latency is further reduced by more than 41% compared with the AES-modified version, which significantly improves the real-time performance of Dilithium on the ESP32 and meets the lightweight and high-efficiency requirements of embedded applications.