← Lab /Security & privacy

Fixed Go extended GCD runs 24% faster and is formally verified

The authors claim their corrected implementation is faster and provably correct

Security & privacy arXiv 4 Jun 2026 Method Prototype evidence

Published as “GCD: Garbled, Corrected, Demonstrandum -- Fixing and Proving Go's Extended GCD Implementation”

Why it matters

The fix improves RSA key-generation performance in Go and provides a machine-checked guarantee of correctness for a critical cryptographic primitive.

Summary

The authors fixed two deviations in Go’s extended GCD implementation, proving the corrected code with Gobra and achieving an average 24 % speedup (geometric mean 23.98 %). The evidence comes from a benchmark comparing the original and fixed implementations and a successful formal verification, though the paper notes reliance on trusted functions and no detection of integer overflows.

What they found 1

  1. The verified implementation is on average 23.98 % faster than the original.

    “Across all benchmarks, we obtain a statistically significant, geometric mean performance improvement of 23.98 %.”

Caveats 3

  • We trust the correctness of the Gobra verifier and the underlying SMT solver.
  • We assume that all functions annotated with trusted (and without requires false) satisfy their specifications.
  • Gobra currently treats int and uint as unbounded types. This means that our verification does not detect potential integer overflows in intermediate computations.

What’s new here 4

  • First formal verification of Go’s extended GCD implementation using Gobra.
  • Synchronization of coefficient updates fixes algorithmic invariants and yields a 15.6-24 % runtime improvement.
  • Extended the correctness proof to cover a larger input domain than BoringSSL’s version.
  • Integrated the proof into continuous integration to automatically check future changes.