SSLDriver can transition to CLOSED in handshake (#41458)

TLS 1.3 changes to the SSLEngine introduced a scenario where a UNWRAP
call during a handshake can consume a close notify alerty without
throwing an exception. This means that we continue down a codepath where
we assert that we are still in handshaking mode. Transitioning to closed
from handshaking is a valid scenario. This commit removes this
assertion.
This commit is contained in:
Tim Brooks 2019-04-23 19:43:15 -06:00
parent 2e255a6446
commit 6d7110edf5
No known key found for this signature in database
GPG Key ID: C2AA3BB91A889E77
1 changed files with 4 additions and 2 deletions

View File

@ -439,8 +439,10 @@ public class SSLDriver implements AutoCloseable {
// If the engine is partially closed, immediate transition to close mode.
if (currentMode.isHandshake()) {
currentMode = new CloseMode(true);
} else {
String message = "Expected to be in handshaking mode. Instead in non-handshaking mode: " + currentMode;
} else if (currentMode.isApplication()) {
// It is possible to be in CLOSED mode if the prior UNWRAP call returned CLOSE_NOTIFY.
// However we should not be in application mode at this point.
String message = "Expected to be in handshaking/closed mode. Instead in application mode.";
throw new AssertionError(message);
}
} else if (hasFlushPending() == false) {