src/java.base/share/classes/sun/security/ssl/TransportContext.java
changeset 55336 c2398053ee90
parent 54443 dfba4e321ab3
child 55353 946f7f2d321c
equal deleted inserted replaced
55335:f7cc25dda38a 55336:c2398053ee90
   157                 byte type = HandshakeContext.getHandshakeType(this,
   157                 byte type = HandshakeContext.getHandshakeType(this,
   158                         plaintext);
   158                         plaintext);
   159                 if (handshakeContext == null) {
   159                 if (handshakeContext == null) {
   160                     if (type == SSLHandshake.KEY_UPDATE.id ||
   160                     if (type == SSLHandshake.KEY_UPDATE.id ||
   161                             type == SSLHandshake.NEW_SESSION_TICKET.id) {
   161                             type == SSLHandshake.NEW_SESSION_TICKET.id) {
   162                         if (isNegotiated &&
   162                         if (!isNegotiated) {
   163                                 protocolVersion.useTLS13PlusSpec()) {
   163                             throw fatal(Alert.UNEXPECTED_MESSAGE,
   164                             handshakeContext = new PostHandshakeContext(this);
   164                                     "Unexpected unnegotiated post-handshake" +
   165                         } else {
   165                                             " message: " +
       
   166                                             SSLHandshake.nameOf(type));
       
   167                         }
       
   168                         if (type == SSLHandshake.KEY_UPDATE.id &&
       
   169                                 !protocolVersion.useTLS13PlusSpec()) {
   166                             throw fatal(Alert.UNEXPECTED_MESSAGE,
   170                             throw fatal(Alert.UNEXPECTED_MESSAGE,
   167                                     "Unexpected post-handshake message: " +
   171                                     "Unexpected post-handshake message: " +
   168                                     SSLHandshake.nameOf(type));
   172                                     SSLHandshake.nameOf(type));
   169                         }
   173                         }
       
   174                         handshakeContext = new PostHandshakeContext(this);
   170                     } else {
   175                     } else {
   171                         handshakeContext = sslConfig.isClientMode ?
   176                         handshakeContext = sslConfig.isClientMode ?
   172                                 new ClientHandshakeContext(sslContext, this) :
   177                                 new ClientHandshakeContext(sslContext, this) :
   173                                 new ServerHandshakeContext(sslContext, this);
   178                                 new ServerHandshakeContext(sslContext, this);
   174                         outputRecord.initHandshaker();
   179                         outputRecord.initHandshaker();