Bug 1135504

Summary: java-1.8.0-openjdk: GHASH performance improvement
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: java-1.8.0-openjdkAssignee: jiri vanek <jvanek>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: ahughes, aph, dbhole, jens.borgland, jvanek, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: java-1.8.0-openjdk-1.8.0.60-14.b27.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-30 07:41:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
jdk.patch none

Description Florian Weimer 2014-08-29 13:22:42 UTC
Created attachment 932685 [details]
jdk.patch

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:

http://mail.openjdk.java.net/pipermail/security-dev/2014-August/011009.html

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.

Comment 5 jens.borgland 2015-01-20 08:53:29 UTC
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.

Comment 7 Florian Weimer 2015-01-20 09:41:49 UTC
Current upstream discussion (for JDK 9):

  <http://mail.openjdk.java.net/pipermail/security-dev/2015-January/011601.html>

Most recent webrev so far:

  <http://cr.openjdk.java.net/~fweimer/8069072/webrev.01/>

Comment 8 Florian Weimer 2015-02-10 09:36:57 UTC
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.

Comment 9 Florian Weimer 2015-02-16 18:48:05 UTC
Backport has been committed upstream, for 8u60:

http://hg.openjdk.java.net/jdk8u/jdk8u-dev/jdk/rev/5923854f14f7

Comment 10 Jaroslav Reznik 2015-03-03 16:15:25 UTC
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:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 11 Andrew John Hughes 2016-01-30 07:41:30 UTC
This was fixed in u60:

https://bugs.openjdk.java.net/browse/JDK-8069072