diff --git a/Makefile b/Makefile index 70390a49de..3db2c17af7 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,12 @@ else endif endif +# secp256k1 implementation selection +ifeq (libsecp256k1,$(findstring libsecp256k1,$(LBM_BUILD_OPTIONS))) + CGO_ENABLED=1 + BUILD_TAGS += libsecp256k1 +endif + build_tags += $(BUILD_TAGS) build_tags := $(strip $(build_tags)) diff --git a/crypto/keys/secp256k1/secp256k1_cgo.go b/crypto/keys/secp256k1/secp256k1_cgo.go index d0df532f34..de2c9a20f8 100644 --- a/crypto/keys/secp256k1/secp256k1_cgo.go +++ b/crypto/keys/secp256k1/secp256k1_cgo.go @@ -21,6 +21,6 @@ func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) { // VerifySignature validates the signature. // The msg will be hashed prior to signature verification. -func (pubKey *PrivKey) VerifySignature(msg []byte, sig []byte) bool { +func (pubKey *PubKey) VerifySignature(msg []byte, sig []byte) bool { return secp256k1.VerifySignature(pubKey.Key, crypto.Sha256(msg), sig) } diff --git a/go.mod b/go.mod index 266c7c5c38..466d8be9f3 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/kr/text v0.2.0 // indirect github.com/line/iavl/v2 v2.0.0-init.1.0.20210507092458-8331d3daef36 - github.com/line/ostracon v0.34.9-0.20210429084710-ef4fe0a40c7d + github.com/line/ostracon v0.34.9-0.20210512045543-6c7ab0535e10 github.com/line/tm-db/v2 v2.0.0-init.1.0.20210413083915-5bb60e117524 github.com/line/wasmvm v0.14.0-0.5.0 github.com/magiconair/properties v1.8.4 diff --git a/go.sum b/go.sum index 91a40f9a5e..37366211ed 100644 --- a/go.sum +++ b/go.sum @@ -336,8 +336,9 @@ github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55 h1:cXVtMiJkvQ4kn0px github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55/go.mod h1:DHRJroSL7NaRkpvocRx3OtRsleXVsYSxBI9SfHFlTQ0= github.com/line/iavl/v2 v2.0.0-init.1.0.20210507092458-8331d3daef36 h1:811bq0lFSv91AsR9mikOs+ArELnxVeNuYWh8QYUkL6k= github.com/line/iavl/v2 v2.0.0-init.1.0.20210507092458-8331d3daef36/go.mod h1:0Xz+0i1nlB9lrjUDEwpDRhcmjfEAkOjd20dRb40FBso= -github.com/line/ostracon v0.34.9-0.20210429084710-ef4fe0a40c7d h1:/6vnjrk3SpCUUiIDBv8UzbYexabZBYXxkwyc3Bp9hPo= github.com/line/ostracon v0.34.9-0.20210429084710-ef4fe0a40c7d/go.mod h1:ttnbq+yQJMQ9a2MT5SEisOoa/+pOgh2KenTiK/rVdiw= +github.com/line/ostracon v0.34.9-0.20210512045543-6c7ab0535e10 h1:Ab+t7zJRhoHYZlQTtdwOSNUyl+FKGXBj0zKf3658baI= +github.com/line/ostracon v0.34.9-0.20210512045543-6c7ab0535e10/go.mod h1:ttnbq+yQJMQ9a2MT5SEisOoa/+pOgh2KenTiK/rVdiw= github.com/line/tm-db/v2 v2.0.0-init.1.0.20210413083915-5bb60e117524 h1:eKXXnUm1SblC0AIXAMNDaSyvIbQ50yXqFbh9+Q8Kjvg= github.com/line/tm-db/v2 v2.0.0-init.1.0.20210413083915-5bb60e117524/go.mod h1:wmkyPabXjtVZ1dvRofmurjaceghywtCSYGqFuFS+TbI= github.com/line/wasmvm v0.14.0-0.5.0 h1:FRjzcUh+LiTMvCrSoucL7a5DlWHHRQgZ78h8YB8l4Fs=