Created attachment 932685 [details]
When OpenJDK 8 negotiates an AES-GCM cipher suite with a TLS peer, performance is extremely poor. To a large degree, this is due to a very inefficient implementation of the GHASH primitive within the AES-GCM implementation.
The upstream review thread is here:
Upstream does not appear to be inclined to review this patch at all, despite the crippling performance impact (less than 30 Mbps even on rather high-end hardware).
The patch I posted (and which is attached to this bug) only removes some of the allocations in the AES-GCM implementations, so there is quite a bit of room for additional improvements. Even after these changes, the TLS implementation will allocate four bytes for every byte transferred. Changing this is not too difficult, but it is less self-contained than the GHASH performance fix and should definitely happen upstream first.
Hubert Kario kindly emulated the OpenJDK TLS handshake and used his most recent scan <https://securitypitfalls.wordpress.com/2014/08/03/july-2014-scan-results/> to estimate which fraction of the servers in the set negotiates an AES-GCM cipher suite with OpenJDK 8. According to these numbers, around 40% support AES-GCM, and 20% will negotiate it with an OpenJDK peer. This makes it fairly likely that programs will run into the performance issue.
We've tried using AES-GCM cipher suites in our product but had to revert to CBC suites due to the extremely poor performance. I think this bug should have a very high priority.
Current upstream discussion (for JDK 9):
Most recent webrev so far:
JDK 9 change was committed upstream: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/054e5baae476
I will wait a few days and propose the backport to JDK 8 after it has soaked a bit in 9.
Backport has been committed upstream, for 8u60:
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.
More information and reason for this action is here:
This was fixed in u60: