mirror of
https://github.com/luxfi/accel.git
synced 2026-10-30 17:03:45 +00:00
cgo says a C compiler is available. It does not say libluxgpu_hqc and lux/gpu/hqc.h are installed. code_cpu.go declared the second fact as the first, so any consumer that turns cgo on for an unrelated reason — blst, say — had to carry a luxgpu install or fail to compile: ops/code/code_cpu.go:102:10: fatal error: lux/gpu/hqc.h: No such file or directory Two facts, two predicates. This restores the pairing ops/code carried through v1.2.4 and that every other optional native link in accel still uses: crypto_secp256k1_cgo.go and ops/crypto/crypto_msm_native.go behind lux_crypto_native, ops/fhe/cgo.go behind luxfhe, internal/capi/real.go behind lux_accel_real. ops/code was the lone file keyed on bare cgo. code_nocgo.go covers the complement, so a plain cgo build now reports ErrNativeHQCUnavailable — the error the API already documents — instead of failing to build. -tags=lux_hqc_native links the native oracle unchanged. Verified: build + test at CGO=0; CGO=1 with and without the tag; both again under -tags=accel. Full suite green.
62 lines
1.5 KiB
Go
62 lines
1.5 KiB
Go
// Copyright (C) 2024-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build !cgo || !lux_hqc_native
|
|
|
|
// Pure-Go stub for the CPU path, used whenever native HQC is NOT linked
|
|
// in — i.e. the DEFAULT build (cgo without `-tags=lux_hqc_native`) and
|
|
// any no-cgo build. HQC requires the PQClean C reference (or a runtime
|
|
// backend); without the native link we fail cleanly rather than drag a
|
|
// luxcpp static-lib dependency into every build. Opt in with
|
|
// `-tags=lux_hqc_native` (see code_cpu.go) to link libluxgpu_hqc.
|
|
|
|
package code
|
|
|
|
// All entry points return ErrNativeHQCUnavailable (defined in code.go):
|
|
// native HQC is not linked in this build. Opt in with -tags=lux_hqc_native.
|
|
|
|
func hqcKeypairCPU(mode Mode, pks, sks, seeds []byte, count int) error {
|
|
_ = mode
|
|
_ = pks
|
|
_ = sks
|
|
_ = seeds
|
|
_ = count
|
|
return ErrNativeHQCUnavailable
|
|
}
|
|
|
|
func hqcEncapsCPU(mode Mode, cts, sss, pks, seeds []byte, count int) error {
|
|
_ = mode
|
|
_ = cts
|
|
_ = sss
|
|
_ = pks
|
|
_ = seeds
|
|
_ = count
|
|
return ErrNativeHQCUnavailable
|
|
}
|
|
|
|
func hqcDecapsCPU(mode Mode, sss, cts, sks []byte, count int) error {
|
|
_ = mode
|
|
_ = sss
|
|
_ = cts
|
|
_ = sks
|
|
_ = count
|
|
return ErrNativeHQCUnavailable
|
|
}
|
|
|
|
func gf2PolymulCPU(mode Mode, c, a, b []uint64, count int) error {
|
|
_ = mode
|
|
_ = c
|
|
_ = a
|
|
_ = b
|
|
_ = count
|
|
return ErrNativeHQCUnavailable
|
|
}
|
|
|
|
func rsDecodeCPU(mode Mode, msgs, cdws []byte, count int) error {
|
|
_ = mode
|
|
_ = msgs
|
|
_ = cdws
|
|
_ = count
|
|
return ErrNativeHQCUnavailable
|
|
}
|