src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java
branchJDK-8145252-TLS13-branch
changeset 56561 5f23e0400f27
parent 56558 4a3deb6759b1
child 56568 7fe8ce3c78b6
--- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Tue May 15 14:52:51 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Tue May 15 22:59:45 2018 -0700
@@ -273,8 +273,8 @@
         public void consume(ConnectionContext context,
                             ByteBuffer message) throws IOException {
             // The consuming happens in client side only.
-            ClientHandshakeContext chc = (ClientHandshakeContext)context;
-            NewSessionTicketMessage nstm = new NewSessionTicketMessage(chc, message);
+            PostHandshakeContext hc = (PostHandshakeContext) context;
+            NewSessionTicketMessage nstm = new NewSessionTicketMessage(hc, message);
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine(
                 "Consuming NewSessionTicket message", nstm);
@@ -292,7 +292,7 @@
             }
 
             SSLSessionContextImpl sessionCache = (SSLSessionContextImpl)
-                chc.sslContext.engineGetClientSessionContext();
+                hc.sslContext.engineGetClientSessionContext();
 
             if (sessionCache.getSessionTimeout() > SEVEN_DAYS_IN_SECONDS) {
                 if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
@@ -302,7 +302,7 @@
                 return;
             }
 
-            SSLSessionImpl sessionToSave = chc.conContext.conSession;
+            SSLSessionImpl sessionToSave = hc.conContext.conSession;
 
             Optional<SecretKey> resumptionMasterSecret =
                 sessionToSave.getResumptionMasterSecret();
@@ -322,11 +322,10 @@
             // create and cache the new session
             // The new session must be a child of the existing session so
             // they will be invalidated together, etc.
-            chc.negotiatedProtocol = chc.conContext.protocolVersion;
             SessionId newId =
-                new SessionId(true, chc.sslContext.getSecureRandom());
+                new SessionId(true, hc.sslContext.getSecureRandom());
             SSLSessionImpl sessionCopy =
-                new SSLSessionImpl(chc, sessionToSave.getSuite(), newId,
+                new SSLSessionImpl(hc, sessionToSave.getSuite(), newId,
                 sessionToSave.getCreationTime());
             sessionToSave.addChild(sessionCopy);
             sessionCopy.setPreSharedKey(psk);
@@ -335,7 +334,7 @@
             sessionCache.put(sessionCopy);
 
             // The handshakeContext is no longer needed
-            chc.conContext.handshakeContext = null;
+            hc.free();
         }
     }