changeset 9930:fe2a830bf68a

8234408: Improve TLS session handling Reviewed-by: andrew
author abakhtin
date Mon, 25 Nov 2019 09:50:30 -0800
parents ff52524db7f5
children ab59eebcf079
files src/share/classes/sun/security/ssl/ClientHandshaker.java src/share/classes/sun/security/ssl/SSLEngineImpl.java src/share/classes/sun/security/ssl/SSLSessionImpl.java src/share/classes/sun/security/ssl/SSLSocketImpl.java
diffstat 4 files changed, 4 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/ssl/ClientHandshaker.java	Sun Apr 12 06:25:42 2020 +0100
+++ b/src/share/classes/sun/security/ssl/ClientHandshaker.java	Mon Nov 25 09:50:30 2019 -0800
@@ -1254,7 +1254,7 @@
      */
     HandshakeMessage getKickstartMessage() throws SSLException {
         // session ID of the ClientHello message
-        SessionId sessionId = SSLSessionImpl.nullSession.getSessionId();
+        SessionId sessionId = new SessionId(new byte[0]);
 
         // a list of cipher suites sent by the client
         CipherSuiteList cipherSuites = getActiveCipherSuites();
--- a/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Sun Apr 12 06:25:42 2020 +0100
+++ b/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Mon Nov 25 09:50:30 2019 -0800
@@ -349,7 +349,7 @@
         }
 
         sslContext = ctx;
-        sess = SSLSessionImpl.nullSession;
+        sess = new SSLSessionImpl();
         handshakeSession = null;
 
         /*
--- a/src/share/classes/sun/security/ssl/SSLSessionImpl.java	Sun Apr 12 06:25:42 2020 +0100
+++ b/src/share/classes/sun/security/ssl/SSLSessionImpl.java	Mon Nov 25 09:50:30 2019 -0800
@@ -77,11 +77,6 @@
  */
 final class SSLSessionImpl extends ExtendedSSLSession {
 
-    /*
-     * we only really need a single null session
-     */
-    static final SSLSessionImpl         nullSession = new SSLSessionImpl();
-
     // compression methods
     private static final byte           compression_null = 0;
 
@@ -150,7 +145,7 @@
      * be used either by a client or by a server, as a connection is
      * first opened and before handshaking begins.
      */
-    private SSLSessionImpl() {
+    SSLSessionImpl() {
         this(ProtocolVersion.NONE, CipherSuite.C_NULL, null,
             new SessionId(false, null), null, -1, false, null);
     }
@@ -638,14 +633,6 @@
      * no connections will be able to rejoin this session.
      */
     synchronized public void invalidate() {
-        //
-        // Can't invalidate the NULL session -- this would be
-        // attempted when we get a handshaking error on a brand
-        // new connection, with no "real" session yet.
-        //
-        if (this == nullSession) {
-            return;
-        }
         invalidated = true;
         if (debug != null && Debug.isOn("session")) {
             System.out.println("%% Invalidated:  " + this);
--- a/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Sun Apr 12 06:25:42 2020 +0100
+++ b/src/share/classes/sun/security/ssl/SSLSocketImpl.java	Mon Nov 25 09:50:30 2019 -0800
@@ -558,7 +558,7 @@
      */
     private void init(SSLContextImpl context, boolean isServer) {
         sslContext = context;
-        sess = SSLSessionImpl.nullSession;
+        sess = new SSLSessionImpl();
         handshakeSession = null;
 
         /*