mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8282534: Remove redundant null check in ChaCha20Cipher.engineInit
Reviewed-by: xuelei
This commit is contained in:
parent
e8caf84fb9
commit
80415e04c5
1 changed files with 3 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2022, 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
|
||||
|
@ -159,7 +159,7 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
* ciphers, but allow {@code NoPadding}. See JCE spec.
|
||||
*
|
||||
* @param padding The padding type. The only allowed value is
|
||||
* {@code NoPadding} case insensitive).
|
||||
* {@code NoPadding} case insensitive.
|
||||
*
|
||||
* @throws NoSuchPaddingException if a padding scheme besides
|
||||
* {@code NoPadding} is provided.
|
||||
|
@ -393,7 +393,7 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
return;
|
||||
}
|
||||
|
||||
byte[] newNonce = null;
|
||||
byte[] newNonce;
|
||||
switch (mode) {
|
||||
case MODE_NONE:
|
||||
throw new InvalidAlgorithmParameterException(
|
||||
|
@ -420,12 +420,6 @@ abstract class ChaCha20Cipher extends CipherSpi {
|
|||
throw new RuntimeException("Invalid mode: " + mode);
|
||||
}
|
||||
|
||||
// If after all the above processing we still don't have a nonce value
|
||||
// then supply a random one provided a random source has been given.
|
||||
if (newNonce == null) {
|
||||
newNonce = createRandomNonce(random);
|
||||
}
|
||||
|
||||
// Continue with initialization
|
||||
init(opmode, key, newNonce);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue