-
Notifications
You must be signed in to change notification settings - Fork 112
pss: Distill whisper elements in pss to a custom fallback crypto #1731
Conversation
Distilled whisper message structure and encryption to default crypto implementation. Added Topic to PssMsg Simplified PssMsg Payload to []byte
Doc added for Crypto
After this is merged, please ping me so I rebase #1734, as it builds on this work. |
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.
I am a bit skeptical whether this is not premature abstraction. I got the feeling that if it comes to actually use other crypto, it may not fit the interfaces designed here.
For sepration of concerns and code readability, I like the PR though, just suggest that the implementations are grouped by Asymmetric, Symmetric and Message.
and the interfaces i would define where they are used.
i also recommend naming which reads well.
crypto.Symmetric.Create() instead of crypto.cryptoBackend.GenerateSym()
crypto.Assymmetric.Get(id) instead of cryptoUtils.GetPrivate()
cache.Has(..) instead of checkFwdCache()
cache.Put(..) instead of addFwdCache()
About the "early abstraction", there is a second and third step in #1655 to define a crypto API ( Define a modular crypto API based on a selection of reference message crypto implementations). In factr @nolash talked about deciding the API in a SWIP. |
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 is first half of review. I will continue later today.
Removed unused method in crypto.go
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.
great work! a few minor comments
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.
I will make another pass on this, not on the delta, but on the code itself as a whole now.
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.
agree, better, simpler
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.
Most of this review was done before our call where we agreed rather merge sooner than later and define further issues for relevant comments that are not addressed. Can we please go through the comments and identify which should be future issues? The more trivial changes should be done now, IMO.
Removed
message.go
file contained references to whisper message and envelope code. All that whisper code has been copied and distilled into swarm/pss/crypto as the default crypto implementation.Crypto interface now is composed of 3 interfaces.
Sealing the message (poW and Nonce) has been completely removed.
We keep the whisper structure of encrypted message with the format:
flags+payloadSize+payload+padding+signature
but only inside the default crypto implementation. Now the payload of the whisper message is a simple
[]byte
.Padding is now an internal thing of the crypto implementation. Currently we have kept whisper padding, but maybe we can remove it. We are using fixed padding (as previous version) but left a method for implementing flexible padding.
Moved
crypto.go
to new packagepss/crypto
.Moved
cryptoUtils
tocrypto/utils.go
Benchmark tests have improved a bit mainly in larger keys:
This branch:
Master:
Implement subtask #1703