Bug 1002312 - IKEv2 skeyseed calculation only succeeds because of unspecified compiler behaviour
IKEv2 skeyseed calculation only succeeds because of unspecified compiler beha...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: openswan (Show other bugs)
6.5
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Paul Wouters
Ondrej Moriš
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-28 17:17 EDT by Paul Wouters
Modified: 2013-11-21 18:47 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 18:47:45 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch to fix re-using uninitialised variable (541 bytes, patch)
2013-08-28 17:18 EDT, Paul Wouters
no flags Details | Diff

  None (edit)
Description Paul Wouters 2013-08-28 17:17:36 EDT
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 17:18:42 EDT
Created attachment 791536 [details]
patch to fix re-using uninitialised variable
Comment 6 Ondrej Moriš 2013-10-03 08:30:00 EDT
(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 18:47:45 EST
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

Note You need to log in before you can comment on or make changes to this bug.