Signed-off-by: qianouyang
Reviewed-by: jjin9
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11714
6f19259b-4bc3-4df7-8a09-
765794883524
/** @file\r
The implementation of IPsec.\r
\r
/** @file\r
The implementation of IPsec.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2011, 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
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
@param[in] IpVersion The version of IP.\r
@param[in] SadData The related SAD data.\r
@param[in, out] LastHead The Last Header in IP header. \r
@param[in] IpVersion The version of IP.\r
@param[in] SadData The related SAD data.\r
@param[in, out] LastHead The Last Header in IP header. \r
- @param[in] OptionsBuffer Pointer to the options buffer. It is optional.\r
- @param[in] OptionsLength Length of the options buffer. It is optional.\r
+ @param[in] OptionsBuffer Pointer to the options buffer.\r
+ @param[in] OptionsLength Length of the options buffer.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
to be trimed on input, and without ESP header\r
on return.\r
@param[out] LastHead The Last Header in IP header on return.\r
to be trimed on input, and without ESP header\r
on return.\r
@param[out] LastHead The Last Header in IP header on return.\r
- @param[in, out] OptionsBuffer Pointer to the options buffer. It is optional.\r
- @param[in, out] OptionsLength Length of the options buffer. It is optional.\r
+ @param[in, out] OptionsBuffer Pointer to the options buffer.\r
+ @param[in, out] OptionsLength Length of the options buffer.\r
@param[in, out] FragmentTable Pointer to a list of fragments in the form of IPsec\r
protected on input, and without IPsec protected\r
on return.\r
@param[in, out] FragmentTable Pointer to a list of fragments in the form of IPsec\r
protected on input, and without IPsec protected\r
on return.\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
OUT UINT8 *LastHead,\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
OUT UINT8 *LastHead,\r
- IN OUT VOID **OptionsBuffer, OPTIONAL\r
- IN OUT UINT32 *OptionsLength, OPTIONAL\r
+ IN OUT VOID **OptionsBuffer,\r
+ IN OUT UINT32 *OptionsLength,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
OUT EFI_IPSEC_SPD_SELECTOR **SpdSelector,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
OUT EFI_IPSEC_SPD_SELECTOR **SpdSelector,\r
to be processed on input, and inserted ESP header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header.\r
to be processed on input, and inserted ESP header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header.\r
- @param[in, out] OptionsBuffer Pointer to the options buffer. It is optional.\r
- @param[in, out] OptionsLength Length of the options buffer. It is optional.\r
+ @param[in, out] OptionsBuffer Pointer to the options buffer.\r
+ @param[in, out] OptionsLength Length of the options buffer.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
- IN OUT VOID **OptionsBuffer, OPTIONAL\r
- IN OUT UINT32 *OptionsLength, OPTIONAL\r
+ IN OUT VOID **OptionsBuffer,\r
+ IN OUT UINT32 *OptionsLength,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
IN IPSEC_SAD_ENTRY *SadEntry,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
IN IPSEC_SAD_ENTRY *SadEntry,\r
to be trimed on input, and without ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header on return.\r
to be trimed on input, and without ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header on return.\r
- @param[in, out] OptionsBuffer Pointer to the options buffer. It is optional.\r
- @param[in, out] OptionsLength Length of the options buffer. It is optional.\r
+ @param[in, out] OptionsBuffer Pointer to the options buffer.\r
+ @param[in, out] OptionsLength Length of the options buffer.\r
@param[in, out] FragmentTable Pointer to a list of fragments in form of IPsec\r
protected on input, and without IPsec protected\r
on return.\r
@param[in, out] FragmentTable Pointer to a list of fragments in form of IPsec\r
protected on input, and without IPsec protected\r
on return.\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
- IN OUT VOID **OptionsBuffer, OPTIONAL\r
- IN OUT UINT32 *OptionsLength, OPTIONAL\r
+ IN OUT VOID **OptionsBuffer,\r
+ IN OUT UINT32 *OptionsLength,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
OUT EFI_IPSEC_SPD_SELECTOR **SpdEntry,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
OUT EFI_IPSEC_SPD_SELECTOR **SpdEntry,\r
to be processed on input, and inserted ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header.\r
to be processed on input, and inserted ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header.\r
- @param[in, out] OptionsBuffer Pointer to the options buffer. It is optional.\r
- @param[in, out] OptionsLength Length of the options buffer. It is optional.\r
+ @param[in, out] OptionsBuffer Pointer to the options buffer.\r
+ @param[in, out] OptionsLength Length of the options buffer.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
- IN OUT VOID **OptionsBuffer, OPTIONAL\r
- IN OUT UINT32 *OptionsLength, OPTIONAL\r
+ IN OUT VOID **OptionsBuffer,\r
+ IN OUT UINT32 *OptionsLength,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
IN IPSEC_SAD_ENTRY *SadEntry,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
IN IPSEC_SAD_ENTRY *SadEntry,\r
/** @file\r
The definitions related to IPsec protocol implementation.\r
\r
/** @file\r
The definitions related to IPsec protocol implementation.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2011, 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
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
to be trimed on input, and without ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header on return.\r
to be trimed on input, and without ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header on return.\r
- @param[in, out] OptionsBuffer Pointer to the options buffer. It is optional.\r
- @param[in, out] OptionsLength Length of the options buffer. It is optional.\r
+ @param[in, out] OptionsBuffer Pointer to the options buffer.\r
+ @param[in, out] OptionsLength Length of the options buffer.\r
@param[in, out] FragmentTable Pointer to a list of fragments in form of IPsec\r
protected on input, and without IPsec protected\r
on return.\r
@param[in, out] FragmentTable Pointer to a list of fragments in form of IPsec\r
protected on input, and without IPsec protected\r
on return.\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
- IN OUT VOID **OptionsBuffer, OPTIONAL\r
- IN OUT UINT32 *OptionsLength, OPTIONAL\r
+ IN OUT VOID **OptionsBuffer,\r
+ IN OUT UINT32 *OptionsLength,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
OUT EFI_IPSEC_SPD_SELECTOR **SpdEntry,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
OUT EFI_IPSEC_SPD_SELECTOR **SpdEntry,\r
to be processed on input, and inserted ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header.\r
to be processed on input, and inserted ESP/AH header\r
on return.\r
@param[in, out] LastHead The Last Header in IP header.\r
- @param[in, out] OptionsBuffer Pointer to the options buffer. It is optional.\r
- @param[in, out] OptionsLength Length of the options buffer. It is optional.\r
+ @param[in, out] OptionsBuffer Pointer to the options buffer.\r
+ @param[in, out] OptionsLength Length of the options buffer.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
@param[in, out] FragmentTable Pointer to a list of fragments to be protected by\r
IPsec on input, and with IPsec protected\r
on return.\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
IN UINT8 IpVersion,\r
IN OUT VOID *IpHead,\r
IN OUT UINT8 *LastHead,\r
- IN OUT VOID **OptionsBuffer, OPTIONAL\r
- IN OUT UINT32 *OptionsLength, OPTIONAL\r
+ IN OUT VOID **OptionsBuffer,\r
+ IN OUT UINT32 *OptionsLength,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
IN IPSEC_SAD_ENTRY *SadEntry,\r
IN OUT EFI_IPSEC_FRAGMENT_DATA **FragmentTable,\r
IN OUT UINT32 *FragmentCount,\r
IN IPSEC_SAD_ENTRY *SadEntry,\r
/** @file\r
The mian interface of IPsec Protocol.\r
\r
/** @file\r
The mian interface of IPsec Protocol.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2011, 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
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
UINT8 OldLastHead;\r
BOOLEAN IsOutbound;\r
\r
UINT8 OldLastHead;\r
BOOLEAN IsOutbound;\r
\r
+ if (OptionsBuffer == NULL || \r
+ OptionsLength == NULL || \r
+ FragmentTable == NULL || \r
+ FragmentCount == NULL\r
+ ) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
Private = IPSEC_PRIVATE_DATA_FROM_IPSEC (This);\r
IpPayload = (*FragmentTable)[0].FragmentBuffer;\r
IsOutbound = (BOOLEAN) ((TrafficDirection == EfiIPsecOutBound) ? TRUE : FALSE);\r
Private = IPSEC_PRIVATE_DATA_FROM_IPSEC (This);\r
IpPayload = (*FragmentTable)[0].FragmentBuffer;\r
IsOutbound = (BOOLEAN) ((TrafficDirection == EfiIPsecOutBound) ? TRUE : FALSE);\r