DTLS 1.3 RSA-PSS Signature Scheme Support#778
Conversation
|
Also, AFAICT this is the last of the mandatory-to-Implement signatures ( |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #778 +/- ##
==========================================
+ Coverage 81.60% 81.75% +0.14%
==========================================
Files 107 108 +1
Lines 5937 6062 +125
==========================================
+ Hits 4845 4956 +111
- Misses 699 710 +11
- Partials 393 396 +3
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:
|
|
Some early thoughts on this from you would be really awesome :D - if you have time, of course. This PR implements what's noted above, but wanted to also use it as a discussion point for this comment from @theodorsm :
|
|
Some quick comments to add to the discussion: We are having a disucssion about DTLS 1.2 and DTLS 1.3 architectural separation in PR #738. So far I am thinking to split off the code in I support the functional optional config as this is the way forward for Pion (#765). I will take a closer look at this draft in the coming week. |
|
for #765 I'll open a PR soon for the config pattern, I did work on it but I forgot to push it. |
Will hold off working on this till then :) |
fd8b024 to
c91c131
Compare
|
RE: linter errors due to non camelCase. e.g. What do you prefer:
I am indifferent between 1 and 2, though leaning towards 1 despite 2 being most readable. What do you think @JoTurk @theodorsm |
Ones in srtp_protection_profile.go have nolint annotations, do the same here. |
I prefer 2. Ignore the linter errors with Line 28 in 44160f0 |
|
ACK, thanks both @sirzooro, @theodorsm . Another question. API compat test still complains about If so, I will follow your other suggestion: a new |
fa85d07 to
b6ec0c1
Compare
Yeah nolint is the right choice, we can make it less ugly in the next lint upgrade with whitelisting packages. this linter is nice for other libraries but i found it annoying having to add all the nolints, I kinda regret not making a whitelist for dtls when I added it. |
|
I think this is good enough to go in @theodorsm , should I just go the |
Sorry i was busy with the on-boarding for a new job, I'm reviewing this right now :) |
Hmm, I am a bit unsure. Do we expect more options in the future for SignatureScheme? If so, the functional approach might perhaps be worth the API change, but @JoTurk has more insight into updating the config options across pion. |
|
I'm going to open a PR now to add options patterns to dtls, it's going to be similar to the one in mdns, because we have server / clients, we shouldn't break the API until we release 1.3 because if we do we'll have to push a major version or stop releasing 1.2 fixes until we do (we can cherry-pick releases but it will be super hard). |
|
Perhaps going for the |
|
Yeah, good idea @theodorsm . Will do. |
Actually... I'll think about this a little bit.. there will be an import cycle if I use I'm thinking just making a new, public I don't think there will be any new options/config to add to that. |
14db2e8 to
399ef5b
Compare
|
After this goes out, I'll PR master...adrianosela:dtls:sig-algs-update, which adds support for the |
theodorsm
left a comment
There was a problem hiding this comment.
Left some comments. I like the split up of APIs.
Might be because I don't fully understand the difference between RSA_PSS_PSS and RSA_PSS_RSAE, but does this even add support for RSA_PSS_PSS? As far as I have understood it, the difference is the OID in the x509 certificate. But I don't see any other TLS implementations offering RSA_PSS_PSS.
afd5d2e to
efd164b
Compare
TL;DR; yes, this PR does add support for RSA_PSS_PSS and the behaviour is identical to the RSAE variants (just different identifiers). Most implementations out there don't seem to handle RSA_PSS_PSS explicitly (e.g. Go's TLS impl doesn't for example), but OpenSSL does. I have to run now, but will give you a more thoughful response later. Your other comments have been addressed. |
|
Alright, promised follow-up on So yeah the difference is purely the certificate OID, and from a signature validation standpoint, there is no difference.
Both are defined independently in the RFC but signature-wise they're the same (same PSS padding, same crypto operations, just different identifiers telling us what kind of cert to expect). Most other implementations don't handle But OpenSSL actually does support both since:
OpenSSL supports generating pss pss certs and all… After reading up a bit RSA-PSS certificates with OID Happy to remove the PSS variants if you think it's better to just match the Go implementation... or keep it since (most) of the code is already there, and tests now cover both variants (per your feedback). I say most because of the next point: One thing realized though (raised by your question, so thanks for probing!) is that if we do keep the PSS variants, I think we have to verify the cert's OIDs to ensure we don't accept an invalid combination e.g.
Accepting an invalid combo would imply RFC violation. This is a good read btw https://crypto.stackexchange.com/questions/58680/whats-the-difference-between-rsa-pss-pss-and-rsa-pss-rsae-schemes Based on the above, what do you prefer cc:// @JoTurk: (1) Drop I'm happy with either outcome, leaning towards (1). What do you think? If we do want RFC completeness, we need to go for option 2 I think, despite likely to never be exercised in the real world. |
|
I implemented option (2) in a new commit so you can see the diff (what it takes to implement). I'm still happy dropping and going with (1). |
efb675e to
fe0cc35
Compare
|
Worth reading this Gophers Slack thread: https://gophers.slack.com/archives/C6CKB7AA2/p1769227326506359 |
|
@adrianosela, thanks for the thorough follow-up, especially with the slack thread! Hmm, I would then be leaning towards not offering Great catch on the verification of the OID, I think we should still keep it even if we don't offer I guess my suggestion is a mix between your two options. |
5640d0c to
d403a2e
Compare
Sounds good to me. Are the changes in dde3bf7 what you had in mind? |
theodorsm
left a comment
There was a problem hiding this comment.
@adrianosela this looks great now! 💯 Thanks for all the work and discusssions about approaches
JoTurk
left a comment
There was a problem hiding this comment.
super cool, also had fun reading the discussion here :) sorry that i wasn't super available to write review comments for this PR. but i read the PR few times, looks good.
|
Thank you for the thorough reviews! @JoTurk @theodorsm |
DTLS 1.3 RSA-PSS Signature Scheme Support
Address part of #776
Adds support for the
RSA_PSS_RSAE_SHA256digital signature algorithm, which is mandatory-to-implement per RFC 8446 section 9.1.Also adds support for:
RSA_PSS_RSAE_SHA384RSA_PSS_RSAE_SHA512RSA_PSS_PSS_SHA256RSA_PSS_PSS_SHA384RSA_PSS_PSS_SHA512This is all dead code, but I opted for a small, self-contained, PR. Next up is a bigger change: implementing the
signature_algorithms_certextension, but perhaps this PR is enough to start the conversation for #776 (comment). cc:// @theodorsmBasically, breaks
SelectSignatureScheme:func([]Algorithm, crypto.PrivateKey) (Algorithm, error)func([]Algorithm, crypto.PrivateKey, protocol.Version) (Algorithm, error)But if we don't want to break the API we could do something like this:
and
and can still be called the way it is called today:
but also
I'm new here so I don't know how much we care or don't care about breaking this contract - but either way, there is a way forward (and I really like the functional optional config options).