On Sat, 5 Dec 2020 23:23:47 GMT, Jamil Nimeh <[email protected]> wrote:
> This fix corrects a problem where ChaCha20-Poly1305 objects prior to init
> throw NPE when getParameters() is called. It will now generate parameters
> containing a random nonce on each pre-init call to getParameters().
> Post-initialization calls to the getParameters() method will always return
> the same set of parameters until the next initialization occurs.
src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java line
232:
> 230: // this call should cause a random nonce to be generated.
> 231: if (!initialized || nonce == null) {
> 232: nonce = createRandomNonce(null);
Should nonce be a local variable instead? I think you don't want the nonce
field to be set unless the caller passes back in the returned params in an init
call.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1644