-
Notifications
You must be signed in to change notification settings - Fork 92
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
supporting X25519 and X448 in the IES style. #205
Conversation
I will try to divide this jumbo patch. Just a moment. |
Sorry. I gave up. Everything is related and I cannot divide it into pieces. |
Some first items I looked yesterday:
I'll try to continue reviewing during the week-end. |
If this is true, this is a fundamental problem between cryptonite and tls. |
|
In my TLS 1.3 branch, If we define |
I don't see any fundamental problem other than the one we had a solution for. Upon closer inspection you removed the call to withRNG, so now the MonadRandom-based crypto runs directly in the IO monad instead of I'm OK for not implementing supportedGroups in this PR, as today we don't have supportedEllipticCurves. We'll obviously want to implement only one, and after your PR that will be supportedGroups. Still for now the list intersection will favor the order from the first argument. So unless there is something I missed, your PR chooses the minimum strength. And that's a change of behavior easy to avoid by reversing the list. |
Here's my last comment about the detailed implementation: you moved functions related to TLS protocol (toGroup, fromGroup) into the "Crypto" modules but this is not related to crypto and would be best elsewhere, like module Struct or Extension. Some ideas for a naming more consistent, tell me what you think:
I think that concludes my review. |
Done.
Done. |
Group includes DH. So, I want to keep as is. |
Now, it is Extension.Group. |
|
Thank you for letting me know this. I have implemented this. |
@ocheron I believe that all issues have been resolved. Please review this PR again. |
I noticed that |
About modules "Crypto" vs "Extension": I was referring only to functions OK for adding supportedGroups. You didn't explain why you chose the minimum strength.
|
The test failure looks like a segmentation fault related to P256. |
If I add Cc: @vincenthz |
Here is a small test to reproduce this: https://gist.github.com/kazu-yamamoto/25b7b4ee7884e30a93355e20f5efe0ac |
It seems to me that |
|
OK. I think that I have resolved all issues. |
We're getting closer... but I see you tried to optimize things by storing the group in the TLS state. I'd rather have the same two-step process than signature_algorithms (i.e. functions hashAndSignaturesInCommon and decideHash). It's probably a bit slower, but more organized. The group is already stored in ServerECDHParams in handshake state. We don't want another copy in the TLS state, especially if it's used only for the duration of one message (ServerHello). |
Also I believe the FIXME in handshakeServerWith has been addressed (or at least the "elliptic curve" part). 👍 for the test suite and the module structure. |
I think I have done everything. |
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!
Thank you for your patient review. |
This implements #204.
First of all, sorry for the jumbo patch. I could not divide this into small pieces.
For the extension name:
NamedCurve
NamedGroup
since DH is integratedI followed the TLS 1.3 way.
To remove duplicated NIST curves and support X25519 and X448:
Extension.EC
is deletedExtension
is modifiedCrypto.Types
is introducedTo integrate NIST curves and X*:
Crypto.IES
is introduced based on ECIES API of cryptoniteCrypto.IES
Note that DH remained as is.