-
Backport
-
Resolution: Fixed
-
P4
-
8
-
b12
-
Not verified
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.
One possible optimization is to save the key and, if it has not changed, skip recomputation on subsequent calls to Cipher.init. It'd also benefit the performance if the key expansion which currently is done in the method setSubKey() is moved to the same time when the keys are recomputed.
One possible optimization is to save the key and, if it has not changed, skip recomputation on subsequent calls to Cipher.init. It'd also benefit the performance if the key expansion which currently is done in the method setSubKey() is moved to the same time when the keys are recomputed.
- backport of
-
JDK-7185471 Avoid key expansion when AES cipher is re-init w/ the same key
- Closed