Skip to content
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

DTLS 1.3: Place start of ClientHello correctly when calculating binder #24426

Open
wants to merge 9 commits into
base: feature/dtls-1.3
Choose a base branch
from

Conversation

fwh-dc
Copy link
Contributor

@fwh-dc fwh-dc commented May 16, 2024

I found out that the msgstart and the binderoffset are calculated incorrectly for DTLS 1.3. I'm not sure exactly why, but it seems like it is off with the size of the handshake message header. Maybe you have a suggestion to a better fix than my original commit? It also appears that the maxfragmentlen is parsed wrongly.

@fwh-dc
Copy link
Contributor Author

fwh-dc commented May 16, 2024

@mattcaswell @t8m Please have a look.

ssl/statem/extensions_clnt.c Outdated Show resolved Hide resolved
@github-actions github-actions bot added the severity: fips change The pull request changes FIPS provider sources label May 23, 2024
ssl/statem/extensions_srvr.c Outdated Show resolved Hide resolved
ssl/statem/statem_dtls.c Show resolved Hide resolved
ssl/statem/statem_dtls.c Outdated Show resolved Hide resolved
ssl/statem/statem_dtls.c Outdated Show resolved Hide resolved
ssl/statem/statem_dtls.c Outdated Show resolved Hide resolved
ssl/statem/statem_dtls.c Show resolved Hide resolved
@mattcaswell
Copy link
Member

CI failure looks relevant

@fwh-dc
Copy link
Contributor Author

fwh-dc commented May 24, 2024

CI failure looks relevant

Agreed. It was there with the first commit. I'll give it a look now.

Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One minor comment and the CI failure to resolve.

ssl/statem/statem_dtls.c Show resolved Hide resolved
@fwh-dc
Copy link
Contributor Author

fwh-dc commented May 26, 2024

Looks good. One minor comment and the CI failure to resolve.

Fixed the minor.
For the CI failure I am treating SCTP as broken for DTLSv1.3. I have it on my todo list.

There's a failure on the latest commit which I don't believe is relevant.

Out of curiosity: How is the SCTP auth export supposed to work? I see that the SSL_export_keying_material() gets called in tls_process_server_hello(). And that the former calls tls1_export_keying_material()/tls13_export_keying_material(). The tls13_export_keying_material() adds some sanitity checks and one of them namely ossl_statem_export_allowed() is failing.

As far as I understand this check should only pass after the FINISH message, so how is that supposed to work when it gets called from the tls_process_server_hello()?

@mattcaswell
Copy link
Member

Out of curiosity: How is the SCTP auth export supposed to work? I see that the SSL_export_keying_material() gets called in tls_process_server_hello(). And that the former calls tls1_export_keying_material()/tls13_export_keying_material(). The tls13_export_keying_material() adds some sanitity checks and one of them namely ossl_statem_export_allowed() is failing.

As far as I understand this check should only pass after the FINISH message, so how is that supposed to work when it gets called from the tls_process_server_hello()?

The current code only gets called from tls_process_server_hello in the event of s->hit being true (i.e. we are resuming). Obviously in the current code we are always talking about DTLSv1.2 or below so we only ever go into tls1_export_keying_material (tls13_export_keying_material is obviously currently only relevant in non-DTLS cases).

tls1_export_keying_material can be called prior to the finish and is only dependent on the client and server random values having been exchanged and there being a master key in the session. Since we are resuming that master key is already present even at this early stage. So everything all works out ok for SCTP.

It seems to me that SCTP is not yet well defined in the DTLSv1.3 case. There is a draft:

https://www.ietf.org/archive/id/draft-tuexen-tsvwg-rfc6083-bis-04.html

@tuexen might be able to comment further on its status.

I would suggest that we don't attempt to enable SCTP for DTLSv1.3 until an actual RFC exists for it.

@fwh-dc
Copy link
Contributor Author

fwh-dc commented May 29, 2024

I would suggest that we don't attempt to enable SCTP for DTLSv1.3 until an actual RFC exists for it.

Ah fair. I was looking at this from rfc6063:

This document is based on [RFC4347], and it is expected that DTLS/
SCTP as described in this document will work with future versions of
DTLS.

And hence didn't consider any updated RFC

Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One very minor nit, otherwise I'm ready to approve

ssl/statem/statem_dtls.c Show resolved Hide resolved
@fwh-dc
Copy link
Contributor Author

fwh-dc commented May 30, 2024

I've noticed recently that sometimes ci checks are cancelled somewhat randomly. What's the reason for this? Is it new behaviour?

@fwh-dc fwh-dc requested a review from mattcaswell May 30, 2024 05:43
@mattcaswell mattcaswell requested a review from t8m May 30, 2024 07:04
@mattcaswell mattcaswell removed the approval: otc review pending This pull request needs review by an OTC member label May 30, 2024
@mattcaswell
Copy link
Member

I've noticed recently that sometimes ci checks are cancelled somewhat randomly. What's the reason for this? Is it new behaviour?

Actually I'm not sure why this happens.

@fwh-dc
Copy link
Contributor Author

fwh-dc commented May 30, 2024

I've rebased and fixed two conflicts. Please reconfirm @mattcaswell.

@mattcaswell mattcaswell added this to the DTLS-1.3 milestone May 31, 2024
Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reconfirmed

@t8m
Copy link
Member

t8m commented May 31, 2024

I've noticed recently that sometimes ci checks are cancelled somewhat randomly. What's the reason for this? Is it new behaviour?

Actually I'm not sure why this happens.

IMO it is (was) some Github flakiness. It looks like it has been fixed.

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@t8m t8m added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels May 31, 2024
@openssl-machine openssl-machine removed the approval: done This pull request has the required number of approvals label Jun 1, 2024
@openssl-machine
Copy link
Collaborator

This pull request is ready to merge

@openssl-machine openssl-machine added the approval: ready to merge The 24 hour grace period has passed, ready to merge label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge severity: fips change The pull request changes FIPS provider sources tests: exempted The PR is exempt from requirements for testing triaged: feature The issue/pr requests/adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants