RFR: 8326609: New AES implementation with updates specified in FIPS 197 [v8]

Valerie Peng valeriep at openjdk.org
Fri Oct 17 07:07:11 UTC 2025


On Fri, 17 Oct 2025 06:52:39 GMT, Shawn M Emery <duke at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/AES_Crypt.java line 958:
>> 
>>> 956:      * @return the processed round key row.
>>> 957:      */
>>> 958:     private static int invMix(int[] state, int idx) {
>> 
>> It seems that we can just use an `int` argument and make the callers do the array dereferencing. This way we can get rid of the temporary buffer inside `invMixRKey(int[])` as passing an integer to `invMix(int)` method will not affect the array, e.g.
>> 
>>     private static void invMixRKey(int[] state) {
>>         state[0] = invMix(state[0]);
>>         state[1] = invMix(state[1]);
>>         state[2] = invMix(state[2]);
>>         state[3] = invMix(state[3]);
>>     }
>
> I've removed this method and inlined this logic in the invGenRoundKeys method.

Sure, this works as well.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27807#discussion_r2438612714


More information about the security-dev mailing list