Repository navigation
QUIC-TLS (RFC 9001): packet protection and a sans-IO server handshake - #67
Draft
crimson-knight wants to merge 5 commits into
Draft
crimson-knight wants to merge 5 commits into
crimson-knight wants to merge 5 commits into
Conversation
Move check_client_hello, check_second_client_hello and the choice of cipher suite, group, ALPN protocol and server name out of TLS::ServerHandshake into TLS::NegotiateParametersFromClientHello, so the QUIC server handshake can call the same code. The TLS server applies the client's record_size_limit itself, as before; its behavior is unchanged.
…shake - PacketProtection: initial secrets from the client's Destination Connection ID, packet protection under quic key/quic iv with into: forms, header protection masks (AES-ECB and ChaCha20 under quic hp), and key update under quic ku sharing the header protection key. - ServerHandshake: the TLS 1.3 server handshake over CRYPTO data per encryption level, with one HelloRetryRequest, ALPN required, the quic_transport_parameters extension both ways, an empty legacy_session_id, no 0-RTT, tickets or KeyUpdate, bounded buffering per level, and every derived secret wiped. - HandshakeError carries the alert and the QUIC error code. - QUIC.retry_integrity_tag for Retry packets. - Specs: every RFC 9001 Appendix A vector, key update, tampering, and the handshake end to end against a client built from Beryl's codecs.
PacketProtection#header_protection_mask(sample, into: mask) writes the 5-byte mask into the caller's storage, so a transport's per-packet path allocates nothing; the allocating form stays.
NegotiateParametersFromClientHello now takes the transport it serves (Transport::TCP or Transport::QUIC). Over TCP a ClientHello carrying quic_transport_parameters (0x39) ends with unsupported_extension; the QUIC server handshake passes Transport::QUIC and still requires the extension itself, as before. A new handshake spec sends the client's own ClientHello with 0x39 added and checks the alert on the wire.
spec/probes/secret_flow.cr gains header_protection_keying (the quic hp key from a secret traffic secret) and header_protection_mask (the mask the check follows out of the key), run under every suite; secret_taint.cr runs the same under Memcheck. check_secret_flow.rb analyzes Beryl::QUIC::HeaderProtectionKey as a cipher object, and now treats the buffers of a cipher object passed to a probe entry point as key material: the mask was inlined into the probe, so the self-only rule missed a branch planted on the ChaCha20 key; with this change the planted branch is reported and the real code passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Beryl::QUIC, the cryptographic half of QUIC version 1 (RFC 9001), for the HTTP/3 work (Mica's QUIC transport, hosted by Amber).What it adds
PacketProtection: one direction of one encryption level.initial_pair_for_server(client_destination_connection_id)(v1 salt), packet protection underquic key/quic iv(allocating andinto:forms ofsealandopen), the 5-byte header protection mask (AES-ECB or ChaCha20 underquic hp),next_generationfor key update underquic ku(keeps the header protection key),wipe.ServerHandshake: the TLS 1.3 server handshake over CRYPTO data per encryption level, sans-IO. One HelloRetryRequest when needed; ALPN required (no_application_protocol); the client'squic_transport_parametersrequired (missing_extension) and exposed unparsed; a non-emptylegacy_session_idis a PROTOCOL_VIOLATION (§8.4); a KeyUpdate message is refused (§6); no 0-RTT, resumption or tickets; one incomplete message per level, bounded byLimits#largest_handshake_message_bytesize; every derived secret wiped.HandshakeError < TLS::Error: the alert plustransport_error_code(CRYPTO_ERROR0x0100+ alert, or PROTOCOL_VIOLATION0x0a).QUIC.retry_integrity_tag(§5.8).Shared with the TLS server
The ClientHello checks and the choice of suite, group, ALPN and server name moved from
TLS::ServerHandshakeintoTLS::NegotiateParametersFromClientHello; both servers call it, so they choose alike. TLS behavior is unchanged.Evidence
-Dberyl_portable_ciphers.