You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f785e2f
Browse filesBrowse the repository at this point in the historyBrowse files
Keep draining TLS plaintext after a TLS 1.3 KeyUpdate (#3738)
* Keep draining TLS plaintext after a TLS 1.3 KeyUpdate
Motivation:
On plaintext-output cancellation the GraphStage TLS engine drains plaintext it
has already accepted, but stops if a new handshake is required. It treated any
NEED_WRAP as a new handshake, so a TLS 1.3 KeyUpdate that requests a response,
received before or during the drain, closed outbound and discarded the
accepted plaintext.
Modification:
- Allow the drain to continue when an established TLS 1.3 session needs to
wrap. TLS 1.3 has no renegotiation, so this is a post-handshake message such
as a KeyUpdate response; the response is wrapped before the plaintext.
- TLS 1.2 keeps stopping the drain, because NEED_WRAP may start a
renegotiation.
- Document the KeyUpdate case in the stream IO guide and both TLS DSLs.
Result:
A TLS 1.3 KeyUpdate no longer discards plaintext accepted before
plaintext-output cancellation.
Tests:
- stream-tests/testOnly TlsGraphStageDeferredCloseSpec: 25 passed; the two new
TLS 1.3 KeyUpdate tests fail without the fix (ByteString() was not equal to
ByteString(92, 90)), the TLS 1.2 guard passes both ways
- stream-tests/testOnly org.apache.pekko.stream.io.Tls*: 288 passed
- scalafmt --mode diff-ref=upstream/main: clean
References:
Refs #3727
* Match SunJSSE's FINISHED status for scripted KeyUpdate wraps
Motivation:
Review noted the KeyUpdate tests rely on a scripted engine. A real
SunJSSE TLS 1.3 KeyUpdate (forced with a low jdk.tls.keyLimits) reports
NEED_WRAP after unwrap, and the response wrap returns FINISHED, not
NOT_HANDSHAKING as scripted. FINISHED re-runs session verification.
Modification:
Return FINISHED from the scripted KeyUpdate response wrap, leaving the
engine in NOT_HANDSHAKING afterwards, like SunJSSE.
Result:
The drain tests now cover the FINISHED path a real KeyUpdate takes.
Tests:
- stream-tests/testOnly org.apache.pekko.stream.io.TlsGraphStage*:
173 passed.
- With the fix disabled, both TLS 1.3 KeyUpdate tests fail.
- Standalone JDK 17 SunJSSE engine pair with low jdk.tls.keyLimits
confirmed the NEED_WRAP then FINISHED sequence on TLSv1.3.
References:
Review of #3738
0 commit comments