Request for Review: AESCrypt.init performance JDK change

Deneau, Tom tom.deneau at amd.com
Mon Jul 16 20:08:45 UTC 2012


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






More information about the security-dev mailing list