Bug 1002312

Summary: IKEv2 skeyseed calculation only succeeds because of unspecified compiler behaviour
Product: Red Hat Enterprise Linux 6 Reporter: Paul Wouters <pwouters>
Component: openswanAssignee: Paul Wouters <pwouters>
Status: CLOSED ERRATA QA Contact: Ondrej Moriš <omoris>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: amarecek, eparis, omoris, pwouters, sgrubb
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 23:47:45 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
patch to fix re-using uninitialised variable none

Description Paul Wouters 2013-08-28 21:17:36 UTC
After exchanging nonces in IKEv2 for creating a shared secret, the function calc_skeyseed_v2() is called. It uses a variable PK11SymKey *tkey11;
This variable is defined within a for loop, meaning each iteration gets a fresh new variable. However, the code actually does two passes and expects the content to survive. And for some lucky reason with our current compiler, it does. On the second iteration, it gets the same memory location back, and things work miraculously.

I asked what we should do. This has worked in every RHEL6 release (although it should not have). Steve Grubb suggested that I fix this for RHEL 6.5 because of certification.

When the code is fixed with the attached patch, an interop should be done to either a non-openswan system using IKEv2, or an older unpatched openswan system with IKEv2. I confirmed the code works by doing an interop with strongswan.

furthermore, you should see the gcc compiler warning about tkey11 for "could be used uninitialised" vanish from the build log.

Comment 1 Paul Wouters 2013-08-28 21:18:42 UTC
Created attachment 791536 [details]
patch to fix re-using uninitialised variable

Comment 6 Ondrej Moriš 2013-10-03 12:30:00 UTC
(In reply to Paul Wouters from comment #0)

> furthermore, you should see the gcc compiler warning about tkey11 for "could
> be used uninitialised" vanish from the build log.

It looks like gcc was never complained about this at least while rebuilding source rpm package. Therefore I am just checking that openswan<->strongswan connection with ikev2=insist option on openswan side and keyexchange=ikev2 on strongswan side works.

Comment 8 errata-xmlrpc 2013-11-21 23:47:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1718.html