mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
parent
3e1f75eafb
commit
6aaad7b72f
1 changed files with 3 additions and 3 deletions
|
|
@ -228,11 +228,11 @@ func (c *ecrecover) Run(input []byte) ([]byte, error) {
|
||||||
}
|
}
|
||||||
// We must make sure not to modify the 'input', so placing the 'v' along with
|
// We must make sure not to modify the 'input', so placing the 'v' along with
|
||||||
// the signature needs to be done on a new allocation
|
// the signature needs to be done on a new allocation
|
||||||
sig := make([]byte, crypto.SignatureLength)
|
var sig [crypto.SignatureLength]byte
|
||||||
copy(sig, input[64:128])
|
copy(sig[:], input[64:128])
|
||||||
sig[64] = v
|
sig[64] = v
|
||||||
// v needs to be at the end for libsecp256k1
|
// v needs to be at the end for libsecp256k1
|
||||||
pubKey, err := crypto.Ecrecover(input[:32], sig)
|
pubKey, err := crypto.Ecrecover(input[:32], sig[:])
|
||||||
// make sure the public key is a valid one
|
// make sure the public key is a valid one
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue