constant-time-testing
Detects timing side channels in cryptographic code to prevent secret data leakage. Essential for auditing sensitive implementations.
Introduction
The constant-time testing skill provides a specialized diagnostic framework for identifying timing side-channel vulnerabilities in cryptographic implementations. Timing attacks exploit microarchitectural variations—such as cache-timing differences, branch prediction behavior, or instruction-level latency variations—to extract secret keys, passwords, or other sensitive cryptographic material. This skill is intended for security auditors, cryptography engineers, and developers working on sensitive primitives or protocols who need to ensure that their execution paths and memory access patterns remain independent of secret data. By leveraging a combination of statistical testing, symbolic execution, and formal verification methodologies, this skill guides users through the process of auditing code for common violations like conditional branches dependent on secrets, non-constant array lookups, and insecure integer division or shift operations. It provides clear guidance on applying industry-standard techniques such as masking to remove the correlation between execution time and sensitive inputs. Users can expect to use this tool to evaluate code for compliance with constant-time principles, detect statistical timing differences in real-world environments, and track secret data flow at runtime. The skill supports an array of specialized tooling including dudect for statistical timing analysis, timecop for dynamic analysis, and various formal verification tools like SideTrail, ct-verif, and FaCT. It is crucial to note that this skill is specifically tailored for code processing cryptographic material; it is not intended for general performance optimization, which may involve different trade-offs. Key features include identifying specific violations like cache-timing leaks in RSA or Kyber implementations, mapping vulnerable patterns such as secret-dependent branching, and recommending appropriate verification categories based on the user's technical requirements and available modeling maturity.
-
Detects timing side channels in cryptographic implementations, including RSA, ECDH, AES, and post-quantum algorithms like Kyber.
-
Supports multiple analysis methodologies: formal proof, symbolic execution, dynamic tracing, and statistical measurement.
-
Provides actionable guidance on mitigation strategies, such as masking techniques, to eliminate timing dependencies.
-
Analyzes microarchitectural risks like cache-timing, integer division, and shift-based information leakage.
-
Integrates with domain-specific tools: dudect, timecop, SideTrail, ct-verif, and FaCT.
-
Distinguishes between secret-dependent code paths and non-cryptographic performance bottlenecks.
-
Ensure the target code is clearly identified as processing sensitive secrets; this skill is not applicable to public, non-secret-dependent logic.
-
Be prepared to provide test harnesses or specific cryptographic inputs when performing statistical (dudect) or dynamic (timecop) analysis.
-
Formal verification approaches may require significant upfront time to build accurate code models and property specifications.
-
Results from statistical testing are subject to environmental noise; verify findings in controlled, noise-reduced environments when possible.
Repository Stats
- Stars
- 4,873
- Forks
- 424
- Open Issues
- 21
- Language
- Python
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- Apr 29, 2026, 06:02 AM