RFR: ChaCha20 and ChaCha20/Poly1305 Cipher implementations
sha.jiang at oracle.com
sha.jiang at oracle.com
Wed Mar 28 06:48:04 UTC 2018
Hi Jamil,
I have a minor point on your tests.
-- com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20KAT.java
505 private static byte[] hex2bin(String hex) {
506 int i;
507 int len = hex.length();
508 byte[] data = new byte [len / 2];
509 for (i = 0; i < len; i += 2) {
510 data[i / 2] = (byte)((Character.digit(hex.charAt(i),
16) << 4) +
511 Character.digit(hex.charAt(i + 1), 16));
512 }
513 return data;
514 }
Would you like to move this method to a test lib class, like
test/lib/jdk/test/lib/Utils.java? In fact, this class has a method,
named toHexString, for converting bin to hex.
I think your method will be reused by other tests, including your
another test
com/sun/crypto/provider/Cipher/ChaCha20/ChaCha20Poly1305ParamTest.java.
In addition, you may want to declare the local variable "i" in the
initialization expression in the for-loop.
Best regards,
John Jiang
On 27/03/2018 03:08, Jamil Nimeh wrote:
> Hello all,
>
> This is a request for review for the ChaCha20 and ChaCha20-Poly1305
> cipher implementations. Links to the webrev and the JEP which
> outlines the characteristics and behavior of the ciphers are listed
> below.
>
> http://cr.openjdk.java.net/~jnimeh/reviews/8153028/webrev.01/
> http://openjdk.java.net/jeps/329
>
> Thanks,
> --Jamil
>
More information about the security-dev
mailing list