Skip to content

Commit

Permalink
Validate seckey when generating pub key
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed Feb 15, 2015
1 parent 09e5336 commit 238f39a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crypto/secp256k1/secp256.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 238f39a

Please sign in to comment.