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
8c1e8de8
Unverified
Commit
8c1e8de8
authored
Nov 25, 2019
by
Guillaume Ballet
Committed by
GitHub
Nov 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts/keystore: fix staticcheck warnings (#20373)
* accounts/keystore: fix staticcheck warnings * review feedback
parent
b26eedf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
passphrase.go
accounts/keystore/passphrase.go
+5
-4
No files found.
accounts/keystore/passphrase.go
View file @
8c1e8de8
...
@@ -123,6 +123,7 @@ func (ks keyStorePassphrase) StoreKey(filename string, key *Key, auth string) er
...
@@ -123,6 +123,7 @@ func (ks keyStorePassphrase) StoreKey(filename string, key *Key, auth string) er
"Please file a ticket at:
\n\n
"
+
"Please file a ticket at:
\n\n
"
+
"https://github.com/ethereum/go-ethereum/issues."
+
"https://github.com/ethereum/go-ethereum/issues."
+
"The error was : %s"
"The error was : %s"
//lint:ignore ST1005 This is a message for the user
return
fmt
.
Errorf
(
msg
,
tmpName
,
err
)
return
fmt
.
Errorf
(
msg
,
tmpName
,
err
)
}
}
}
}
...
@@ -237,7 +238,7 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
...
@@ -237,7 +238,7 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
func
DecryptDataV3
(
cryptoJson
CryptoJSON
,
auth
string
)
([]
byte
,
error
)
{
func
DecryptDataV3
(
cryptoJson
CryptoJSON
,
auth
string
)
([]
byte
,
error
)
{
if
cryptoJson
.
Cipher
!=
"aes-128-ctr"
{
if
cryptoJson
.
Cipher
!=
"aes-128-ctr"
{
return
nil
,
fmt
.
Errorf
(
"
C
ipher not supported: %v"
,
cryptoJson
.
Cipher
)
return
nil
,
fmt
.
Errorf
(
"
c
ipher not supported: %v"
,
cryptoJson
.
Cipher
)
}
}
mac
,
err
:=
hex
.
DecodeString
(
cryptoJson
.
MAC
)
mac
,
err
:=
hex
.
DecodeString
(
cryptoJson
.
MAC
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -273,7 +274,7 @@ func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error) {
...
@@ -273,7 +274,7 @@ func DecryptDataV3(cryptoJson CryptoJSON, auth string) ([]byte, error) {
func
decryptKeyV3
(
keyProtected
*
encryptedKeyJSONV3
,
auth
string
)
(
keyBytes
[]
byte
,
keyId
[]
byte
,
err
error
)
{
func
decryptKeyV3
(
keyProtected
*
encryptedKeyJSONV3
,
auth
string
)
(
keyBytes
[]
byte
,
keyId
[]
byte
,
err
error
)
{
if
keyProtected
.
Version
!=
version
{
if
keyProtected
.
Version
!=
version
{
return
nil
,
nil
,
fmt
.
Errorf
(
"
V
ersion not supported: %v"
,
keyProtected
.
Version
)
return
nil
,
nil
,
fmt
.
Errorf
(
"
v
ersion not supported: %v"
,
keyProtected
.
Version
)
}
}
keyId
=
uuid
.
Parse
(
keyProtected
.
Id
)
keyId
=
uuid
.
Parse
(
keyProtected
.
Id
)
plainText
,
err
:=
DecryptDataV3
(
keyProtected
.
Crypto
,
auth
)
plainText
,
err
:=
DecryptDataV3
(
keyProtected
.
Crypto
,
auth
)
...
@@ -335,13 +336,13 @@ func getKDFKey(cryptoJSON CryptoJSON, auth string) ([]byte, error) {
...
@@ -335,13 +336,13 @@ func getKDFKey(cryptoJSON CryptoJSON, auth string) ([]byte, error) {
c
:=
ensureInt
(
cryptoJSON
.
KDFParams
[
"c"
])
c
:=
ensureInt
(
cryptoJSON
.
KDFParams
[
"c"
])
prf
:=
cryptoJSON
.
KDFParams
[
"prf"
]
.
(
string
)
prf
:=
cryptoJSON
.
KDFParams
[
"prf"
]
.
(
string
)
if
prf
!=
"hmac-sha256"
{
if
prf
!=
"hmac-sha256"
{
return
nil
,
fmt
.
Errorf
(
"
U
nsupported PBKDF2 PRF: %s"
,
prf
)
return
nil
,
fmt
.
Errorf
(
"
u
nsupported PBKDF2 PRF: %s"
,
prf
)
}
}
key
:=
pbkdf2
.
Key
(
authArray
,
salt
,
c
,
dkLen
,
sha256
.
New
)
key
:=
pbkdf2
.
Key
(
authArray
,
salt
,
c
,
dkLen
,
sha256
.
New
)
return
key
,
nil
return
key
,
nil
}
}
return
nil
,
fmt
.
Errorf
(
"
U
nsupported KDF: %s"
,
cryptoJSON
.
KDF
)
return
nil
,
fmt
.
Errorf
(
"
u
nsupported KDF: %s"
,
cryptoJSON
.
KDF
)
}
}
// TODO: can we do without this when unmarshalling dynamic JSON?
// TODO: can we do without this when unmarshalling dynamic JSON?
...
...
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