]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IpSecDxe/Ikev2/Utility.c
NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.
[mirror_edk2.git] / NetworkPkg / IpSecDxe / Ikev2 / Utility.c
index 0c9c9297057d3573e069f1d6f578575022579a9e..162bbb27ee3817434a120e744acd11dec7cde35a 100644 (file)
@@ -1995,28 +1995,45 @@ Ikev2IsSupportAlg (
 /**\r
   Get the preferred algorithm types from ProposalData.\r
 \r
-  @param[in]  ProposalData              Pointer to related IKEV2_PROPOSAL_DATA.\r
-  @param[out] PreferEncryptAlgorithm    Output of preferred encrypt algorithm.\r
-  @param[out] PreferIntegrityAlgorithm  Output of preferred integrity algorithm.\r
-  @param[out] PreferPrfAlgorithm        Output of preferred PRF algorithm. Only\r
-                                        for IKE SA.\r
-  @param[out] PreferDhGroup             Output of preferred DH group. Only for\r
-                                        IKE SA.\r
-  @param[out] PreferEncryptKeylength    Output of preferred encrypt key length\r
-                                        in bytes.\r
-  @param[out] IsSupportEsn              Output of value about the Extented Sequence\r
-                                        Number is support or not. Only for Child SA.\r
-  @param[in]  IsChildSa                 If it is ture, the ProposalData is for IKE\r
-                                        SA. Otherwise the proposalData is for Child SA.\r
+  @param[in]      ProposalData              Pointer to related IKEV2_PROPOSAL_DATA.\r
+  @param[in, out] PreferEncryptAlgorithm    Pointer to buffer which is used to store the\r
+                                            preferred encrypt algorithm.\r
+                                            Input value shall be initialized to zero that\r
+                                            indicates to be parsed from ProposalData.\r
+                                            Output of preferred encrypt algorithm.\r
+  @param[in, out] PreferIntegrityAlgorithm  Pointer to buffer which is used to store the\r
+                                            preferred integrity algorithm.\r
+                                            Input value shall be initialized to zero that\r
+                                            indicates to be parsed from ProposalData.\r
+                                            Output of preferred integrity algorithm.\r
+  @param[in, out] PreferPrfAlgorithm        Pointer to buffer which is used to store the\r
+                                            preferred PRF algorithm.\r
+                                            Input value shall be initialized to zero that\r
+                                            indicates to be parsed from ProposalData.\r
+                                            Output of preferred PRF algorithm. Only\r
+                                            for IKE SA.\r
+  @param[in, out] PreferDhGroup             Pointer to buffer which is used to store the\r
+                                            preferred DH group.\r
+                                            Input value shall be initialized to zero that\r
+                                            indicates to be parsed from ProposalData.\r
+                                            Output of preferred DH group. Only for\r
+                                            IKE SA.\r
+  @param[out]     PreferEncryptKeylength    Pointer to buffer which is used to store the\r
+                                            preferred encrypt key length in bytes.\r
+  @param[out]     IsSupportEsn              Pointer to buffer which is used to store the\r
+                                            value about the Extented Sequence Number is\r
+                                            support or not. Only for Child SA.\r
+  @param[in]      IsChildSa                 If it is ture, the ProposalData is for IKE\r
+                                            SA. Otherwise the proposalData is for Child SA.\r
 \r
 **/\r
 VOID\r
 Ikev2ParseProposalData (\r
   IN     IKEV2_PROPOSAL_DATA  *ProposalData,\r
-     OUT UINT16               *PreferEncryptAlgorithm,\r
-     OUT UINT16               *PreferIntegrityAlgorithm,\r
-     OUT UINT16               *PreferPrfAlgorithm,\r
-     OUT UINT16               *PreferDhGroup,\r
+  IN OUT UINT16               *PreferEncryptAlgorithm,\r
+  IN OUT UINT16               *PreferIntegrityAlgorithm,\r
+  IN OUT UINT16               *PreferPrfAlgorithm,\r
+  IN OUT UINT16               *PreferDhGroup,\r
      OUT UINTN                *PreferEncryptKeylength,\r
      OUT BOOLEAN              *IsSupportEsn,\r
   IN     BOOLEAN              IsChildSa\r
@@ -2504,11 +2521,12 @@ Ikev2ChildSaParseSaPayload (
           ) {\r
         IsMatch = TRUE;\r
       } else {\r
-        PreferEncryptAlgorithm   = 0;\r
-        PreferIntegrityAlgorithm = 0;\r
-        IsSupportEsn             = TRUE;\r
+        IntegrityAlgorithm = 0;\r
+        EncryptAlgorithm   = 0;\r
+        EncryptKeylength   = 0;\r
+        IsSupportEsn       = FALSE;\r
       }\r
-       ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) +\r
+      ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) +\r
                      ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA));\r
     }\r
 \r