8173581: performance regression in com/sun/crypto/provider/OutputFeedback.java
authorrasbold
Tue, 31 Jan 2017 21:33:54 +0000
changeset 43339 0d9c9ef833e3
parent 43338 f9c4f82a8265
child 43340 4d25acf48a0b
8173581: performance regression in com/sun/crypto/provider/OutputFeedback.java Summary: Corrected the problem in OutputFeedback class Reviewed-by: valeriep Contributed-by: rasbold@google.com
jdk/src/java.base/share/classes/com/sun/crypto/provider/OutputFeedback.java
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/OutputFeedback.java	Tue Jan 31 13:18:34 2017 -0800
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/OutputFeedback.java	Tue Jan 31 21:33:54 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -162,11 +162,11 @@
             for (int i = 0; i < numBytes; i++) {
                 cipher[i + cipherOffset] =
                     (byte)(k[i] ^ plain[i + plainOffset]);
-                if (nShift != 0) {
-                    System.arraycopy(register, numBytes, register, 0, nShift);
-                }
-                System.arraycopy(k, 0, register, nShift, numBytes);
             }
+            if (nShift != 0) {
+                System.arraycopy(register, numBytes, register, 0, nShift);
+            }
+            System.arraycopy(k, 0, register, nShift, numBytes);
         }
         return plainLen;
     }