Files
mpc/pkg
zeekayandHanzo Dev 3f22f50c1b threshold: stop registering the nonce-leaking adapters at import
pkg/threshold's init() pushed CGGMP21Scheme and FROSTScheme into the
process-global crypto/threshold registry as a side effect of import. Two
concrete hazards:

 1. Shadowing. These adapters' signer keeps the secret nonce scalar k inside
    NonceState (k||R). Anything resolving GetScheme(SchemeCMP) would silently
    receive that signer; a NonceState crossing a party boundary yields the
    private key as x = (s*k - H(m))/r. Opting into that must be deliberate.

 2. Startup panic. RegisterScheme panics on a duplicate ID ([email protected].2
    threshold/registry.go:24-26), so the day crypto/threshold ships its own
    CMP/FROST scheme, merely importing this package kills the process at start.

Replace init() with an exported Register() documenting both hazards. Nothing
regresses: the daemon never reached this code (`go list -deps ./cmd/mpcd` does
not contain pkg/threshold) and the only importers, examples/, use
NewUnifiedThresholdAPI and never touch the registry.

register_test.go pins the invariant: TestImportDoesNotRegister fails if an
ambient init() comes back (verified red/green), TestRegisterIsExplicit proves
explicit opt-in still works.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-25 16:33:00 -07:00
..
2024-09-21 20:52:40 +07:00
2025-08-02 22:27:51 -05:00