On Fri, 7 Nov 2025 07:53:37 GMT, Shawn M Emery <[email protected]> wrote:
> This fix improves performance in the AES key schedule generation by > eliminating an unnecessary object and unnecessary mask in the inverse key > schedule. > > The micro:org.openjdk.bench.javax.crypto.AESReinit benchmark results are > improved by 6.96% for arm64 and 7.79% for x86_64. > > Thank you @jnimeh for catching the unnecessary byte mask! src/java.base/share/classes/com/sun/crypto/provider/AES_Crypt.java line 1017: > 1015: | ((SBOX[(b1 & 0xF0) >> 4][b1 & 0x0F] & 0xFF) << 16) > 1016: | ((SBOX[(b2 & 0xF0) >> 4][b2 & 0x0F] & 0xFF) << 8) > 1017: | (SBOX[(word & 0xF0) >> 4][word & 0x0F] & 0xFF); I think there is no need for any of these bytes. Every index can be computed as "(word >> offset) & 0x0F. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28188#discussion_r2502711179
