Tear `0013-whisperv6-notifications.patch` into two different patches (#657)

This commit is contained in:
Pedro Pombeiro 2018-02-13 10:14:57 +01:00 committed by GitHub
parent 5503278899
commit ffef611295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 38 deletions

View File

@ -0,0 +1,36 @@
diff --git a/whisper/notifications/utils.go b/whisper/notifications/utils.go
index 106752186..cca3fba71 100644
--- a/whisper/notifications/utils.go
+++ b/whisper/notifications/utils.go
@@ -1,11 +1,12 @@
package notifications
import (
+ "crypto/sha256"
"crypto/sha512"
"errors"
- "crypto/sha256"
crand "crypto/rand"
+
whisper "github.com/ethereum/go-ethereum/whisper/whisperv5"
"golang.org/x/crypto/pbkdf2"
)
@@ -24,7 +25,7 @@ func makeSessionKey() ([]byte, error) {
}
key := buf[:keyLen]
- derived, err := deriveKeyMaterial(key, whisper.EnvelopeVersion)
+ derived, err := deriveKeyMaterial(key, whisper.ProtocolVersion)
if err != nil {
return nil, err
} else if !validateSymmetricKey(derived) {
@@ -63,7 +64,7 @@ func deriveKeyMaterial(key []byte, version uint64) (derivedKey []byte, err error
}
// MakeTopic returns Whisper topic *as bytes array* by generating cryptographic key from the provided password
-func MakeTopicAsBytes(password []byte) ([]byte) {
+func MakeTopicAsBytes(password []byte) []byte {
topic := make([]byte, int(whisper.TopicLength))
x := pbkdf2.Key(password, password, 8196, 128, sha512.New)
for i := 0; i < len(x); i++ {

View File

@ -1,39 +1,3 @@
diff --git a/whisper/notifications/utils.go b/whisper/notifications/utils.go
index 106752186..cca3fba71 100644
--- a/whisper/notifications/utils.go
+++ b/whisper/notifications/utils.go
@@ -1,11 +1,12 @@
package notifications
import (
+ "crypto/sha256"
"crypto/sha512"
"errors"
- "crypto/sha256"
crand "crypto/rand"
+
whisper "github.com/ethereum/go-ethereum/whisper/whisperv5"
"golang.org/x/crypto/pbkdf2"
)
@@ -24,7 +25,7 @@ func makeSessionKey() ([]byte, error) {
}
key := buf[:keyLen]
- derived, err := deriveKeyMaterial(key, whisper.EnvelopeVersion)
+ derived, err := deriveKeyMaterial(key, whisper.ProtocolVersion)
if err != nil {
return nil, err
} else if !validateSymmetricKey(derived) {
@@ -63,7 +64,7 @@ func deriveKeyMaterial(key []byte, version uint64) (derivedKey []byte, err error
}
// MakeTopic returns Whisper topic *as bytes array* by generating cryptographic key from the provided password
-func MakeTopicAsBytes(password []byte) ([]byte) {
+func MakeTopicAsBytes(password []byte) []byte {
topic := make([]byte, int(whisper.TopicLength))
x := pbkdf2.Key(password, password, 8196, 128, sha512.New)
for i := 0; i < len(x); i++ {
diff --git a/whisper/whisperv6/api.go b/whisper/whisperv6/api.go
index 8ae2882e1..7c97f0680 100644
--- a/whisper/whisperv6/api.go

View File

@ -27,8 +27,9 @@ Instructions for creating a patch from the command line:
- [`0009-whisper-envelopes-tracing.patch`](./0009-whisper-envelopes-tracing.patch) — adds Whisper envelope tracing (need to be reviewed and documented)
- [`0010-geth-17-fix-npe-in-filter-system.patch`](./0010-geth-17-fix-npe-in-filter-system.patch) - Temp patch for 1.7.x to fix a NPE in the filter system.
- [`0011-geth-17-whisperv6-70fbc87.patch`](./0011-geth-17-whisperv6-70fbc87.patch) - Temp patch for 1.7.x to update whisper v6 to the upstream version at the `70fbc87` SHA1.
- [`0013-whisperv6-notifications.patch`](./0013-whisperv6-notifications.patch) — adds Whisper v6 notifications (need to be reviewed and documented)
- [`0014-whisperv6-envelopes-tracing.patch`](./0014-whisperv6-envelopes-tracing.patch) — adds Whisper v6 envelope tracing (need to be reviewed and documented)
- [`0013-whisperv6-notifications-envelopeversion.patch`](./0013-whisperv6-notifications-envelopeversion.patch) — replaces usage of EnvelopeVersion with ProtocolVersion in notifications for Whisper v6
- [`0014-whisperv6-notifications.patch`](./0014-whisperv6-notifications.patch) — adds Whisper v6 notifications (need to be reviewed and documented)
- [`0015-whisperv6-envelopes-tracing.patch`](./0015-whisperv6-envelopes-tracing.patch) — adds Whisper v6 envelope tracing (need to be reviewed and documented)
# Updating upstream version