changeset 53658:cecba555360c

8214321: Misleading code in SSLCipher Reviewed-by: ascarpino
author xuelei
date Mon, 26 Nov 2018 20:50:21 -0800
parents 7084dae775f2
children d9f6a700fec9 0d757a37896c
files src/java.base/share/classes/sun/security/ssl/SSLCipher.java
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Tue Nov 27 08:51:20 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Mon Nov 26 20:50:21 2018 -0800
@@ -530,22 +530,22 @@
             ProtocolVersion protocolVersion,
             SecretKey key, IvParameterSpec iv,
             SecureRandom random) throws GeneralSecurityException {
-        if (readCipherGenerators.length == 0) {
+        if (writeCipherGenerators.length == 0) {
             return null;
         }
 
-        WriteCipherGenerator rcg = null;
+        WriteCipherGenerator wcg = null;
         for (Map.Entry<WriteCipherGenerator,
                 ProtocolVersion[]> me : writeCipherGenerators) {
             for (ProtocolVersion pv : me.getValue()) {
                 if (protocolVersion == pv) {
-                    rcg = me.getKey();
+                    wcg = me.getKey();
                 }
             }
         }
 
-        if (rcg != null) {
-            return rcg.createCipher(this, authenticator,
+        if (wcg != null) {
+            return wcg.createCipher(this, authenticator,
                     protocolVersion, transformation, key, iv, random);
         }
         return null;