mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-13 19:46:39 +00:00
Validate seckey when generating pub key
This commit is contained in:
parent
09e53367a2
commit
238f39a42e
1 changed files with 6 additions and 1 deletions
|
|
@ -15,8 +15,9 @@ import "C"
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/ethereum/go-ethereum/crypto/randentropy"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/crypto/randentropy"
|
||||||
)
|
)
|
||||||
|
|
||||||
//#define USE_FIELD_5X64
|
//#define USE_FIELD_5X64
|
||||||
|
|
@ -85,6 +86,10 @@ func GenerateKeyPair() ([]byte, []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GeneratePubKey(seckey []byte) ([]byte, error) {
|
func GeneratePubKey(seckey []byte) ([]byte, error) {
|
||||||
|
if err := VerifySeckeyValidity(seckey); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
pubkey_len := C.int(65)
|
pubkey_len := C.int(65)
|
||||||
const seckey_len = 32
|
const seckey_len = 32
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue