Skip to content

Add prototype QUIC Record Layer API design#18870

Closed
hlandau wants to merge 2 commits intoopenssl:masterfrom
hlandau:quic-rl-design-doc
Closed

Add prototype QUIC Record Layer API design#18870
hlandau wants to merge 2 commits intoopenssl:masterfrom
hlandau:quic-rl-design-doc

Conversation

@hlandau
Copy link
Member

@hlandau hlandau commented Jul 25, 2022

Note: My work on the QUIC record layer RX side ended up implementing 90% of the moving parts needed for a DEMUX out of necessity, and at that point it made no sense not to factor it out into a separate piece, as it actually improves and simplifies the design. A basic DEMUX is done and will be part of the QRL RX implementation PR. Since both ultimately depend on BIO_recvmmsg, it would be helpful if people could review that PR...

This document will change as the understanding evolves during implementation but hopefully gives @levitte something to work with.

@hlandau hlandau added branch: master Applies to master branch approval: review pending This pull request needs review by a committer approval: otc review pending triaged: design The issue/pr deals with a design document labels Jul 25, 2022
@hlandau hlandau requested review from levitte and mattcaswell July 25, 2022 16:55
@hlandau hlandau self-assigned this Jul 25, 2022

typedef struct ossl_quic_pkt_hdr_st {
/* [ALL] 1 if this was a long packet, 0 otherwise. Always valid. */
unsigned int is_long :1;
Copy link
Member

Choose a reason for hiding this comment

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

Does any part other than the record layer care? I suspect that all other fields that are currently depending on this bit would simply have a value that fits both long and short packet headers:

  • the type field could have one of the values initial, handshake, 0rtt, 1rtt and retry, where rtt1 is the value it gets automatically for short packets
  • the spin bit, key phase och other similar fields could simply be zero or false when they're not valid, or could be claimed valid only when the type is or isn't 1rtt, as the case may be.

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, merging this and long_type is a good idea.

Copy link
Member

Choose a reason for hiding this comment

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

With that change, long_type could probably just be called type

@levitte
Copy link
Member

levitte commented Jul 26, 2022

Somewhere in this, I would like to be able to pass a pointer to an OSSL_TIME, to be filled in with the time a packet was received.
(applicable for the RX bits, not sure about the TX bits). Alternatively, the an appropriate structure has an OSSL_TIME field.

* Instantiates a new QRL. A pointer to the QRL is written
* to *qrl. Returns 1 on success or 0 on failure.
*/
int ossl_qrl_new(const OSSL_QRL_ARGS *args, OSSL_QRL **qrl);
Copy link
Member

Choose a reason for hiding this comment

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

This deviates quite a lot from how we usually write constructors... usually, we have them return the constructed object, or NULL on failure.

@levitte levitte mentioned this pull request Jul 26, 2022
@hlandau
Copy link
Member Author

hlandau commented Jul 26, 2022

Somewhere in this, I would like to be able to pass a pointer to an OSSL_TIME, to be filled in with the time a packet was received.

I can include this in the information provided, will do.

int ossl_qrl_processed_read_pending(OSSL_QRL *qrl);

/*
* Returns 1 if there arre any unprocessed (i.e. not yet decrypted) packets
Copy link
Member

Choose a reason for hiding this comment

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

Typo: are

Comment on lines +299 to +301
/* [ALL] Number of bytes in the connection ID. Always valid. */
uint8_t dst_conn_id_len;
uint8_t dst_conn_id[QUIC_MAX_CONN_ID_LEN];
Copy link
Member

Choose a reason for hiding this comment

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

OSSL_QUIC_CONN_ID instead?

Comment on lines +304 to +305
uint8_t src_conn_id_len;
uint8_t src_conn_id[QUIC_MAX_CONN_ID_LEN];
Copy link
Member

Choose a reason for hiding this comment

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

As above

@levitte
Copy link
Member

levitte commented Jul 28, 2022

I'm starting to think that this sort of design should include the actual header file (if it's new) or changes to a header file (if it already exists). It seems a bit silly to have a lot och header file stuff in the design document when those lines are going to be duplicated into a header file anyway.
Doing this would also make these design PRs more directly usable by others who are looking to code against what's being defined (like I need to do with the RX Frame Handler implementation).

(and yes, I know, I should eat my own dog food in the RX depacketizer design... coming up!)

Copy link
Contributor

@paulidale paulidale 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.

* is held until the next call to ossl_qrl_write_pkt. This can be used to
* concatenate several packets into a single transmitted datagram. Every packet
* but the final packet to be written into a datagram should have the flag
* unset. packet to be written into a datagram should have the flag unset.
Copy link
Contributor

Choose a reason for hiding this comment

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

the final packet to be written

@hlandau
Copy link
Member Author

hlandau commented Aug 15, 2022

Superceded by #18949.

@hlandau hlandau closed this Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: review pending This pull request needs review by a committer branch: master Applies to master branch triaged: design The issue/pr deals with a design document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants