RFR 8226543 : Reduce GC pressure during message digest calculations in password-based encryption
Sean Mullan
sean.mullan at oracle.com
Tue Jun 25 17:55:24 UTC 2019
Hi Ivan,
This fix looks good.
--Sean
On 6/20/19 10:22 PM, Ivan Gerasimov wrote:
> Hello!
>
> In PBES1Core.deriveCipherKey() there are loops that look like following:
>
> for (int i = 0; i < iCount; i++) {
> md.update(toBeHashed);
> toBeHashed = md.digest(); // this resets the digest
> }
>
> Calling md.digest() each time allocates a new byte[] array.
> It would be more GC friendly, if the same array were reused.
>
> In the fix, a first call to md.digest() allocates a properly sized array.
> Subsequent iterations reuse this array.
>
> Would you please help review?
>
> BUGURL: https://bugs.openjdk.java.net/browse/JDK-8226543
> WEBREV: http://cr.openjdk.java.net/~igerasim/8226543/00/webrev/
>
> No new regression test, as the behavior was not changed.
> Mach5 control job is green (tiers 1-4 on all supported platforms).
>
More information about the security-dev
mailing list