mirror of
https://github.com/luxfi/crypto.git
synced 2026-10-30 16:59:13 +00:00
Root cause of the never-passing 'HQC PQClean cgo e2e (NIST KAT roundtrip)' job, in two layers: 1. The lux-build runner had no C compiler (gcc/cc/clang absent), so cgo aborted before any code ran. Fixed in prior commits by installing build-essential + selecting an available CC. 2. With a compiler present, the cgo build then failed on [email protected]/ops/code/code_cpu.go's '#include "lux/gpu/hqc.h"' and '-lluxgpu_hqc' — the native HQC library (built from luxfi/mlx) that is NOT present in CI (nor in most consumers). accel v1.1.9 gated that native path on '//go:build cgo', so every cgo build hard-required the native lib/header. Fix: bump github.com/luxfi/accel v1.1.9 -> v1.2.4, which gates the native path behind '-tags=lux_hqc_native' and otherwise returns code.ErrNativeHQCUnavailable (documented: 'callers should fall back to their own CPU KEM path'). crypto/hqc now honours that contract: - gpu.go: batchEncapsulateGPU/batchDecapsulateGPU treat ErrNativeHQCUnavailable as 'declined' (return false,nil) so callers fall back to the per-item PQClean path. Secret buffers are zeroised on the decline path. - gpu_cgo.go: GF2Polymul falls back to the pure-Go Karatsuba path on ErrNativeHQCUnavailable. Removed the duplicated vecNSize64 / redMaskForMode / GF2Add (now shared). - gpu_polymul_purego.go (new, tag-neutral): the canonical pure-Go, PQClean-byte-identical GF(2)^N polymul (Karatsuba + reduce + base_mul), extracted from gpu_nocgo.go so BOTH builds share one implementation. - gpu_nocgo.go: trimmed to the thin !cgo public wrappers over the shared helpers. - randombytes_shim.c: split. Default (hqc_pqclean, no native) forwards randombytes -> hqcGoRandombytes only; the native seed-buffer dispatch (which references lux_hqc_randombytes / lux_hqc_seed_has_bytes from the native lib) moves to randombytes_shim_native.c, gated on lux_hqc_native. Previously the default build referenced those native-only symbols unconditionally, which would not link without the native lib. NOT a crypto/KAT regression: the NIST KAT roundtrip (TestKAT_HQC128/192/ 256), TestRoundTrip_AllModes, TestDeterminism, and the GF2 polymul known-answer vectors all pass byte-for-byte. The GPU batch tests skip gracefully when the native kernel is absent (their existing t.Skip path). Verified: CGO_ENABLED=1 go test -tags=hqc_pqclean ./hqc/ passes from a clean cache; cgo (with/without hqc_pqclean) and nocgo builds all green; broader suite unchanged (only pre-existing pkg-config failures in cgo/ and hash/poseidon2 remain, unrelated). Co-authored-by: Hanzo Dev <[email protected]>
81 lines
3.1 KiB
AMPL
81 lines
3.1 KiB
AMPL
module github.com/luxfi/crypto
|
|
|
|
go 1.26.4
|
|
|
|
exclude github.com/luxfi/geth v1.16.1
|
|
|
|
require (
|
|
github.com/btcsuite/btcd/btcutil v1.1.6
|
|
github.com/cloudflare/circl v1.6.3
|
|
github.com/consensys/gnark-crypto v0.20.1
|
|
github.com/crate-crypto/go-eth-kzg v1.5.0
|
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
|
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1
|
|
github.com/ethereum/c-kzg-4844/v2 v2.1.7
|
|
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab
|
|
github.com/google/btree v1.1.3
|
|
github.com/google/gofuzz v1.2.0
|
|
github.com/jedisct1/go-minisign v0.0.0-20241212093149-d2f9f49435c7
|
|
github.com/luxfi/accel v1.2.4
|
|
github.com/luxfi/age v1.5.0
|
|
github.com/luxfi/cache v1.2.1
|
|
github.com/luxfi/crypto/ipa v1.2.4
|
|
github.com/luxfi/geth v1.16.98
|
|
github.com/luxfi/ids v1.2.10
|
|
github.com/luxfi/log v1.4.1
|
|
github.com/luxfi/mock v0.1.1
|
|
github.com/luxfi/precompile v0.5.37
|
|
github.com/mr-tron/base58 v1.2.0
|
|
github.com/stretchr/testify v1.11.1
|
|
github.com/supranational/blst v0.3.16
|
|
github.com/zeebo/blake3 v0.2.4
|
|
go.uber.org/mock v0.6.0
|
|
golang.org/x/crypto v0.52.0
|
|
golang.org/x/sync v0.20.0
|
|
golang.org/x/sys v0.45.0
|
|
)
|
|
|
|
require (
|
|
filippo.io/hpke v0.4.0 // indirect
|
|
github.com/Microsoft/go-winio v0.6.2 // indirect
|
|
github.com/bits-and-blooms/bitset v1.24.4 // indirect
|
|
github.com/gorilla/rpc v1.2.1 // indirect
|
|
github.com/holiman/uint256 v1.3.2 // indirect
|
|
github.com/klauspost/compress v1.18.5 // indirect
|
|
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
|
github.com/luxfi/atomic v1.0.0 // indirect
|
|
github.com/luxfi/codec v1.1.4 // indirect
|
|
github.com/luxfi/compress v0.0.5 // indirect
|
|
github.com/luxfi/concurrent v0.0.3 // indirect
|
|
github.com/luxfi/consensus v1.25.0 // indirect
|
|
github.com/luxfi/constants v1.5.8-0.20260603055356-93c2c2ceb9ca // indirect
|
|
github.com/luxfi/container v0.0.4 // indirect
|
|
github.com/luxfi/database v1.18.3 // indirect
|
|
github.com/luxfi/math v1.4.1 // indirect
|
|
github.com/luxfi/math/big v0.1.0 // indirect
|
|
github.com/luxfi/metric v1.5.7 // indirect
|
|
github.com/luxfi/p2p v1.21.1 // indirect
|
|
github.com/luxfi/pq v1.0.3 // indirect
|
|
github.com/luxfi/runtime v1.1.0 // indirect
|
|
github.com/luxfi/sampler v1.1.0 // indirect
|
|
github.com/luxfi/utils v1.1.5 // indirect
|
|
github.com/luxfi/validators v1.2.0 // indirect
|
|
github.com/luxfi/version v1.0.1 // indirect
|
|
github.com/luxfi/vm v1.2.0 // indirect
|
|
github.com/luxfi/warp v1.18.6 // indirect
|
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
|
github.com/zeebo/assert v1.3.0 // indirect
|
|
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
|
|
gonum.org/v1/gonum v0.17.0 // indirect
|
|
google.golang.org/protobuf v1.36.11 // indirect
|
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
)
|
|
|
|
// Route upstream crypto modules through luxfi-maintained mirrors so that
|
|
// downstream Lux services consume a single canonical source. See
|
|
// LUXFI-FORK.md in each fork for pin SHAs and sync policy.
|
|
replace github.com/crate-crypto/go-ipa => github.com/luxfi/go-ipa v0.0.0-20260427175713-d31adc040fa6
|