drogue-iot / embedded-tls

An Rust TLS 1.3 implementation for embedded devices.
Apache License 2.0
168 stars 21 forks source link

[WIP] Define all extension data types #109

Open bugadani opened 1 year ago

bugadani commented 1 year ago

This PR unifies extension data, i.e. it defines a parse and an encode fn for each of them, as well as adds an associated constant. Later, this PR will define all extensions described in the TLS 1.3 and companion RFCs.

This PR will one day be useful for implementing a TLS server.

This PR will allow users to use the Max Fragment Length extension.

bugadani commented 1 year ago

I'll leave the rustfmt commit here to prevent accidentally merging before this PR, because I expect that to be a rebase nightmare. Styling options completely up for debate, though, I just want the rustfmt file to overwrite my defaults with something consistent :)

Oh and of course, this PR will need to be split up... somehow...

bugadani commented 1 year ago

To be fair, most of the data types aren't actually used currently. We might want to introduce a "placeholder" for the extensions we don't want, that just consumes and ignores the extension data till then, but I wanted to be exhaustive here.