--- a/src/java.base/share/classes/sun/security/ssl/TransportContext.java Tue Jun 11 19:15:31 2019 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/TransportContext.java Tue Jun 11 16:31:37 2019 -0700
@@ -159,14 +159,19 @@
if (handshakeContext == null) {
if (type == SSLHandshake.KEY_UPDATE.id ||
type == SSLHandshake.NEW_SESSION_TICKET.id) {
- if (isNegotiated &&
- protocolVersion.useTLS13PlusSpec()) {
- handshakeContext = new PostHandshakeContext(this);
- } else {
+ if (!isNegotiated) {
+ throw fatal(Alert.UNEXPECTED_MESSAGE,
+ "Unexpected unnegotiated post-handshake" +
+ " message: " +
+ SSLHandshake.nameOf(type));
+ }
+ if (type == SSLHandshake.KEY_UPDATE.id &&
+ !protocolVersion.useTLS13PlusSpec()) {
throw fatal(Alert.UNEXPECTED_MESSAGE,
"Unexpected post-handshake message: " +
SSLHandshake.nameOf(type));
}
+ handshakeContext = new PostHandshakeContext(this);
} else {
handshakeContext = sslConfig.isClientMode ?
new ClientHandshakeContext(sslContext, this) :