RFR: 8002277: Refactor two PBE classes to simplify maintenance [v7]

Valerie Peng valeriep at openjdk.java.net
Thu May 12 21:34:41 UTC 2022


On Thu, 12 May 2022 20:53:00 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> Valerie Peng has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   trivial syntax fix.
>
> 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.

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

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



More information about the security-dev mailing list