jdk/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
changeset 16067 36055e4b5305
parent 16045 9d08c3b9a6a0
child 16913 a6f4d1626ad9
--- a/jdk/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java	Tue Mar 12 10:35:44 2013 -0400
+++ b/jdk/src/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java	Tue Mar 12 15:31:49 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -165,18 +165,16 @@
         // partition keyblock into individual secrets
 
         int ofs = 0;
-        if (macLength != 0) {
-            byte[] tmp = new byte[macLength];
+        byte[] tmp = new byte[macLength];
 
-            // mac keys
-            System.arraycopy(keyBlock, ofs, tmp, 0, macLength);
-            ofs += macLength;
-            clientMacKey = new SecretKeySpec(tmp, "Mac");
+        // mac keys
+        System.arraycopy(keyBlock, ofs, tmp, 0, macLength);
+        ofs += macLength;
+        clientMacKey = new SecretKeySpec(tmp, "Mac");
 
-            System.arraycopy(keyBlock, ofs, tmp, 0, macLength);
-            ofs += macLength;
-            serverMacKey = new SecretKeySpec(tmp, "Mac");
-        }
+        System.arraycopy(keyBlock, ofs, tmp, 0, macLength);
+        ofs += macLength;
+        serverMacKey = new SecretKeySpec(tmp, "Mac");
 
         if (keyLength == 0) { // SSL_RSA_WITH_NULL_* ciphersuites
             return new TlsKeyMaterialSpec(clientMacKey, serverMacKey);
@@ -200,7 +198,7 @@
 
             // IV keys if needed.
             if (ivLength != 0) {
-                byte[] tmp = new byte[ivLength];
+                tmp = new byte[ivLength];
 
                 System.arraycopy(keyBlock, ofs, tmp, 0, ivLength);
                 ofs += ivLength;
@@ -222,8 +220,8 @@
                 // TLS 1.0
                 byte[] seed = concat(clientRandom, serverRandom);
 
-                byte[] tmp = doTLS10PRF(clientKeyBytes,
-                    LABEL_CLIENT_WRITE_KEY, seed, expandedKeyLength, md5, sha);
+                tmp = doTLS10PRF(clientKeyBytes, LABEL_CLIENT_WRITE_KEY, seed,
+                            expandedKeyLength, md5, sha);
                 clientCipherKey = new SecretKeySpec(tmp, alg);
 
                 tmp = doTLS10PRF(serverKeyBytes, LABEL_SERVER_WRITE_KEY, seed,
@@ -241,7 +239,7 @@
                 }
             } else {
                 // SSLv3
-                byte[] tmp = new byte[expandedKeyLength];
+                tmp = new byte[expandedKeyLength];
 
                 md5.update(clientKeyBytes);
                 md5.update(clientRandom);