NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CIDPro: Custom Instructions for Dynamic Program Diversification

Thinh Hung Pham, Alexander Fell, Arnab Kumar Biswas, Siew-Kei Lam, Nandeesha Veeranna

Abstract

Timing side-channel attacks pose a significant threat to embedded security by leaking cryptographic keys through execution time variations. While software-based constant-time programming aims to mitigate this, it is often bypassed by compiler optimizations and micro-architectural features. We present CIDPro, a hardware-software framework that introduces non-deterministic delays into security-critical operations via custom RISC-V instructions. By shifting the defense to a dedicated hardware co-processor, CIDPro achieves up to an 86% reduction in information leakage with minimal performance and area overhead.

Introduction

In the domain of embedded security, the execution time of a program can be as revealing as the data it processes. Timing side-channel attacks exploit these variations—for instance, observing that a modular exponentiation takes longer for a '1' bit than a '0' bit—to reconstruct secret keys. Traditional software defenses, such as "constant-time" code, attempt to equalize execution paths. However, as illustrated in Figure 1, these methods are frequently undermined by hardware-level behaviors and compiler optimizations, leaving distinct timing signatures for different keys.

Timing leakage in baseline and traditional software-based defenses. The distinct distributions for key0 and key1 indicate observable timing side-channels that CIDPro aims to mitigate.

CIDPro addresses these vulnerabilities by intentionally injecting hardware-level randomness into execution times, making the timing signature unpredictable and robust against statistical analysis.

Methodology

CIDPro (Custom Instructions for Dynamic Program Diversification) combines an automated compiler pass with a specialized hardware co-processor to inject non-deterministic delays into security-critical operations.

LLVM Compiler Pass

The framework utilizes a custom LLVM pass that automatically identifies security-critical arithmetic operations in source code. These standard operations are replaced with Custom Instructions (CIs) defined within the RISC-V ISA. This transparency allows developers to write standard C/C++ code without needing specialized secure programming knowledge.

Diversified Co-processor

The hardware component is implemented via the Rocket Chip Co-processor Interface (RoCC) on a RISC-V architecture. When a CI is executed, the co-processor uses a Pseudo-Random Number Generator (PRNG) to determine a random number of wait cycles. The pipeline stalls until this timer expires, ensuring that the instruction's execution time is decoupled from its input values. This approach introduces a tunable "diversification level" ($dl$), allowing engineers to balance security strength against performance requirements.

Evaluation and Results

The framework was evaluated using standard cryptographic benchmarks: modular exponentiation (modExp) for RSA and modular multiplication (mulMod16) for the IDEA block cipher. Testing was conducted in both bare-metal and Linux environments on a Zynq-7000 FPGA.

Key Findings

  • Leakage Reduction: CIDPro achieved an 80% reduction in timing side-channel capacity for RSA and an 86% reduction for IDEA, effectively squashing the side-channel signal.
  • Performance Efficiency: For the RSA benchmark, CIDPro incurred only a 13% performance overhead at moderate diversification levels. In contrast, traditional software-only countermeasures like "cross-copying" slowed programs by over 50%.
  • Minimal Footprint: The hardware required for the co-processor is extremely efficient, utilizing only 1% of the total FPGA slices in the RISC-V system.
  • OS Resilience: The defense remained highly effective even under Linux, where operating system noise typically complicates but does not prevent side-channel analysis.

Conclusion

CIDPro provides a robust, hardware-rooted defense against timing attacks. By moving randomization into a dedicated co-processor, it bypasses the limitations of software-only constant-time approaches while maintaining high performance and low area overhead. Future work will focus on increasing instruction granularity—grouping multiple operations into single diversified instructions—and integrating True Random Number Generators (TRNGs) to further harden the system against sophisticated adversaries.

Summary updated

BibTeX
@inproceedings{pham2018cidpro,
  author = {Thinh Hung Pham and Alexander Fell and Arnab Kumar Biswas and Siew-Kei Lam and Nandeesha Veeranna},
  title = {{CIDPro: Custom Instructions for Dynamic Program Diversification}},
  booktitle = {FPL},
  year = {2018},
  doi = {10.1109/fpl.2018.00045},
}
Figure