-
Notifications
You must be signed in to change notification settings - Fork 179
DTLS 1.3 signature_algorithms_cert Extension #788
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #788 +/- ##
==========================================
- Coverage 81.72% 81.69% -0.04%
==========================================
Files 108 110 +2
Lines 6062 6161 +99
==========================================
+ Hits 4954 5033 +79
- Misses 712 728 +16
- Partials 396 400 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
419ae92 to
aa4aef6
Compare
|
This PR needs some clean-up and a lot more unit tests. But I figured I'd open it and ask for any early feedback cc:// @theodorsm @JoTurk |
aa4aef6 to
f8ccea5
Compare
f8ccea5 to
ba183cf
Compare
|
This PR is ready for formal review now. |
|
If you want to play with the new |
theodorsm
left a comment
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.
conn.go
Outdated
| // Parse certificate signature schemes (if provided) | ||
| // If not provided, certificate validation will fall back to signatureSchemes | ||
| var certSignatureSchemes []signaturehash.Algorithm | ||
| if len(config.CertificateSignatureSchemes) > 0 { | ||
| certSignatureSchemes, err = signaturehash.ParseSignatureSchemes( | ||
| config.CertificateSignatureSchemes, | ||
| config.InsecureHashes, | ||
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| } | ||
|
|
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.
Is signaturesSchemes set as fallback (I do support it tho, as that how they do it in /crypto/tls)? The way I read the code, it is not currently.
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.
Shoot -- very good catch -- thank you!
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.
Actually... I just removed the fallback comment... now there is no fallback.
Can you point me to where in /crypto/tls the code falls back? AFAICT, there is no config setting for the _cert option in crypto/tls.
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 see you removed the comment, but I do think we should set the signaturesSchemes as fallback as they do in /crypto/tls. https://cs.opensource.google/go/go/+/master:src/crypto/tls/handshake_client.go;l=123;drc=acd65ebb13a11f1b070b63a66b35bb1b15934409
That is, we should start to send the signature_algorithms_cert with DTLS 1.2 with the default list provided by ParseSignatureSchemes. If we remove the length check it should do that, like we do with signatureSchemes above.
2614981 to
e956596
Compare
|
Thanks for the review @theodorsm. Looking forward to your @JoTurk :D I've made your requested changes in new commits @theodorsm , just to make review easier. Once you are happy I will squash into 1. |
c409294 to
ddf8c35
Compare
ddf8c35 to
5c1d633
Compare
theodorsm
left a comment
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.
Wow, thanks for the fast fix @adrianosela. I like the generic signature extension.
I went over it once more and noticed two things.
conn.go
Outdated
| // Parse certificate signature schemes (if provided) | ||
| // If not provided, certificate validation will fall back to signatureSchemes | ||
| var certSignatureSchemes []signaturehash.Algorithm | ||
| if len(config.CertificateSignatureSchemes) > 0 { | ||
| certSignatureSchemes, err = signaturehash.ParseSignatureSchemes( | ||
| config.CertificateSignatureSchemes, | ||
| config.InsecureHashes, | ||
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| } | ||
|
|
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 see you removed the comment, but I do think we should set the signaturesSchemes as fallback as they do in /crypto/tls. https://cs.opensource.google/go/go/+/master:src/crypto/tls/handshake_client.go;l=123;drc=acd65ebb13a11f1b070b63a66b35bb1b15934409
That is, we should start to send the signature_algorithms_cert with DTLS 1.2 with the default list provided by ParseSignatureSchemes. If we remove the length check it should do that, like we do with signatureSchemes above.
d45deb6 to
211fed9
Compare
211fed9 to
8ec7ed9
Compare
|
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 so sorry about the back-and-forth, but I had to take a bit longer time to reason about the handshake state machine. I added more comments.
Also, we should do as you did previously, with checking for the length of the provided CertificateSignatureSchemes and not fallback to signaturesSchemes in config. I looked at some captures from firefox and chrome and they do not add the signature_algorithms_cert by default. We have the same policy for both extensions:
Implementations which have the same policy in both cases MAY omit the "signature_algorithms_cert" extension.
298f8d8 to
7d91c46
Compare
theodorsm
left a comment
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.
LGTM! Let's rebase and merge once the config options are merged.
DTLS 1.3 signature_algorithms_cert Extension
Addresses part of #776: Adds support for the
signature_algorithms_certextension.Note: Per https://www.rfc-editor.org/rfc/rfc8446#section-4.2.3 and https://www.rfc-editor.org/rfc/rfc8446#section-1.3 this extension may optionally apply to DTLS 1.2, so we can safely ship any net-new additions to the API e.g.
CertificateSignatureSchemesin config.