United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8000367 : Avoid key expansion when AES cipher is re-init w/ the same key

Details
Type:
Backport
Submit Date:
2012-10-03
Status:
Closed
Updated Date:
2012-11-13
Project Name:
JDK
Resolved Date:
2012-10-05
Component:
security-libs
OS:
Sub-Component:
javax.crypto
CPU:
Priority:
P4
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:
7u10 (b12)

Related Reports
Backport:

Sub Tasks

Description
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.

                                    

Comments



Hardware and Software, Engineered to Work Together