RFR: ChaCha20 and ChaCha20/Poly1305 Cipher implementations

Jamil Nimeh jamil.j.nimeh at oracle.com
Thu Apr 26 17:38:18 UTC 2018

The NONCE_LENGTH I fixed last night in response to JVT comments.  I will do the clone also.  Thanks for the comments!

-------- Original message --------From: Sean Mullan <sean.mullan at oracle.com> Date: 4/26/18  10:22 AM  (GMT-08:00) To: Jamil Nimeh <jamil.j.nimeh at oracle.com>, OpenJDK Dev list <security-dev at openjdk.java.net> Subject: Re: RFR: ChaCha20 and ChaCha20/Poly1305 Cipher implementations 
On 4/26/18 11:57 AM, Sean Mullan wrote:
> The ChaCha20ParameterSpec.java file should have an @since 11 annotation 
> on it.


   65         if (nonce.length == 12) {
   66             this.nonce = nonce.clone();
   67         } else {
   68             throw new IllegalArgumentException(
   69                     "Nonce must be 96-bits in length");
   70         }

You should clone nonce before you check the length and check the length 
on the copy, not the parameter passed in. Also, you should use 
NONCE_LENGTH instead of 12 since it is already defined as a constant in 
the class.


> --Sean
> On 3/26/18 3:08 PM, 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/security-dev/attachments/20180426/ab2224df/attachment.html>

More information about the security-dev mailing list