]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update the IPsec driver to check in invalid parameter of ProcessExt() according to...
authorqianouyang <qianouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 31 May 2011 02:03:57 +0000 (02:03 +0000)
committerqianouyang <qianouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 31 May 2011 02:03:57 +0000 (02:03 +0000)
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

NetworkPkg/IpSecDxe/IpSecImpl.c
NetworkPkg/IpSecDxe/IpSecImpl.h
NetworkPkg/IpSecDxe/IpSecMain.c

index 7ccbfa25eea5f8bdc71c2601588e7e6df87506ac..63abfa6ba67f410ff6d841f8fd1a55200e0b0ddc 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -1188,8 +1188,8 @@ IpSecTunnelInboundPacket (
   @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
@@ -1360,8 +1360,8 @@ IpSecTunnelOutboundPacket (
                                      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
@@ -1382,8 +1382,8 @@ IpSecEspInboundPacket (
   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
@@ -1647,8 +1647,8 @@ ON_EXIT:
                                      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
@@ -1665,8 +1665,8 @@ IpSecEspOutboundPacket (
   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
@@ -2046,8 +2046,8 @@ ON_EXIT:
                                      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
@@ -2064,8 +2064,8 @@ IpSecProtectInboundPacket (
   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
@@ -2105,8 +2105,8 @@ IpSecProtectInboundPacket (
                                      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
@@ -2123,8 +2123,8 @@ IpSecProtectOutboundPacket (
   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
index 4237119d93c54d32d2f5c2c6a7d72c8d93807795..ff7a189395b1ed4bd7f2dfeb6eadf8db85ae0646 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -158,8 +158,8 @@ struct _IPSEC_PRIVATE_DATA {
                                      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
@@ -176,8 +176,8 @@ IpSecProtectInboundPacket (
   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
@@ -196,8 +196,8 @@ IpSecProtectInboundPacket (
                                      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
@@ -214,8 +214,8 @@ IpSecProtectOutboundPacket (
   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
index f98f809ab8ba76f8baefe3da747d61965615c82d..a2fefa70d7127b009ec5f6e11fbb0ba642dd9eb9 100644 (file)
@@ -1,7 +1,7 @@
 /** @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
@@ -70,6 +70,13 @@ IpSecProcess (
   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