On Thu, 12 May 2022 21:31:39 GMT, Valerie Peng <valer...@openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java line 244:
>> 
>>> 242:                     iCount = DEFAULT_COUNT;
>>> 243:                 }
>>> 244:                 //if (ivSpec == null) { // old behavior always generate
>> 
>> How could `ivSpec` be non-null here? IIUC the only answer is from a previous 
>> `engineInit`, and it should not be retained. I suggest removing this check 
>> plus adding an explicit `ivSpec = null` at the beginning of this method 
>> along with `iCount` and `salt`. Those are the only 3 non final instance 
>> fields.
>
> Yeah, it's also possible that ivSpec is non-null if getParameters() is called 
> before init(). Now that salt and iCount is reset in the beginning of init(), 
> ivSpec should be reset too.

Oh, I didn't realize that. So now whenever `init()` is called every old param 
(no matter why it was set) is totally wiped. I like this consistent behavior.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8521

Reply via email to