RFR: 8308118: Avoid multiarray allocations in AESCrypt.makeSessionKey [v2]
Aleksey Shipilev
shade at openjdk.org
Tue May 16 09:30:45 UTC 2023
On Tue, 16 May 2023 08:29:52 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/java.base/share/classes/com/sun/crypto/provider/AESCrypt.java line 1369:
>>
>>> 1367: int BC = 4;
>>> 1368: int[][] Ke = new int[ROUNDS + 1][]; // encryption round keys
>>> 1369: int[][] Kd = new int[ROUNDS + 1][]; // decryption round keys
>>
>> This is more a question of curiosity and likely beyond the scope of this PR/bug ID -- would it be beneficial to refactor this to allocate and operate over just two arrays, one for Ke and one for Kd, effectively removing the need for allocation in `expandToSubKey` as well?
>>
>>
>> int[] Ke = new int[4 * (ROUNDS + 1)];
>> int[] Kd = new int[4 * (ROUNDS + 1)];
>
> True, let me try that!
New commit implements this, with even more performance benefits.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13996#discussion_r1194883146
More information about the security-dev
mailing list