constant-time-analysis — Claude Code skill: how it works
Inspects compiled assembly and bytecode for timing side-channels. It flags secret-dependent branches and variable-time operations in crypto routines.
npx skills add trailofbits/skills --skill constant-time-analysis -a claude-codeWhat constant-time-analysis does
This skill compiles a source file and inspects the resulting assembly or bytecode for variable-time instructions. It flags secret division, modulo operations, and secret-dependent branches. It is purely static analysis. The tool does not execute binaries or take runtime timing measurements.
The analysis runs through ct_analyzer/analyzer.py using uv. It detects languages by file extension across C, C++, Rust, Go, Swift, Java, C#, PHP, JavaScript, Python, and Ruby. For native binaries, you can pass --arch, --compiler, and --opt-level to inspect different optimization passes.
Running without --warnings leaves common timing leaks invisible. Without this flag, early-exit comparisons like memcmp and secret table lookups stay silent. A clean report on -O2 does not prove safety on -O0, where compiler transforms can restore variable-time branches.
What it helps with
- spot division or modulo instructions operating on secret inputs
- catch early-exit comparisons like memcmp in authentication tags
- audit compiler assembly across multiple architectures and optimization levels
- identify secret-dependent branches before deploying cryptographic routines
Example prompts for the agent
- Run constant-time analysis on crypto/sign.c targeting arm64 with --warnings.
- Check src/kem.rs for variable-time branches and secret division.
- Audit the verify routine in auth_tag.py for early-exit comparisons.
How to install constant-time-analysis
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill constant-time-analysis -a claude-code2Manually: put the files in place
~/.claude/skills/constant-time-analysis/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/constant-time-analysis/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill constant-time-analysis -a codex2Manually: put the files in place
.agents/skills/constant-time-analysis/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill constant-time-analysis -a cursor2Manually: put the files in place
.cursor/skills/constant-time-analysis/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install trailofbits/skills constant-time-analysis2Manually: put the files in place
.github/skills/constant-time-analysis/SKILL.md1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill constant-time-analysis -a gemini-cli2Platform CLI
gemini skills install https://github.com/trailofbits/skills --path plugins/constant-time-analysis/skills/constant-time-analysisManually: put the files in place
.devin/skills/constant-time-analysis/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add trailofbits/skills --skill constant-time-analysis -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about constant-time-analysis
How do I install constant-time-analysis in Claude Code?
Run npx skills add trailofbits/skills --skill constant-time-analysis -a claude-code in your terminal.
What does constant-time-analysis check?
It statically examines compiler output and VM bytecode without running the binary. It flags variable-time operations, branch conditions tied to secrets, and early-exit checks.
Why is the --warnings flag necessary?
Default runs show only error-severity findings like division instructions. Flaws such as early-exit comparisons and secret table indexing are warning-level and will be skipped without --warnings.