/** @file\r
The implementation of IPsec.\r
\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
+ Copyright (c) 2009 - 2016, 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
UINT32 Pointer;\r
UINT8 *Option;\r
UINT8 OptionLen;\r
- BOOLEAN Flag;\r
UINT8 CountD;\r
UINT8 CountF;\r
UINT8 CountA;\r
}\r
\r
Pointer = 0;\r
- Flag = FALSE;\r
CountD = 0;\r
CountF = 0;\r
CountA = 0;\r
return FALSE;\r
}\r
\r
- Flag = TRUE;\r
-\r
//\r
// Fall through\r
//\r
on return.\r
@param[in] FragmentCount The number of fragments.\r
\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_OUT_OF_RESOURCES The required system resources can't be allocated.\r
-\r
**/\r
UINT8 *\r
IpSecTunnelOutboundPacket (\r
\r
if (IpVersion == IP_VERSION_4) {\r
InnerHead = AllocateZeroPool (sizeof (IP4_HEAD) + *OptionsLength);\r
- ASSERT (InnerHead != NULL);\r
+ if (InnerHead == NULL) {\r
+ return NULL;\r
+ }\r
+ \r
CopyMem (\r
InnerHead,\r
IpHead,\r
);\r
} else {\r
InnerHead = AllocateZeroPool (sizeof (EFI_IP6_HEADER) + *OptionsLength);\r
- ASSERT (InnerHead != NULL);\r
+ if (InnerHead == NULL) {\r
+ return NULL;\r
+ }\r
+ \r
CopyMem (\r
InnerHead,\r
IpHead,\r
IpSecOnRecyclePacket,\r
NULL\r
);\r
- ASSERT (Packet != NULL);\r
+ if (Packet == NULL) {\r
+ FreePool (InnerHead);\r
+ return NULL;\r
+ }\r
+ \r
//\r
// 3. Check the Last Header, if it is TCP, UDP or ICMP recalcualate its pesudo\r
// CheckSum.\r
//\r
// Update the total length field in ip header since processed by esp.\r
//\r
- if (!SadData->Mode == EfiIPsecTunnel) {\r
+ if (SadData->Mode != EfiIPsecTunnel) {\r
if (IpVersion == IP_VERSION_4) {\r
((IP4_HEAD *) IpHead)->TotalLen = HTONS ((UINT16) ((((IP4_HEAD *) IpHead)->HeadLen << 2) + PlainPayloadSize));\r
} else {\r
}\r
\r
//\r
- // Calculate the plain payload size accroding to the fragment table.\r
+ // Calculate the plain payload size according to the fragment table.\r
//\r
PlainPayloadSize = 0;\r
for (Index = 0; Index < *FragmentCount; Index++) {\r