diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-15 09:20:31 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-15 09:20:31 +0800 |
commit | 238f39a42ecaf489f0dbbf880e6d8f8e86791f1d (patch) | |
tree | b1f39339f97657ac759f59fa030754ba923b144c /crypto/secp256k1/secp256.go | |
parent | 09e53367a24025564686af42c8349d2bd05729c3 (diff) | |
download | dexon-238f39a42ecaf489f0dbbf880e6d8f8e86791f1d.tar.gz dexon-238f39a42ecaf489f0dbbf880e6d8f8e86791f1d.tar.zst dexon-238f39a42ecaf489f0dbbf880e6d8f8e86791f1d.zip |
Validate seckey when generating pub key
Diffstat (limited to 'crypto/secp256k1/secp256.go')
-rw-r--r-- | crypto/secp256k1/secp256.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/secp256k1/secp256.go b/crypto/secp256k1/secp256.go index c1e37629e..4864e8d09 100644 --- a/crypto/secp256k1/secp256.go +++ b/crypto/secp256k1/secp256.go @@ -15,8 +15,9 @@ import "C" import ( "bytes" "errors" - "github.com/ethereum/go-ethereum/crypto/randentropy" "unsafe" + + "github.com/ethereum/go-ethereum/crypto/randentropy" ) //#define USE_FIELD_5X64 @@ -85,6 +86,10 @@ func GenerateKeyPair() ([]byte, []byte) { } func GeneratePubKey(seckey []byte) ([]byte, error) { + if err := VerifySeckeyValidity(seckey); err != nil { + return nil, err + } + pubkey_len := C.int(65) const seckey_len = 32 |