Looks good. Minor comment - update the copyright to include 2016 as the last year it was updated, ex:

* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.

Send me the updated diffs and I will push it for you.

--Sean

On 12/7/16 9:14 AM, Adam Petcher wrote:

Minor improvement/optimization to ISO10126Padding. Simplifies the code a
bit and requests one fewer random byte. No regression test is provided
because this is a code cleanup, and the functionality is covered by
existing tests.

Bug: https://bugs.openjdk.java.net/browse/JDK-8158517

Diff:

diff --git
a/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java
b/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java
---
a/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java
+++
b/src/java.base/share/classes/com/sun/crypto/provider/ISO10126Padding.java
@@ -68,10 +68,10 @@
         }

         byte paddingOctet = (byte) (len & 0xff);
-        byte[] padding = new byte[len];
+        byte[] padding = new byte[len - 1];
         SunJCE.getRandom().nextBytes(padding);
-        padding[len-1] = paddingOctet;
-        System.arraycopy(padding, 0, in, off, len);
+        System.arraycopy(padding, 0, in, off, len - 1);
+        in[off + len - 1] = paddingOctet;
         return;
     }

@@ -101,7 +101,7 @@
             return -1;
         }

-        int start = off + len - ((int)lastByte & 0x0ff);
+        int start = off + len - padValue;
         if (start < off) {
             return -1;
         }

Reply via email to