]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IpSecDxe/Ikev2/Exchange.c
NetworkPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / NetworkPkg / IpSecDxe / Ikev2 / Exchange.c
index 37f9667d3d1ec1bb3bc44072e24b32b3c6a907e6..dc219c53535e3e7d15927a8a91be0f6dfa59bf52 100644 (file)
@@ -1,15 +1,9 @@
 /** @file\r
   The general interfaces of the IKEv2.\r
 \r
-  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -330,7 +324,7 @@ Ikev2NegotiateInfo (
     //\r
     // Send out the Packet\r
     //\r
-    if (UdpService != NULL) {\r
+    if (UdpService != NULL && UdpService->Output != NULL) {\r
       Status = Ikev2SendIkePacket (UdpService, (UINT8 *) SaCommon, IkePacket, 0);\r
 \r
       if (EFI_ERROR (Status)) {\r
@@ -357,7 +351,7 @@ Ikev2NegotiateInfo (
       //\r
       // Send out the Packet\r
       //\r
-      if (UdpService != NULL) {\r
+      if (UdpService != NULL && UdpService->Output != NULL) {\r
         Status = Ikev2SendIkePacket (UdpService, (UINT8 *) &ChildSaSession->SessionCommon, IkePacket, 0);\r
 \r
         if (EFI_ERROR (Status)) {\r
@@ -495,6 +489,10 @@ Ikev2HandleSa (
             IsListEmpty (&IkeSaSession->ChildSaEstablishSessionList));\r
 \r
     ChildSaSession = Ikev2ChildSaSessionCreate (IkeSaSession, UdpService);\r
+    if (ChildSaSession == NULL) {\r
+      goto ON_ERROR;\r
+    }\r
+\r
     ChildSaCommon  = &ChildSaSession->SessionCommon;\r
   }\r
 \r
@@ -519,6 +517,10 @@ Ikev2HandleSa (
             IsListEmpty (&IkeSaSession->ChildSaEstablishSessionList));\r
 \r
     ChildSaSession = Ikev2ChildSaSessionCreate (IkeSaSession, UdpService);\r
+    if (ChildSaSession == NULL) {\r
+      goto ON_ERROR;\r
+    }\r
+\r
     ChildSaCommon  = &ChildSaSession->SessionCommon;\r
 \r
     //\r
@@ -697,7 +699,7 @@ ON_REPLY:
   //\r
   // Generate the reply packet if needed and send it out.\r
   //\r
-  if (IkePacket->Header->Flags != IKE_HEADER_FLAGS_RESPOND) {\r
+  if (!(IkePacket->Header->Flags & IKE_HEADER_FLAGS_RESPOND)) {\r
     Reply = mIkev2CreateChild.Generator ((UINT8 *) IkeSaSession, &IkePacket->Header->MessageId);\r
     if (Reply != NULL) {\r
       Status = Ikev2SendIkePacket (UdpService, (UINT8 *) &(IkeSaSession->SessionCommon), Reply, 0);\r