Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Note important commits from Ethereum #249

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4543517
eth/downloader: flush state sync data before exit (#16280)
rjl493456442 Apr 9, 2018
d560218
crypto/secp256k1: catch curve parameter parse errors (#16392)
DavidHuie Apr 3, 2018
5d6329a
core/state: avoid redundant addition to code size cache (#16427)
LLLeon Apr 3, 2018
fa8d7da
cmd/evm: print vm output when debug flag is on (#16326)
dm4 Apr 6, 2018
13ce581
ethdb: add leveldb write delay statistic (#16499)
rjl493456442 Apr 16, 2018
46bef14
eth/downloader: wait for all fetcher goroutines to exit before termin…
rjl493456442 Apr 16, 2018
3e154d3
fix confilt's error
fjl Apr 18, 2018
8401d40
core/asm: accept uppercase instructions (#16531)
dm4 Apr 19, 2018
c9f6b25
rpc: handle HTTP response error codes (#16500)
holiman Apr 19, 2018
8a3670d
ethclient: add DialContext and Close (#16318)
Apr 19, 2018
e0a1567
eth/downloader: fix for Issue #16539 (#16546)
Apr 23, 2018
84b9406
fix confilct's code
countvonzero Apr 24, 2018
3c0da05
fix confilct's code
fjl Apr 27, 2018
18d1858
vendor: fix leveldb crash when bigger than 1 TiB
May 1, 2018
bc0b61d
p2p: don't discard reason set by Disconnect (#16559)
gsalgado May 8, 2018
1ed2030
eth/filter: check nil pointer when unsubscribe (#16682)
rjl493456442 May 9, 2018
1ba07fc
fix conflict's code
ryanschneider Jun 2, 2018
eede85f
fix confilct codes
karalabe Jun 4, 2018
83ad233
rpc: set timeouts for http server, see #16859
holiman Jun 4, 2018
1881d68
eth/tracers: fix minor off-by-one error (#16879)
holiman Jun 5, 2018
c351f7f
trie: reduce hasher allocations (#16896)
fjl Jun 5, 2018
3e35f38
trie: avoid unnecessary slicing on shortnode decoding (#16917)
Jun 7, 2018
c1547de
ethclient: fix RPC parse error of Parity response (#16924)
stevenroose Jun 11, 2018
4c01142
core/vm: optimize MSTORE and SLOAD (#16939)
holiman Jun 14, 2018
a808af2
trie: cache collapsed tries node, not rlp blobs (#16876)
karalabe Jun 21, 2018
d1a8ec9
trie: fix a temporary memory leak in the memcache
karalabe Jul 2, 2018
3ffb68f
core/vm: reuse bigint pools across transactions (#17070)
gballet Jul 3, 2018
b517a71
core, ethdb: two tiny fixes
rjl493456442 Jul 18, 2018
6d5479e
rpc: clean up check for missing methods/subscriptions on handler (#17…
jsvisa Jul 24, 2018
40cd1c8
core, crypto, params: implement CREATE2 evm instrction (#17196)
rjl493456442 Jul 24, 2018
c014695
core/vm, params: implement EXTCODEHASH opcode
rjl493456442 Jul 24, 2018
a313f8c
crypto/secp256k1: remove external LGPL dependencies (#17239)
karalabe Jul 26, 2018
ca5b06c
p2p: fix rare deadlock in Stop (#17260)
janos Jul 30, 2018
68ce480
trie: handle removing the freshest node too
karalabe Jul 30, 2018
41d6de5
miner: fix state locking while writing to chain (issue #16933) (#17173)
AlexeyAkhunov Jul 31, 2018
aabd32e
p2p: use safe atomic operations when changing connFlags
zsfelfoldi Aug 6, 2018
cfe81b7
p2p/discv5: fix negative index after uint convert to int (#17274)
libotony Aug 9, 2018
f3e7f4a
eth, trie: fix tracer GC which accidentally pruned the metaroot
karalabe Aug 8, 2018
02e4bf1
crypto: change formula for create2 (#17393)
rjl493456442 Aug 14, 2018
cf1e10f
crypto/bn256: fix issues caused by Go 1.11
karalabe Aug 9, 2018
91d9519
rpc: reset client write deadline after write (#17549)
gislik Sep 3, 2018
ff2a302
6a33954731658667056466bf7573ed1c397f4750
jsvisa Sep 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions accounts/keystore/keystore_passphrase.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ package keystore
import (
"bytes"
"crypto/aes"
crand "crypto/rand"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"path/filepath"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/randentropy"
"github.com/pborman/uuid"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/scrypt"
Expand Down Expand Up @@ -93,7 +93,7 @@ func (ks keyStorePassphrase) GetKey(addr common.Address, filename, auth string)

// StoreKey generates a key, encrypts with 'auth' and stores in the given directory
func StoreKey(dir, auth string, scryptN, scryptP int) (common.Address, error) {
_, a, err := storeNewKey(&keyStorePassphrase{dir, scryptN, scryptP}, crand.Reader, auth)
_, a, err := storeNewKey(&keyStorePassphrase{dir, scryptN, scryptP}, rand.Reader, auth)
return a.Address, err
}

Expand All @@ -117,15 +117,22 @@ func (ks keyStorePassphrase) JoinPath(filename string) string {
// blob that can be decrypted later on.
func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error) {
authArray := []byte(auth)
salt := randentropy.GetEntropyCSPRNG(32)

salt := make([]byte, 32)
if _, err := io.ReadFull(rand.Reader, salt); err != nil {
panic("reading from crypto/rand failed: " + err.Error())
}
derivedKey, err := scrypt.Key(authArray, salt, scryptN, scryptR, scryptP, scryptDKLen)
if err != nil {
return nil, err
}
encryptKey := derivedKey[:16]
keyBytes := math.PaddedBigBytes(key.PrivateKey.D, 32)

iv := randentropy.GetEntropyCSPRNG(aes.BlockSize) // 16
iv := make([]byte, aes.BlockSize) // 16
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
panic("reading from crypto/rand failed: " + err.Error())
}
cipherText, err := aesCTRXOR(encryptKey, keyBytes, iv)
if err != nil {
return nil, err
Expand Down
Loading