Request for Review: AESCrypt.init performance JDK change

Alan Bateman Alan.Bateman at oracle.com
Tue Jul 17 08:00:23 UTC 2012


On 16/07/2012 21:08, Deneau, Tom wrote:
> Please review the following webrev which improves performance for the
> com/sun/crypto/provider when the algorithm is AES for some kinds of
> Cipher usage patterns.
>
> http://cr.openjdk.java.net/~tdeneau/aescrypt-init-performance/webrev.01/
>
> I do not have a bug number for this change but a description would be
> something like the following:
>
>     Consider an application which holds on to a Cipher object for AES
>     and keeps the same key but calls Cipher.init to change the Cipher
>     between encryption and decryption.  The current code in
>     AESCrypt.java recomputes the expanded key (which is an expensive
>     operation) with each call to init.
>
> The proposed code saves the key and, if it has not changed, does not
> need to recompute on subsequent calls to Cipher.init.  The proposed
> code also incorporates into the key calculation the final step which
> was the expansion of the key to a 1-dimensional array of ints.  This
> step used to be done in the routine setSubKey.
>
> -- Tom Deneau
Tom - I assume this will need to get reviewed for jdk8 and bake in that 
forest for a bit before it can be considered for 7u.

-Alan.



More information about the security-dev mailing list