mirror of
https://github.com/luxfi/accel.git
synced 2026-10-30 17:03:45 +00:00
Phase-1 wire-up for the canonical secp256k1 path:
* crypto_secp256k1.go package doc + Phase-1 surface notes
* crypto_secp256k1_cgo.go CGO bindings to luxcpp/crypto/secp256k1
(built with -tags=lux_crypto_native)
* crypto_secp256k1_stub.go Default build returns ErrCryptoNativeUnavailable
* crypto_secp256k1_native_test.go Go-side test exercising the cgo path
Build:
go build ./... # default, no native lib needed
go build -tags=lux_crypto_native ./... # links liblux_crypto_secp256k1
go test -tags=lux_crypto_native ./... # runs native tests
The CGO binding links statically against
luxcpp/crypto/build-canonical/secp256k1/libsecp256k1_cpu.a (path is configurable
via the standard cgo LDFLAGS chain). The C ABI is stable per
include/lux/crypto/secp256k1.h.
Subsequent agents wire bls12381, mldsa, mlkem, etc. through the same pattern.
25 lines
870 B
Go
25 lines
870 B
Go
// Copyright (C) 2024-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build !cgo || !lux_crypto_native
|
|
// +build !cgo !lux_crypto_native
|
|
|
|
package accel
|
|
|
|
import "errors"
|
|
|
|
// ErrCryptoNativeUnavailable indicates the lux_crypto native libraries are not
|
|
// linked into this build. Rebuild with `-tags=lux_crypto_native` and ensure
|
|
// liblux_crypto_secp256k1.a is on the linker path.
|
|
var ErrCryptoNativeUnavailable = errors.New("accel: lux_crypto native not built (use -tags=lux_crypto_native)")
|
|
|
|
// CryptoSecp256k1Ecrecover stub.
|
|
func CryptoSecp256k1Ecrecover(hash, r, s []byte, v byte) ([]byte, error) {
|
|
return nil, ErrCryptoNativeUnavailable
|
|
}
|
|
|
|
// CryptoSecp256k1EcrecoverBatch stub.
|
|
func CryptoSecp256k1EcrecoverBatch(inputs []byte) (pubkeys, statuses []byte, err error) {
|
|
return nil, nil, ErrCryptoNativeUnavailable
|
|
}
|