/** @file\r
IKE Packet related operation.\r
\r
- Copyright (c) 2010, 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
\r
IkePacket->RefCount = 1;\r
InitializeListHead (&IkePacket->PayloadList);\r
- \r
+\r
IkePacket->Header = (IKE_HEADER *) AllocateZeroPool (sizeof (IKE_HEADER));\r
if (IkePacket->Header == NULL) {\r
FreePool (IkePacket);\r
\r
/**\r
Callback funtion of NetbufFromExt()\r
- \r
- @param[in] Arg The data passed from the NetBufFromExe(). \r
+\r
+ @param[in] Arg The data passed from the NetBufFromExe().\r
\r
**/\r
VOID\r
\r
/**\r
Copy the NetBuf into a IKE_PACKET sturcture.\r
- \r
- Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET \r
+\r
+ Create a IKE_PACKET and fill the received IKE header into the header of IKE_PACKET\r
and copy the recieved packet without IKE HEADER to the PayloadBuf of IKE_PACKET.\r
\r
- @param[in] Netbuf The pointer of the Netbuf which contains the whole received \r
+ @param[in] Netbuf The pointer of the Netbuf which contains the whole received\r
IKE packet.\r
\r
@return The pointer of the IKE_PACKET which contains the received packet.\r
\r
@param[in] SessionCommon Pointer of related IKE_COMMON_SESSION\r
@param[in] IkePacket Pointer of IKE_PACKET to be copy to NetBuf\r
- @param[in] IkeType The IKE type to pointer the packet is for which IKE \r
- phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE, \r
+ @param[in] IkeType The IKE type to pointer the packet is for which IKE\r
+ phase. Now it supports IKE_SA_TYPE, IKE_CHILDSA_TYPE,\r
IKE_INFO_TYPE.\r
\r
@return a pointer of Netbuff which contains the IKE_PACKE in network order.\r
- \r
+\r
**/\r
NET_BUF *\r
IkeNetbufFromPacket (\r
LIST_ENTRY *PacketEntry;\r
LIST_ENTRY *Entry;\r
IKE_PAYLOAD *IkePayload;\r
+ EFI_STATUS RetStatus;\r
+\r
+ RetStatus = EFI_SUCCESS;\r
\r
if (!IkePacket->IsEncoded) {\r
IkePacket->IsEncoded = TRUE;\r
// Encryption payloads if needed\r
//\r
if (((IKEV2_SESSION_COMMON *) SessionCommon)->IkeVer == 2) {\r
- Ikev2EncodePacket ((IKEV2_SESSION_COMMON *) SessionCommon, IkePacket, IkeType);\r
+ RetStatus = Ikev2EncodePacket ((IKEV2_SESSION_COMMON *) SessionCommon, IkePacket, IkeType);\r
+ if (EFI_ERROR (RetStatus)) {\r
+ return NULL;\r
+ }\r
+\r
} else {\r
//\r
- //If IKEv1 support, check it here.\r
+ // If IKEv1 support, check it here.\r
//\r
return NULL;\r
}\r
// Get the number of the payloads\r
//\r
NET_LIST_FOR_EACH (PacketEntry, &(IkePacket)->PayloadList) {\r
- \r
+\r
NumPayloads++;\r
}\r
//\r
IkePacketNetbufFree,\r
NULL\r
);\r
- \r
+\r
FreePool (Fragments);\r
return Netbuf;\r
}\r