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

QUIC Demuxer and Record Layer (RX+TX) #18949

Closed
wants to merge 16 commits into from
Closed

Conversation

hlandau
Copy link
Member

@hlandau hlandau commented Aug 3, 2022

Here we go.

RX only for now aside from some small currently-vestigial pieces of TX functionality.

Key update is mandatory AIUI but involves interaction between the TX/RX pieces so the plan is:

  1. Develop the TX side on top of this PR and update this PR
  2. Add tests which get the TX and RX sides talking to each other
  3. Key update and key update tests

So this shouldn't be merged yet (well, it could be, and I just make a new PR), but reviews are welcome.

This includes a demuxer because implementing the QRL resulted in 90% of the functionality of a demuxer and it made no sense not to include it, since there's necessary interaction between the two.

@hlandau hlandau added branch: master Merge to master branch approval: review pending This pull request needs review by a committer approval: otc review pending This pull request needs review by an OTC member triaged: feature The issue/pr requests/adds a feature labels Aug 3, 2022
@hlandau hlandau requested review from t8m and mattcaswell August 3, 2022 13:07
@hlandau hlandau self-assigned this Aug 3, 2022
@github-actions github-actions bot added the severity: fips change The pull request changes FIPS provider sources label Aug 3, 2022
@hlandau hlandau force-pushed the quic-rlrx2 branch 2 times, most recently from 65818dc to fe3b438 Compare August 3, 2022 14:18
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.

Mostly just looked at the headers so far.

include/internal/quic_demux.h Outdated Show resolved Hide resolved
include/internal/quic_demux.h Show resolved Hide resolved
include/internal/quic_record.h Outdated Show resolved Hide resolved
include/internal/quic_record.h Outdated Show resolved Hide resolved
include/internal/quic_record.h Outdated Show resolved Hide resolved
ssl/quic/quic_record_util.c Outdated Show resolved Hide resolved
include/internal/quic_types.h Outdated Show resolved Hide resolved
include/internal/quic_demux.h Show resolved Hide resolved
include/internal/quic_types.h Outdated Show resolved Hide resolved
include/internal/quic_wire_pkt.h Outdated Show resolved Hide resolved
@hlandau
Copy link
Member Author

hlandau commented Aug 4, 2022

Not sure what's going on with a/ub/msan. I can't replicate it on my machine with either clang or GCC sanitizers, and the error reported isn't even a sanitizer error... the test is supposed to be deterministic. Hm...

@hlandau
Copy link
Member Author

hlandau commented Aug 4, 2022

Just some nits for now.

@hlandau
Copy link
Member Author

hlandau commented Aug 4, 2022

I've looked at the use of OSSL_RECORD_METHOD by TLS and KTLS... IMO it's going to be premature to do something like this for now, especially since the KTLS interface for QUIC literally doesn't exist yet. It makes more sense when needing to support four versions of TLS, DTLS plus KTLS, but the scope of variation for QUIC is a lot narrower. I think this can wait for now; moreover, it's either a question of refactoring this now with an unknown design space (future KTLS APIs) which will probably have to be redone later, or later when we actually know what's needed. So, I'd like to avoid introducing polymorphism into the QRL for now.

The msan issue is weird. Going to have to try and repro it on a build server.

@mattcaswell
Copy link
Member

I've looked at the use of OSSL_RECORD_METHOD by TLS and KTLS... IMO it's going to be premature to do something like this for now, especially since the KTLS interface for QUIC literally doesn't exist yet. It makes more sense when needing to support four versions of TLS, DTLS plus KTLS, but the scope of variation for QUIC is a lot narrower. I think this can wait for now; moreover, it's either a question of refactoring this now with an unknown design space (future KTLS APIs) which will probably have to be redone later, or later when we actually know what's needed. So, I'd like to avoid introducing polymorphism into the QRL for now.

Fair enough.

@hlandau
Copy link
Member Author

hlandau commented Aug 4, 2022

The test issue was caused by random test ordering. Fixed.

@hlandau
Copy link
Member Author

hlandau commented Aug 4, 2022

Updated, refactored.

The other KDF function is similar to tls13_generate_secret but not a match. It doesn't use the same label found in that function, and uses HKDF instead of TLS1_3_KDF. So I've kept this separate.

I think this settles the outstanding feedback.

@mattcaswell mattcaswell mentioned this pull request Aug 8, 2022
2 tasks
@hlandau
Copy link
Member Author

hlandau commented Aug 11, 2022

Updated:

  • Adds TX side.
  • The QRL has been split into independent RX (QRX) and TX (QTX) objects as I'm now satisfied they can be separated reasonably cleanly.
  • QRL (the RX side) has been renamed to QRX.
  • Some tests for the TX side.
  • Key expiration functionality has been added.
  • A preview of the API and logical model for key update can be viewed in the header files quic_record_rx.h and quic_record_tx.h. No implementation yet.

@hlandau
Copy link
Member Author

hlandau commented Aug 11, 2022

Also while I remember: @paulidale, let me know if it would be more helpful for the iovecs to be a linked list instead of an array.

@hlandau hlandau changed the title QUIC Demuxer and Record Layer (RX Side) QUIC Demuxer and Record Layer (RX+TX) Aug 11, 2022
@levitte
Copy link
Member

levitte commented Aug 15, 2022

Do I understand correctly that this replaces #18870?

@hlandau
Copy link
Member Author

hlandau commented Aug 15, 2022

Do I understand correctly that this replaces #18870?

Yeah, it does.

@hlandau
Copy link
Member Author

hlandau commented Aug 15, 2022

Updated:

  • Adds an RX time field to the OSSL_QRX_PKT structure.

  • Adds a timekeeping argument to ossl_demux_new which is used to determine
    packet reception time.

  • Adds a decoded PN field to the OSSL_QRX_PKT structure.
    This has to be decoded by the QRX anyway, and its omission was an oversight.

  • Key update support for the TX side.

  • Minor refactoring.

ssl/quic/quic_record_rx.c Show resolved Hide resolved
ssl/quic/quic_record_rx.c Outdated Show resolved Hide resolved
ssl/quic/quic_record_rx.c Outdated Show resolved Hide resolved
@hlandau
Copy link
Member Author

hlandau commented Aug 26, 2022

Updated (nits).

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.

Nits mostly. Great work!

ssl/quic/quic_record_rx.c Outdated Show resolved Hide resolved
Comment on lines +498 to +499
/* Clients should never receive 0-RTT packets. */
if (rxe->hdr.type == QUIC_PKT_TYPE_0RTT)
Copy link
Member

Choose a reason for hiding this comment

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

Given we will need at least rudimentary server for testing, should this be prepared to handle server side? I.e., have a client flag in the OSSL_QRX?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, seems reasonable. I'll get on this at some point.

Copy link
Member

Choose a reason for hiding this comment

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

/* TODO(QUIC): ... */ would WFM too.

ssl/quic/quic_record_rx.c Outdated Show resolved Hide resolved
ssl/quic/quic_record_rx.c Outdated Show resolved Hide resolved
ssl/quic/quic_record_rx.c Show resolved Hide resolved
ssl/quic/quic_record_rx.c Outdated Show resolved Hide resolved
ssl/quic/quic_record_rx.c Outdated Show resolved Hide resolved
ssl/quic/quic_record_rx.c Show resolved Hide resolved
ssl/quic/quic_wire_pkt.c Outdated Show resolved Hide resolved
ssl/quic/quic_wire_pkt.c Outdated Show resolved Hide resolved
@hlandau
Copy link
Member Author

hlandau commented Aug 26, 2022

Updated, minor changes.

@hlandau
Copy link
Member Author

hlandau commented Aug 26, 2022

Added comment.

@t8m t8m removed the approval: otc review pending This pull request needs review by an OTC member label Aug 29, 2022
@paulidale paulidale 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 Sep 1, 2022
@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Sep 2, 2022
@openssl-machine
Copy link
Collaborator

This pull request is ready to merge

@t8m
Copy link
Member

t8m commented Sep 2, 2022

Merged to master branch. Thank you for this great work!

@t8m t8m closed this Sep 2, 2022
openssl-machine pushed a commit that referenced this pull request Sep 2, 2022
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #18949)
openssl-machine pushed a commit that referenced this pull request Sep 2, 2022
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #18949)
openssl-machine pushed a commit that referenced this pull request Sep 2, 2022
- Adds an RX time field to the OSSL_QRX_PKT structure.

- Adds a timekeeping argument to ossl_demux_new which is used to determine
  packet reception time.

- Adds a decoded PN field to the OSSL_QRX_PKT structure.
  This has to be decoded by the QRX anyway, and its omission was an oversight.

- Key update support for the TX side.

- Minor refactoring.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #18949)
sftcd pushed a commit to sftcd/openssl that referenced this pull request Sep 24, 2022
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18949)
sftcd pushed a commit to sftcd/openssl that referenced this pull request Sep 24, 2022
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18949)
sftcd pushed a commit to sftcd/openssl that referenced this pull request Sep 24, 2022
- Adds an RX time field to the OSSL_QRX_PKT structure.

- Adds a timekeeping argument to ossl_demux_new which is used to determine
  packet reception time.

- Adds a decoded PN field to the OSSL_QRX_PKT structure.
  This has to be decoded by the QRX anyway, and its omission was an oversight.

- Key update support for the TX side.

- Minor refactoring.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18949)
beldmit pushed a commit to beldmit/openssl that referenced this pull request Dec 26, 2022
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18949)
beldmit pushed a commit to beldmit/openssl that referenced this pull request Dec 26, 2022
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18949)
beldmit pushed a commit to beldmit/openssl that referenced this pull request Dec 26, 2022
- Adds an RX time field to the OSSL_QRX_PKT structure.

- Adds a timekeeping argument to ossl_demux_new which is used to determine
  packet reception time.

- Adds a decoded PN field to the OSSL_QRX_PKT structure.
  This has to be decoded by the QRX anyway, and its omission was an oversight.

- Key update support for the TX side.

- Minor refactoring.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18949)
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 branch: master Merge to master branch severity: fips change The pull request changes FIPS provider sources triaged: feature The issue/pr requests/adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants