Implement client support for TLS 1.3 0-RTT #185
Closed
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.
Here's my take at implementing TLS 1.3 0-RTT for resumed client sessions. It passes BOGO and works with Cloudflare's TLS 1.3 0-RTT implementation.
Both Issue #84 and the TLS 1.3 draft discuss about the risk of using 0-rtt data. So 0-RTT is by default disabled. A user who wishes to send 0-RTT data to HAProxy or Cloudflare should set
ClientConfig.enable_early_dataand callClientSession::write_all()before the handshake starts.Two new Session APIs,
is_in_early_dataandis_early_data_acceptedare added.is_in_early_datareturnstrueif any early data is in flight or ready to be sent. This implies a handshake is in process andis_handshaking()must betrue.is_early_data_acceptedreturnstrueif the server has processed the 0-RTT data and the client has sentEndOfEarlyData. This API should be called after the handshake is completed.A
max_early_data_sizefield is added topersist::ClientSessionValueto indicate the maximum bytes of plaintext that can be sent as early data. This limit is enforced inSession::send_plain().The following BOGO test cases are turned on and passed.
PASSED (TLS13-SendTicketEarlyDataInfo)
PASSED (TLS13-SendTicketEarlyDataInfo-Disabled)
PASSED (TLS13-EarlyData-TooMuchData-Client-Sync)
PASSED (TLS13-EarlyData-TooMuchData-Client-Sync-ImplicitHandshake)
PASSED (TLS13-EarlyData-TooMuchData-Client-Sync-SplitHandshakeRecords)
PASSED (TLS13-EarlyData-TooMuchData-Client-Sync-PackHandshake)
PASSED (TLS13-EarlyData-TooMuchData-Client-Async)
PASSED (TLS13-EarlyData-TooMuchData-Client-Async-ImplicitHandshake)
PASSED (TLS13-EarlyData-TooMuchData-Client-Async-SplitHandshakeRecords)
PASSED (TLS13-EarlyData-TooMuchData-Client-Async-PackHandshake)
PASSED (EarlyData-Client-TLS13Draft23)
PASSED (EarlyData-Reject-Client-TLS13Draft23)
PASSED (EarlyData-HRR-Client-TLS13Draft23)
PASSED (EarlyDataWithoutResume-Client-TLS13Draft23)
PASSED (EarlyDataVersionDowngrade-Client-TLS13Draft23)
PASSED (ServerAcceptsEarlyDataOnHRR-Client-TLS13Draft23)
PASSED (EarlyData-Client-VersionAPI-TLS13Draft23)
PASSED (EarlyData-Client-BadFinished-TLS13Draft23)