Various nits and dead code removal JDK-8145252-TLS13-branch
authorascarpino
Thu, 14 Jun 2018 11:59:22 -0700
branchJDK-8145252-TLS13-branch
changeset 56761 001e4e7c0a01
parent 56758 9f659dbb28c8
child 56769 125890684a60
Various nits and dead code removal
src/java.base/share/classes/sun/security/ssl/CertificateMessage.java
src/java.base/share/classes/sun/security/ssl/DTLSRecord.java
src/java.base/share/classes/sun/security/ssl/Finished.java
src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java
src/java.base/share/classes/sun/security/ssl/SSLRecord.java
src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java
src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java
--- a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java	Wed Jun 13 22:40:47 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java	Thu Jun 14 11:59:22 2018 -0700
@@ -53,7 +53,6 @@
 import javax.net.ssl.X509ExtendedTrustManager;
 import javax.net.ssl.X509TrustManager;
 import javax.security.auth.x500.X500Principal;
-import sun.security.ssl.CertificateMessage.T12CertificateMessage;
 import static sun.security.ssl.ClientAuthType.CLIENT_AUTH_REQUIRED;
 import sun.security.ssl.ClientHello.ClientHelloMessage;
 import sun.security.ssl.SSLHandshake.HandshakeMessage;
@@ -115,7 +114,7 @@
                     handshakeContext.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Could not encode certificate (" +
                             cert.getSubjectX500Principal() + ")", cee);
-                    break;      // make the complier happy
+                    break;
                 }
             }
 
@@ -435,7 +434,7 @@
             //
             // DO NOT need to check allowUnsafeServerCertChange here. We only
             // reserve server certificates when allowUnsafeServerCertChange is
-            // flase.
+            // false.
             if (chc.reservedServerCerts != null &&
                     !chc.handshakeSession.useExtendedMasterSecret) {
                 // It is not necessary to check the certificate update if
@@ -1110,7 +1109,7 @@
             } catch (SSLException | CertificateException ce) {
                 chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Failed to produce client Certificate message", ce);
-                return null;    // make the complier happy
+                return null;
             }
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine("Produced client Certificate message", cm);
--- a/src/java.base/share/classes/sun/security/ssl/DTLSRecord.java	Wed Jun 13 22:40:47 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/DTLSRecord.java	Thu Jun 14 11:59:22 2018 -0700
@@ -61,30 +61,6 @@
                                     + maxMacSize;           // MAC or AEAD tag
 
     /*
-     * For CBC protection in SSL3/TLS1, we break some plaintext into two
-     * packets.  Max application data size for the second packet.
-     */
-    static final int    maxDataSizeMinusOneByteRecord =
-                                  maxDataSize       // max data size
-                                - (                 // max one byte record size
-                                      headerPlusMaxIVSize   // header + iv
-                                    + 1             // one byte data
-                                    + maxPadding    // padding
-                                    + maxMacSize    // MAC
-                                  );
-
-    /*
-     * Maximum record size for alert and change cipher spec records.
-     * They only contain 2 and 1 bytes of data, respectively.
-     * Allocate a smaller array.
-     */
-    static final int    maxAlertRecordSize =
-                                      headerPlusMaxIVSize   // header + iv
-                                    + 2                     // alert
-                                    + maxPadding            // padding
-                                    + maxMacSize;           // MAC
-
-    /*
      * Minimum record size of Certificate handshake message.
      * Client sends a certificate message containing no certificates if no
      * suitable certificate is available.  That is, the certificate_list
--- a/src/java.base/share/classes/sun/security/ssl/Finished.java	Wed Jun 13 22:40:47 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/Finished.java	Thu Jun 14 11:59:22 2018 -0700
@@ -100,7 +100,7 @@
             if (m.remaining() != verifyDataLen) {
                 context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Inappropriate finished message: need " + verifyDataLen +
-                    " but remine " + m.remaining() + " bytes verify_data");
+                    " but remaining " + m.remaining() + " bytes verify_data");
             }
 
             this.verifyData = new byte[verifyDataLen];
--- a/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java	Wed Jun 13 22:40:47 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java	Thu Jun 14 11:59:22 2018 -0700
@@ -181,7 +181,7 @@
                 needMorePayload = false;
 
                 if (packetLeftSize > 0) {
-                    fragLen =writeCipher.calculateFragmentSize(
+                    fragLen = writeCipher.calculateFragmentSize(
                             packetLeftSize, headerSize);
 
                     fragLen = Math.min(fragLen, Record.maxDataSize);
@@ -459,8 +459,6 @@
 
                     remainingFragLen -= chipLen;
                 }
-
-                fragLen -= remainingFragLen;
             } else {
                 fragLen = Math.min(fragLen, memo.fragment.length);
                 dstBuf.put(memo.fragment, 0, fragLen);
--- a/src/java.base/share/classes/sun/security/ssl/SSLRecord.java	Wed Jun 13 22:40:47 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLRecord.java	Thu Jun 14 11:59:22 2018 -0700
@@ -68,19 +68,6 @@
                                     + maxMacSize;           // MAC or AEAD tag
 
     /*
-     * For CBC protection in SSL3/TLS1, we break some plaintext into two
-     * packets.  Max application data size for the second packet.
-     */
-    static final int    maxDataSizeMinusOneByteRecord =
-                                  maxDataSize       // max data size
-                                - (                 // max one byte record size
-                                      headerPlusMaxIVSize   // header + iv
-                                    + 1             // one byte data
-                                    + maxPadding    // padding
-                                    + maxMacSize    // MAC
-                                  );
-
-    /*
      * The maximum large record size.
      *
      * Some SSL/TLS implementations support large fragment upto 2^15 bytes,
@@ -93,18 +80,6 @@
                 maxRecordSize   // Max size with a conforming implementation
               + maxDataSize;    // extra 2^14 bytes for large data packets.
 
-
-    /*
-     * Maximum record size for alert and change cipher spec records.
-     * They only contain 2 and 1 bytes of data, respectively.
-     * Allocate a smaller array.
-     */
-    static final int    maxAlertRecordSize =
-                                      headerPlusMaxIVSize   // header + iv
-                                    + 2                     // alert
-                                    + maxPadding            // padding
-                                    + maxMacSize;           // MAC
-
     /*
      * We may need to send this SSL v2 "No Cipher" message back, if we
      * are faced with an SSLv2 "hello" that's not saying "I talk v3".
--- a/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java	Wed Jun 13 22:40:47 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java	Thu Jun 14 11:59:22 2018 -0700
@@ -134,7 +134,6 @@
             ClientHandshakeContext chc = (ClientHandshakeContext)context;
 
             // clean up this consumer
-            // chc.handshakeConsumers.remove(SSLHandshake.SERVER_HELLO_DONE.id);
             chc.handshakeConsumers.clear();
 
             ServerHelloDoneMessage shdm =
--- a/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java	Wed Jun 13 22:40:47 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java	Thu Jun 14 11:59:22 2018 -0700
@@ -494,7 +494,7 @@
             if (!shc.sslConfig.isAvailable(HRR_SUPPORTED_VERSIONS)) {
                 if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                     SSLLogger.fine(
-                        "[Reprocude] Ignore unavailable extension: " +
+                        "[Reproduce] Ignore unavailable extension: " +
                         HRR_SUPPORTED_VERSIONS.name);
                 }
                 return null;