Red Hat Bugzilla – Bug 1002312
IKEv2 skeyseed calculation only succeeds because of unspecified compiler behaviour
Last modified: 2013-11-21 18:47:45 EST
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.
Created attachment 791536 [details]
patch to fix re-using uninitialised variable
(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.
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.