INTEROP_MATRIX.md

June 8, 2026 · View on GitHub

Version: 1.0 — 2026-04-21 Closes CAAS gap G-4.

This matrix records which cross-implementation interop surfaces UltrafastSecp256k1 is exercised against, what kind of cross-check happens, and where the evidence lives. An independent reviewer can verify a claim of "matches reference X" by running the row's test command without source archeology.

1. Scope

Interop here means: identical-input → identical-output between UltrafastSecp256k1 and an independently-implemented reference, on publicly-published vectors or live-generated random inputs.

Three flavours are tracked:

FlavourDefinition
Vector interopBoth sides ingest a published test-vector file and produce identical output
Live differentialBoth sides ingest random or fuzzed inputs and the outputs are byte-compared at runtime
Wire interopTwo implementations exchange messages over a real protocol (BIP-324, MuSig2 round protocol, FROST DKG) and the session completes

2. Interop surfaces

2.1 Vector interop (published test vectors)

SourceAlgorithmVectorsLocal testStatus
WycheproofECDSA secp256k1 SHA-256ecdsa_secp256k1_sha256_test.jsonaudit/test_wycheproof_ecdsa_secp256k1_sha256.cppOK
WycheproofECDSA secp256k1 SHA-256 P1363ecdsa_secp256k1_sha256_p1363_test.jsonaudit/test_wycheproof_ecdsa_secp256k1_sha256_p1363.cppOK
WycheproofECDSA secp256k1 SHA-512ecdsa_secp256k1_sha512_test.jsonaudit/test_wycheproof_ecdsa_secp256k1_sha512.cppOK
WycheproofECDSA secp256k1 SHA-512 P1363ecdsa_secp256k1_sha512_p1363_test.jsonaudit/test_wycheproof_ecdsa_secp256k1_sha512_p1363.cppOK
WycheproofECDH secp256k1ecdh_secp256k1_test.jsonaudit/test_wycheproof_ecdh.cppOK
WycheproofHMAC-SHA256hmac_sha256_test.jsonaudit/test_wycheproof_hmac_sha256.cppOK
WycheproofHKDF-SHA256hkdf_sha256_test.jsonaudit/test_wycheproof_hkdf_sha256.cppOK
WycheproofChaCha20-Poly1305chacha20_poly1305_test.jsonaudit/test_wycheproof_chacha20_poly1305.cppOK
Bitcoin CoreBIP-340 Schnorrbip-0340/test-vectors.csvaudit/test_bip340_vectors.cppOK
BIP-32 specHD derivationSpec vectors §3audit/test_bip32_vectors.cppOK
BIP-324 specHandshake/AEADReference vectorsaudit/test_bip324_*OK
BIP-352 specSilent paymentsReference vectorsaudit/test_bip352_vectors.cppOK
BIP-327 (MuSig2)Key agg / sign / verifySpec vectorsaudit/test_musig2_vectors.cppOK
RFC 9591FROSTAppendix B vectorsaudit/test_frost_vectors.cppOK
RFC 6979Deterministic ECDSA kAppendix A.2 vectorsaudit/test_rfc6979_vectors.cppOK

2.2 Live differential (random/fuzz → byte-compare)

ReferenceSurfaceLocal testStatus
libsecp256k1ECDSA/Schnorr/ECDH/pubkey/xonly/MuSig2-keyagg (random, in-process vs v0.6.0)audit/test_cross_libsecp256k1.cpp (CI gate: conformance-vectors.yml), audit/differential_test.cppOK
libsecp256k1Schnorr sign/verify (BIP-340)audit/differential_test.cppOK
libsecp256k1ECDHaudit/differential_test.cppOK
libsecp256k1EC pubkey parse / serializeaudit/differential_test.cppOK
libsecp256k1 (DER parser)DER edge casesaudit/test_exploit_der_parsing_differential.cppOK
libtomcryptSHA-256, HMAC-SHA-256 (advisory)audit/test_differential_libtomcrypt.cppOK (advisory)
go-ethereum (offline vectors)Ethereum signature recovery (ecrecover)audit/test_exploit_ethereum_differential.cppOK
Internal CT-vs-non-CT pathSame input, two code paths, identical outputaudit/test_ct_vs_classic_diff.cppOK

The differential suite executes ~1.3M assertions per nightly run (differential audit section). Output is captured in build*/py_differential_report.json per CAAS Stage 2.

2.3 Wire interop (real-protocol exchanges)

CounterpartyProtocolTestStatus
Self-against-self with two independent contextsBIP-324 v2 transport handshake + AEADaudit/test_bip324_handshake.cpp + src/cpu/tests/test_bip324_standalone.cppOK
Self-against-selfMuSig2 (BIP-327) full round protocolaudit/test_musig2_round.cppOK
Self-against-selfFROST (RFC 9591) DKG + signaudit/test_frost_dkg.cpp, audit/test_frost_round.cppOK
Bitcoin Core test vectorsBIP-324 handshake transcriptsaudit/test_bip324_kdf_vectors.cppOK
OpenSSL libcrypto (3.x)ECDSA secp256k1 sign+verify cross-checkaudit/test_exploit_differential_openssl.cpp (advisory)Active when OpenSSL present, advisory skip otherwise

3. References that we do NOT (yet) interop against

Listed for transparency. Adding any of these requires a new row in §2 and a wired test in unified_audit_runner.cpp.

ReferenceAlgorithmWhy not yetTracking
BoringSSL EC_KEYRandom differentialBuild wiring (no system package on most CI)Future G-4 extension
WolfSSL wc_ecc_*Random differentialSameFuture G-4 extension
NSS SECKEY_*Random differentialSameFuture G-4 extension
Rust k256 / secp256k1Random differentialCross-ecosystem; needs FFI bridgeFuture G-4 extension
Go btcd/btcecRandom differentialCross-ecosystemFuture G-4 extension
bitcoin-core/secp256k1 MuSig2 moduleWire interopCounterparty harness needs build wiringFuture G-4 extension
frost-dalek (RFC 9591)Wire interopCross-ecosystemFuture G-4 extension

These are intentionally not in §2 because we will not list a row we cannot back with a runnable test. Each future addition lands as a separate feat(interop): add <reference> commit with an audit/test_interop_<ref>.cpp and a wycheproof_* or live-diff row.

4. Verification commands

For an independent reviewer to reproduce every §2 row:

# Build with interop deps
cmake -B build_interop -S . -G Ninja \
  -DSECP256K1_BUILD_INTEROP=ON \
  -DSECP256K1_FETCH_LIBSECP256K1=ON \
  -DSECP256K1_FETCH_LIBTOMCRYPT=ON
cmake --build build_interop --target unified_audit_runner

# Run all interop-bearing audit modules in one shot
./build_interop/audit/unified_audit_runner --section differential
./build_interop/audit/unified_audit_runner --section standard_vectors
./build_interop/audit/unified_audit_runner --section exploit_poc \
  --filter "differential|wycheproof|interop"

# Or run each test individually
ctest --test-dir build_interop -R 'wycheproof|differential|interop' -V

The CAAS pipeline runs the same set in caas-audit.yml Stage 2 with JSON output captured to build_interop/py_differential_report.json and build_interop/py_wycheproof_report.json.

5. Failure semantics

A single mismatch in any §2 row is a hard CAAS failure. The pipeline does not allow:

  • Skipping a Wycheproof tcId (the runner refuses unknown skip flags).
  • Marking a libsecp256k1 differential mismatch as advisory.
  • Down-grading a wire-interop fail to warning.

Historical mismatches are recorded in docs/AUDIT_CHANGELOG.md with a closing commit hash. The Stark Bank r∈[n,p−1] class (RR-004) is the most recent example, closed 2026-04-03 (ea8cfb3c).

6. Change discipline

Adding an interop reference requires, in the same commit:

  1. Row in §2 (or §3 promotion to §2).
  2. Wired audit module under audit/test_*.cpp registered in unified_audit_runner.cpp.
  3. CMake option to fetch / link the reference (default OFF unless the reference is already a build dep).
  4. JSON output captured by CAAS Stage 2.
  5. Update of this document's last-updated date.