Fix NullPointerException in handling Cookie payload

When IKE library receives a Cookie payload in an IKE
INIT response, it should retry sending IKE INIT
request with the same SPI, and expect receiving
another IKE INIT response that containing payloads
for SA setup.

It also means that after IKE library has received
the Cookie payload, it should maintain the
allocated SPI resources, because the SPI resources
will be used in SA setup later.

The cause of NullPointerException is IKE library
closed and nulled out the SPI resources after it
received a Cookie payload. And then when IKE library
received the second IKE INIT response, it tried to
use the null-value SPI resources to set up the SA
by calling IkeSaRecord.makeFirstIkeSaRecord.

Bug: 179776241
Test: FrameworksIkeTests (new tests added)
Change-Id: Ia49b65051ca2576f74218b5e1a9ee3834b22a2ff
2 files changed
tree: c56225685423e13c4885d24d6c9ed4d07dc22808
  1. apex/
  2. api/
  3. src/
  4. tests/
  5. Android.bp
  6. jarjar-rules-shared.txt
  7. jarjar-rules-test.txt
  8. OWNERS
  9. PREUPLOAD.cfg
  10. README.md
  11. TEST_MAPPING
README.md

IKEv2 Library for Android

Introduction

This IKEv2 library is an in-process client library implementing the IKEv2 protocol as well as extensions necessary for the support of IWLAN. It is designed to work in a non-privileged fashion on top of the Android IPsec API surface.