RFR 8226543 : Reduce GC pressure during message digest calculations in password-based encryption
Ivan Gerasimov
ivan.gerasimov at oracle.com
Fri Jun 21 02:22:59 UTC 2019
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).
--
With kind regards,
Ivan Gerasimov
More information about the security-dev
mailing list