Address TLS 1.3 comments output stream classes, go through JsseJce class to get Mac instance. JDK-8145252-TLS13-branch
authorjnimeh
Wed, 06 Jun 2018 23:53:47 -0700
branchJDK-8145252-TLS13-branch
changeset 56686 07dc566630ee
parent 56685 c7e7234828c0
child 56692 7b0bde908f58
Address TLS 1.3 comments output stream classes, go through JsseJce class to get Mac instance. Summary: TLS 1.3 comments output stream classes, go through JsseJce class to get Mac instance.
src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java
src/java.base/share/classes/sun/security/ssl/HKDF.java
src/java.base/share/classes/sun/security/ssl/KeyUpdate.java
src/java.base/share/classes/sun/security/ssl/OutputRecord.java
src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java
src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java
--- a/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java	Thu Jun 07 07:23:15 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java	Wed Jun 06 23:53:47 2018 -0700
@@ -65,7 +65,7 @@
 
     @Override
     void finishHandshake() {
-//        fragmenter = null;
+        // Nothing to do here currently.
     }
 
     @Override
--- a/src/java.base/share/classes/sun/security/ssl/HKDF.java	Thu Jun 07 07:23:15 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/HKDF.java	Wed Jun 06 23:53:47 2018 -0700
@@ -62,7 +62,7 @@
         Objects.requireNonNull(hashAlg,
                 "Must provide underlying HKDF Digest algorithm.");
         hmacAlg = "Hmac" + hashAlg.replace("-", "");
-        hmacObj = Mac.getInstance(hmacAlg);
+        hmacObj = JsseJce.getMac(hmacAlg);
         hmacLen = hmacObj.getMacLength();
     }
 
--- a/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java	Thu Jun 07 07:23:15 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java	Wed Jun 06 23:53:47 2018 -0700
@@ -125,8 +125,8 @@
     }
 
     enum KeyUpdateRequest {
-        NOTREQUSTED         ((byte)0, "update_not_requested"),
-        REQUSTED            ((byte)1, "update_requested");
+        NOTREQUESTED        ((byte)0, "update_not_requested"),
+        REQUESTED           ((byte)1, "update_requested");
 
         final byte id;
         final String name;
@@ -169,7 +169,7 @@
         public byte[] produce(ConnectionContext context) throws IOException {
             PostHandshakeContext hc = (PostHandshakeContext)context;
             return handshakeProducer.produce(context,
-                    new KeyUpdateMessage(hc, KeyUpdateRequest.REQUSTED));
+                    new KeyUpdateMessage(hc, KeyUpdateRequest.REQUESTED));
         }
     }
 
@@ -234,10 +234,10 @@
                 return;
             }
 
-            if (km.status == KeyUpdateRequest.REQUSTED) {
+            if (km.status == KeyUpdateRequest.REQUESTED) {
                 // Update the write key and IV.
                 handshakeProducer.produce(hc,
-                    new KeyUpdateMessage(hc, KeyUpdateRequest.NOTREQUSTED));
+                    new KeyUpdateMessage(hc, KeyUpdateRequest.NOTREQUESTED));
             }
 
             // clean handshake context
--- a/src/java.base/share/classes/sun/security/ssl/OutputRecord.java	Thu Jun 07 07:23:15 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/OutputRecord.java	Wed Jun 06 23:53:47 2018 -0700
@@ -288,11 +288,9 @@
             ProtocolVersion protocolVersion) {
         if (!encCipher.isNullCipher()) {
             // inner plaintext, using zero length padding.
-            int pos = destination.position();
-            destination.position(destination.limit());
-            destination.limit(destination.limit() + 1);
-            destination.put(contentType);
-            destination.position(pos);
+            int endOfPt = destination.limit();
+            destination.limit(endOfPt + 1);
+            destination.put(endOfPt, contentType);
         }
 
         // use the right TLSCiphertext.opaque_type and legacy_record_version
--- a/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java	Thu Jun 07 07:23:15 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java	Wed Jun 06 23:53:47 2018 -0700
@@ -256,7 +256,7 @@
 
                 PostHandshakeContext p = new PostHandshakeContext(tc);
                 KeyUpdate.handshakeProducer.produce(p,
-                    new KeyUpdateMessage(p, KeyUpdateRequest.REQUSTED));
+                    new KeyUpdateMessage(p, KeyUpdateRequest.REQUESTED));
             }
         }
 
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java	Thu Jun 07 07:23:15 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java	Wed Jun 06 23:53:47 2018 -0700
@@ -312,7 +312,7 @@
 
                 PostHandshakeContext p = new PostHandshakeContext(tc);
                 KeyUpdate.handshakeProducer.produce(p,
-                        new KeyUpdateMessage(p, KeyUpdateRequest.REQUSTED));
+                        new KeyUpdateMessage(p, KeyUpdateRequest.REQUESTED));
             }
         }
     }