Skip to content
SkillModel-led2,959 tokens in use

Constant-Time Analysis

Detects timing side-channel risks in cryptographic code by compiling it and inspecting assembly or bytecode, then triaging each flagged instruction against secrets.

8,319 stars on the repository CC-BY-SA-4.0trailofbits/skills · plugins/constant-time-analysis/skills/constant-time-analysis
/plugin marketplace add trailofbits/skills
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing Constant-Time Analysis costs

64tokens idle
2,959tokens in use
15,882tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Model-led

Script-ledMixedModel-led

Mostly instructions, so how well it works depends on the model that follows them.

This describes the skill's structure, how much of it is scripts. It does not say how well it works.

Touches

shelldeclared and detected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Excellent
  • Frontmatter12/15
  • Structure19/25
  • Examples12/15
  • Output15/15
  • Size15/15
  • Resources12/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent
  • Runs shell commands−2

    does this on the machine, as the frontmatter declares

    SKILL.md, line 46

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance52
  • Community64
  • Maturity32
  • Momentum40

Constant-Time Analysis finds variable-time operations in crypto code written in C, C++, Go, Rust, Swift, Java, Kotlin, C#, PHP, JavaScript, TypeScript, Python or Ruby. A bundled analyzer compiles the file, reads the emitted assembly or bytecode, and flags division and modulo, weak random number use, secret-dependent branches, early-exit comparisons and table lookups.

The compile step is mechanical and the triage is the real work: the analyzer has no data flow analysis, so a failed report is a worklist. The agent must trace each flagged operand back to a key, plaintext or nonce and state a verdict with the data flow behind it.

What You Get

  • Analyzer reports per function with severity and the reason an instruction is variable-time
  • Language guides listing dangerous instructions and constant-time replacements
  • A triage method that separates true positives from public-length divisions
  • A table of constant-time comparison primitives for each language

Common Use Cases

  • Reviewing a signature, KEM or key derivation routine for KyberSlash-style division on secrets
  • Checking whether a MAC or tag comparison exits early
  • Re-checking a fix across compilers, targets and every optimization level
  • Sweeping a crypto source directory file by file

What Makes It Unique

It treats the tool output as a worklist and spends most of its text on triage, with known-answer samples per language that pair a true positive with an identical-looking false positive. It also requires results to name the compiler, architecture and optimization level, since a clean run proves one configuration only.

Under The Hood

The skill loads an instruction file and language reference guides, then runs a bundled Python analyzer through uv on one file at a time. The analyzer invokes the local toolchain for the language, such as gcc, clang, go, rustc, swiftc, javac, node, php or ruby, to compile or dump bytecode, and reads the result. Compilation writes build outputs on your machine, and the analyzer may use cross compilers you name. It never executes the code under test, and it does not fetch web pages or call APIs.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers