RFR: 8002277: Refactor two PBE classes to simplify maintenance [v7]
Weijun Wang
weijun at openjdk.java.net
Thu May 12 20:57:38 UTC 2022
On Thu, 12 May 2022 03:28:15 GMT, Valerie Peng <valeriep at openjdk.org> wrote:
>> This change refactors the PBES2Core and PKCS12PBECipherCore classes in SunJCE provider as requested in the bug record. Functionality should remain the same with a clearer and simplified code/control flow with less lines of code. This should improve readability and maintenance. I enhanced one existing regression test to test more scenarios. This test would pass before the proposed change and continues to pass with the proposed changes.
>
> 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.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8521
More information about the security-dev
mailing list