← Lab /Crypto & theory

Constant-time Go implementations of ML-DSA and SLH-DSA avoid timing side-channels

Their Go libraries implement ML-DSA and SLH-DSA without side-channel leaks such as timing attacks.

Crypto & theory Trail of Bits 14 Nov 2025 Defense Deployed evidence

Published as “How we avoided side-channels in our new post-quantum Go cryptography libraries”

Why it matters

Provides a ready-to-use, side-channel-resistant Go library for NIST post-quantum signatures, easing migration for developers.

Summary

The Trail of Bits team released pure-Go implementations of the NIST-standardized post-quantum signature schemes ML-DSA (FIPS-204) and SLH-DSA (FIPS-205). They focused on making the ML-DSA Decompose routine constant-time by eliminating branches and division operations, first using a naïve bit-by-bit division and then replacing it with a Barrett-reduction based method. The final code claims to run without timing-dependent branches or divisions, and the libraries are publicly available for anyone transitioning to post-quantum signatures. No performance measurements or formal side-channel analysis are presented, so the strength of the claim rests on code review and engineering judgment.

What they found 1

  1. Decompose can be implemented without branches or divisions using Barrett reduction.

    “With this useful function in hand, we can now implement Decompose without branches or divisions.”

Caveats 2

  • The initial division-free method is described as slow, requiring a full loop iteration per bit of the quotient and remainder.
  • This works as expected, but it’s slow, since it requires a full loop iteration to calculate each bit of the quotient and remainder.

What’s new here 4

  • Open-source pure Go implementations of ML-DSA and SLH-DSA.
  • Branchless, constant-time implementation of the ML-DSA Decompose algorithm.
  • Use of Barrett reduction to replace integer division with pre-computed reciprocals.
  • Engineering and cryptographic review by Trail of Bits staff.