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

Refactor TLS, add TLS server #19308

Closed
wants to merge 18 commits into from
Closed

Conversation

clickingbuttons
Copy link
Contributor

@clickingbuttons clickingbuttons commented Mar 14, 2024

Blockers:

Bugfixes:

Features:

  • Add TLS server (closes add std.crypto.tls.Server #14171)
  • Only buffer a single message at a time (cost: MultiHash triple hashing first Handshake message)
  • Less RAM usage when handshaking (only single message is buffered) and reading application data (ciphertext, plaintext, and various stack buffers replaced with single fragment buffer)
  • Pass null for Client ca_bundle to skip Certificate validation.
  • Support SSLKEYLOGFILE
  • Convenient encoding and decoding for TLS implementers

Tests:

  • Client and server messages byte by byte. Bootstrapped from xargs and bytebybyte.
  • Every supported cipher suite, group, and signature algorithm between server and client
  • Fragmentation

Even without a coverage report, I can confidently say this closes #14174

TODO:

  • Server state machine + curl test
  • KeyShare kyber read
  • StreamInterface readv instead of readAll
  • Review implementation pitfalls
  • Top 100 sites (closes test std lib TLS implementation against many real world servers #14172)
    • Client TLS 1.2 support
  • Top clients (chrome, curl, wget, python)
  • Send key update on overflow
  • Server key update support
  • Proper HelloRetryRequest support in server
  • Add kyber without increasing struct sizes from 256 bytes to 13Kb (possibly use HelloRetryRequest?)

Performance TODO:

  • support 0-RTT (one roundtrip will likely save more than any other optimization and works great for idempotent requests like HTTP get)
  • benchmark handshake time + application data throughput
  • store multiple fragments in buffer for less syscalls
  • streaming crypto decrypt to avoid memcpy
  • store handshake_cipher somewhere temporary
  • investigate basic http (not TLS) app is unreasonably big #17051
  • remove debug printing

https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility

@clickingbuttons clickingbuttons changed the title Tls Refactor Refactor TLS, add TLS server. Mar 14, 2024
@VisenDev
Copy link

This will be really nice if TLS 1.2 will finally be supported!

@clickingbuttons clickingbuttons changed the title Refactor TLS, add TLS server. Refactor TLS, add TLS server Mar 15, 2024
@clickingbuttons
Copy link
Contributor Author

This branch isn't abandoned. I've made a PR with DateTime added, am working on a crypto PR (adding a DER parser and RSA functions), and then finally will base this PR on those.

@clickingbuttons
Copy link
Contributor Author

DateTime PR #19549 was rejected, will fixup current implementation instead.

Currently blocked on #19976 and #19986.

@andrewrk
Copy link
Member

No update for 30+ days, still a draft.

@andrewrk andrewrk closed this Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment