fix: gofmt -s across repo (CI format check)

This commit is contained in:
2026-06-02 11:39:49 -07:00
parent a8e007ed75
commit 12e72c7635
4 changed files with 23 additions and 23 deletions
+8 -8
View File
@@ -92,14 +92,14 @@ var (
cFixtureTapes [kCombineValidPool]combineTape
)
//export pulsar_combine_ct_setup
//
// Build a real threshold ceremony fixture once. Returns 0 on
// success, non-zero on failure.
//
// Topology: n=3 parties, t=2 threshold, ModeP65. This is the
// smallest non-trivial threshold ceremony — keeps the dudect run
// time per sample bounded.
//
//export pulsar_combine_ct_setup
func pulsar_combine_ct_setup() C.int {
params := pulsar.MustParamsFor(pulsar.ModeP65)
n, t := 3, 2
@@ -248,24 +248,22 @@ func pulsar_combine_ct_setup() C.int {
return 0
}
//export pulsar_combine_ct_pool_size
//
// Returns the number of valid tapes in the per-startup pool.
//
//export pulsar_combine_ct_pool_size
func pulsar_combine_ct_pool_size() C.size_t {
return C.size_t(kCombineValidPool)
}
//export pulsar_combine_ct_input_size
//
// Returns the per-sample input width: 4 bytes (a big-endian uint32
// tape index, mod kCombineValidPool). The C harness sizes its
// dudect chunk to this width.
//
//export pulsar_combine_ct_input_size
func pulsar_combine_ct_input_size() C.size_t {
return C.size_t(4)
}
//export pulsar_combine_ct
//
// One dudect measurement sample.
//
// `data` points to a 4-byte big-endian uint32 tape index; the
@@ -278,6 +276,8 @@ func pulsar_combine_ct_input_size() C.size_t {
// IMPORTANT: this function must NOT branch on the data beyond the
// modular reduction. The reduction is constant-time over the
// 4-byte input.
//
//export pulsar_combine_ct
func pulsar_combine_ct(data *C.uint8_t) {
if cFixtureParams == nil {
return
+10 -10
View File
@@ -91,8 +91,6 @@ var (
validPool [kValidPool]*pulsar.Signature
)
//export pulsar_verify_ct_setup
//
// Initialise the long-lived fixture. Returns 0 on success, non-zero
// on failure. Must be called once before pulsar_verify_ct.
//
@@ -101,6 +99,8 @@ var (
// crypto/rand so the dudect run is not deterministic across launches
// — that's intentional: the timing property must hold for ANY valid
// (pk, msg, sig) triple, not a single hardcoded test vector.
//
//export pulsar_verify_ct_setup
func pulsar_verify_ct_setup() C.int {
params := pulsar.MustParamsFor(pulsar.ModeP65)
sk, err := pulsar.GenerateKey(params, rand.Reader)
@@ -136,11 +136,11 @@ func pulsar_verify_ct_setup() C.int {
return 0
}
//export pulsar_verify_ct_sig_size
//
// Returns the FIPS 204 signature size for the configured mode. The
// C harness uses this to size its per-sample scratch buffer to the
// exact wire width Verify expects.
//
//export pulsar_verify_ct_sig_size
func pulsar_verify_ct_sig_size() C.size_t {
if fixtureParams == nil {
return 0
@@ -148,16 +148,14 @@ func pulsar_verify_ct_sig_size() C.size_t {
return C.size_t(fixtureParams.SignatureSize)
}
//export pulsar_verify_ct_pool_size
//
// Returns the number of valid signatures in the per-startup pool.
// The C harness draws class-B samples from pool[0..pool_size).
//
//export pulsar_verify_ct_pool_size
func pulsar_verify_ct_pool_size() C.size_t {
return C.size_t(kValidPool)
}
//export pulsar_verify_ct_copy_pool
//
// Copies validPool[idx].Bytes into the caller-supplied dst buffer
// (sig_size bytes). idx MUST be in [0, kValidPool); the C harness
// enforces this via pulsar_verify_ct_pool_size. Returns 0 on
@@ -168,6 +166,8 @@ func pulsar_verify_ct_pool_size() C.size_t {
// sig_size bytes; the timing of the copy is irrelevant because
// dudect measures cycles around pulsar_verify_ct, not around this
// setup-time data movement.
//
//export pulsar_verify_ct_copy_pool
func pulsar_verify_ct_copy_pool(idx C.size_t, dst *C.uint8_t) C.int {
i := int(idx)
if i < 0 || i >= kValidPool || fixtureParams == nil || validPool[i] == nil {
@@ -179,8 +179,6 @@ func pulsar_verify_ct_copy_pool(idx C.size_t, dst *C.uint8_t) C.int {
return 0
}
//export pulsar_verify_ct
//
// One dudect measurement sample.
//
// data points to sig_size bytes of caller-controlled signature bytes
@@ -194,6 +192,8 @@ func pulsar_verify_ct_copy_pool(idx C.size_t, dst *C.uint8_t) C.int {
// The function MUST be branchless on data — any data-dependent
// branch we introduce here pollutes the measurement before Verify
// even starts. We only copy data into a fresh slice and dispatch.
//
//export pulsar_verify_ct
func pulsar_verify_ct(data *C.uint8_t) {
if fixtureParams == nil {
return
+4 -4
View File
@@ -11,7 +11,7 @@
// corona/gpu/gpu.go is the structural template for this package;
// every export here has the matching corona counterpart.
//
// IMPORT-PATH DISCIPLINE — NIST-CLEAN REFERENCE
// # IMPORT-PATH DISCIPLINE — NIST-CLEAN REFERENCE
//
// The pulsar NIST reference implementation lives at the parent import
// path github.com/luxfi/pulsar/ref/go/pkg/pulsar. That package's
@@ -27,7 +27,7 @@
// dispatcher. Compiling the reference (go test ./ref/go/pkg/pulsar/)
// does not transitively pull this subpackage.
//
// DECOMPLECTING NOTE
// # DECOMPLECTING NOTE
//
// Pulsar's per-coefficient NTT (FIPS 204 §3.6) operates on
// [256]uint32 polynomials in 32-bit Montgomery form with q=8380417
@@ -66,7 +66,7 @@
// cgo plumbing is wired correctly without grepping the lattice
// source.
//
// THRESHOLD GATING
// # THRESHOLD GATING
//
// Pulsar's production ring degree is N=256 (FIPS 204 fixed). Single-
// poly Metal NTT on Apple M1 Max is strictly slower than the pure-Go
@@ -83,7 +83,7 @@
// UseAcceleratorForce() to set threshold=1 and exercise the GPU path
// at N=256 as a byte-equality gate.
//
// BUILD-TAG DISCIPLINE
// # BUILD-TAG DISCIPLINE
//
// This package has NO build tags. It compiles identically across
// cgo+gpu builds and pure-Go builds because the cgo plumbing lives
+1 -1
View File
@@ -337,7 +337,7 @@ func TestThresholdSign_QuorumTooSmall(t *testing.T) {
t.Fatalf("empty quorum not rejected: %v", err)
}
// Member not in quorum.
_, err = NewThresholdSigner(params, sid, 1, []NodeID{NodeID{0xff}}, shares[0], map[NodeID][32]byte{}, msg, deterministicReader([]byte{1}))
_, err = NewThresholdSigner(params, sid, 1, []NodeID{{0xff}}, shares[0], map[NodeID][32]byte{}, msg, deterministicReader([]byte{1}))
if err != ErrNotInQuorum {
t.Fatalf("non-member not rejected: %v", err)
}