Files
threshold/protocols/rlwe-tee/doc.go
zeekay f6093e719b protocols/rlwe-tee: institutional-custody Ring-LWE via TEE-gated trusted-dealer reconstruction
Sibling of protocols/{slhdsa,mldsa}-tee for the corona Ring-LWE
primitive. Master trusted-dealer key (32 B, sign.KeySize) lives
sealed-at-rest in hsm.Provider; per-Sign the TEE attestation
authorizes release and then the dealer's GenerateKeys + the n-party
Round1 / Round2 / Finalize all run inside the attested process.

Composition (not inheritance):
  Signer { gate kms.ReleaseGate; hsmP hsm.Provider;
           appr approval.ApprovalProvider; cfg Config }

corona.threshold.GenerateKeys writes package-level globals
(sign.K, sign.Threshold) — coronaSerializer wraps every entry point
into corona so two concurrent Signers on the same process do not race
through that shared state. Workaround for an upstream constraint; not
a security boundary.

Permissionless path (corona.keyera.BootstrapPedersen — no party ever
holds the master) UNAFFECTED. This is the opt-in institutional-
custody extension. Use cases: foundation HSM ceremonies, single-
operator bridge custody.

11 tests + 9 Config sub-tests; t.Parallel; depends on luxfi/corona
v0.7.6 (canonical Signature/GroupKey/VerifyBytes wire codec).
2026-06-01 12:18:07 -07:00

64 lines
2.9 KiB
Go

// SPDX-License-Identifier: BSD-3-Clause
// Package rlwetee implements operator-controlled Ring-LWE threshold
// signing via TEE-gated trusted-dealer-key reconstruction.
//
// This is NOT a public-BFT primitive. Corona v0.7.3 BootstrapPedersen
// is the canonical permissionless DKG path (no party ever holds the
// master); THIS package is the institutional-custody-only extension
// that binds key release to:
//
// 1. a verifiable hardware TEE attestation (AMD SEV-SNP / Intel TDX /
// NVIDIA NRAS) chain-validated by github.com/luxfi/mpc/cc/attest;
// 2. a KMS release-gate (github.com/luxfi/mpc/pkg/kms.ReleaseGate)
// that pins the worker's RIM digest + hardware fingerprint and
// binds a single-use challenge nonce per-request;
// 3. an out-of-band human / programmatic approval signature
// (github.com/luxfi/mpc/pkg/approval.ApprovalProvider);
// 4. an HSM-resident wrap-key store
// (github.com/luxfi/mpc/pkg/hsm.Provider) so the master 32-byte
// trusted-dealer key (sign.KeySize) lives sealed-at-rest and is
// only ever unwrapped inside the attested TEE.
//
// Per-sign flow:
//
// 1. Verify attestation envelope chain validity + RIM + hardware
// allowlist + approval.
// 2. Release the wrapped master trusted-dealer key from the HSM.
// 3. Inside the TEE: deterministically regenerate the n key shares
// and the GroupKey by re-running corona.threshold.GenerateKeys
// with the master key as PRNG seed.
// 4. Drive Round1 → Round2 → Finalize across all n parties in the
// same TEE process. The resulting Signature is structurally
// identical to a permissionless corona threshold signature on
// the same message and group public key.
// 5. Zeroize the master key and per-party shares.
//
// Verification surface is corona.threshold.Verify(gk, msg, sig). Any
// caller holding the published GroupKey wire bytes can validate with
// corona.threshold.VerifyBytes — no awareness of the TEE substrate is
// required.
//
// Threat model:
//
// - Adversary outside TEE: cannot produce a valid attestation, so
// gate refuses release; no signing possible.
// - Forged attestation: cc/attest chain refuses; ErrAttestationChain.
// - Replay of old sealed key: AAD-binding (epoch, jobID, teePub,
// issuedNonce) refuses cross-epoch / cross-job.
//
// What this package is NOT:
//
// - NOT a substitute for corona.keyera.BootstrapPedersen on the
// public-BFT surface. The Pedersen-DKG path (no trusted dealer)
// is the canonical permissionless construction. Use rlwe-tee
// ONLY when the threat model permits "trusted dealer inside an
// attested TEE" (foundation HSM ceremonies, single-operator
// custody).
//
// - NOT a distributed protocol. All n parties run in the same
// attested process; the network surface is exactly the
// attestation envelope, the gate release request, and the
// resulting wire-form signature.
package rlwetee