-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Whisper v6 remove aesnonce #15578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Whisper v6 remove aesnonce #15578
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0d31e25
whisper: remove AESNonce from envelope in v6
gballet 2640164
whisper: removal of the AESNonce field
gballet a0abb7d
whisper: filter with sym & asym keys must try both methods
gballet 225967a
whisper: Update doc.go constants for v6
gballet 736e756
whisper: make the header size a constant
gballet d13bbc8
whisper: individual filters can only have one type of key
gballet a340851
whisper: aesnonce: fix call to fatalf
gballet ab3763c
whisper/whisperv6: fix whitespace
fjl 8315701
whisper: quell PR #15578 warnings
gballet 35297a8
whisper/whisperv6: gofmt -w -s envelope.go
fjl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // Copyright 2017 The go-ethereum Authors | ||
| // This file is part of the go-ethereum library. | ||
| // | ||
| // The go-ethereum library is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Lesser General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // The go-ethereum library is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Lesser General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| // Contains the tests associated with the Whisper protocol Envelope object. | ||
|
|
||
| package whisperv6 | ||
|
|
||
| import ( | ||
| mrand "math/rand" | ||
| "testing" | ||
|
|
||
| "github.com/ethereum/go-ethereum/crypto" | ||
| ) | ||
|
|
||
| func TestEnvelopeOpenAcceptsOnlyOneKeyTypeInFilter(t *testing.T) { | ||
| symKey := make([]byte, aesKeyLength) | ||
| mrand.Read(symKey) | ||
|
|
||
| asymKey, err := crypto.GenerateKey() | ||
| if err != nil { | ||
| t.Fatalf("failed GenerateKey with seed %d: %s.", seed, err) | ||
| } | ||
|
|
||
| params := MessageParams{ | ||
| PoW: 0.01, | ||
| WorkTime: 1, | ||
| TTL: uint32(mrand.Intn(1024)), | ||
| Payload: make([]byte, 50), | ||
| KeySym: symKey, | ||
| Dst: nil, | ||
| } | ||
|
|
||
| mrand.Read(params.Payload) | ||
|
|
||
| msg, err := NewSentMessage(¶ms) | ||
| if err != nil { | ||
| t.Fatalf("failed to create new message with seed %d: %s.", seed, err) | ||
| } | ||
|
|
||
| e, err := msg.Wrap(¶ms) | ||
| if err != nil { | ||
| t.Fatalf("Failed to Wrap the message in an envelope with seed %d: %s", seed, err) | ||
| } | ||
|
|
||
| f := Filter{KeySym: symKey, KeyAsym: asymKey} | ||
|
|
||
| decrypted := e.Open(&f) | ||
| if decrypted != nil { | ||
| t.Fatalf("Managed to decrypt a message with an invalid filter, seed %d", seed) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the EIP-627 packet codes specifies that:
Support for messages with codes 126 and 127 will be added in subsequent PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change to EIP was made after discussion with Robert (Parity) several months ago.