Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
7bc1cb36
Unverified
Commit
7bc1cb36
authored
May 27, 2019
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts/scwallet: fix public key confirmation regression
parent
75a86088
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
wallet.go
accounts/scwallet/wallet.go
+6
-8
No files found.
accounts/scwallet/wallet.go
View file @
7bc1cb36
...
@@ -982,12 +982,10 @@ func (s *Session) derive(path accounts.DerivationPath) (accounts.Account, error)
...
@@ -982,12 +982,10 @@ func (s *Session) derive(path accounts.DerivationPath) (accounts.Account, error)
copy
(
sig
[
32
-
len
(
rbytes
)
:
32
],
rbytes
)
copy
(
sig
[
32
-
len
(
rbytes
)
:
32
],
rbytes
)
copy
(
sig
[
64
-
len
(
sbytes
)
:
64
],
sbytes
)
copy
(
sig
[
64
-
len
(
sbytes
)
:
64
],
sbytes
)
pubkey
,
err
:=
determinePublicKey
(
sig
,
sigdata
.
PublicKey
)
if
err
:=
confirmPublicKey
(
sig
,
sigdata
.
PublicKey
);
err
!=
nil
{
if
err
!=
nil
{
return
accounts
.
Account
{},
err
return
accounts
.
Account
{},
err
}
}
pub
,
err
:=
crypto
.
UnmarshalPubkey
(
sigdata
.
PublicKey
)
pub
,
err
:=
crypto
.
UnmarshalPubkey
(
pubkey
)
if
err
!=
nil
{
if
err
!=
nil
{
return
accounts
.
Account
{},
err
return
accounts
.
Account
{},
err
}
}
...
@@ -1057,10 +1055,10 @@ func (s *Session) sign(path accounts.DerivationPath, hash []byte) ([]byte, error
...
@@ -1057,10 +1055,10 @@ func (s *Session) sign(path accounts.DerivationPath, hash []byte) ([]byte, error
return
sig
,
nil
return
sig
,
nil
}
}
//
determinePublicKey uses a signature and the X component of a public key to
//
confirmPublicKey confirms that the given signature belongs to the specified key.
// recover the entire public key.
func
confirmPublicKey
(
sig
,
pubkey
[]
byte
)
error
{
func
determinePublicKey
(
sig
,
pubkeyX
[]
byte
)
([]
byte
,
error
)
{
_
,
err
:=
makeRecoverableSignature
(
DerivationSignatureHash
[
:
],
sig
,
pubkey
)
return
makeRecoverableSignature
(
DerivationSignatureHash
[
:
],
sig
,
pubkeyX
)
return
err
}
}
// makeRecoverableSignature uses a signature and an expected public key to
// makeRecoverableSignature uses a signature and an expected public key to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment