From: "Ye, Ting" <ting.ye@intel.com>
To: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Fu, Siyuan" <siyuan.fu@intel.com>
Subject: Re: [PATCH v2] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.
Date: Fri, 19 Oct 2018 07:08:07 +0000 [thread overview]
Message-ID: <BC0C045B0E2A584CA4575E779FA2C12A1AB356E9@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20181018084423.12388-1-Jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
-----Original Message-----
From: Wu, Jiaxin
Sent: Thursday, October 18, 2018 4:44 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan <siyuan.fu@intel.com>; Ye, Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [PATCH v2] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1251
*v2: Correct the type of parameters in Ikev2ParseProposalData(), and refined the corresponding description.
IpSecDxe failed to create the Child SA during parsing SA Payload, the issue was caused by the below commit:
SHA-1: 1e0db7b11987d0ec93be7dfe26102a327860fdbd
* MdeModulePkg/NetworkPkg: Checking for NULL pointer before use.
In above commit, it changed the value of IsMatch in Ikev2ChildSaParseSaPayload() to FALSE. That's correct but it exposed the potential bug in to match the correct proposal Data, which will cause the issue happen.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
NetworkPkg/IpSecDxe/Ikev2/Utility.c | 64 ++++++++++++++++++-----------
1 file changed, 41 insertions(+), 23 deletions(-)
diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
index 0c9c929705..63de56f09e 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
@@ -1993,34 +1993,51 @@ Ikev2IsSupportAlg ( }
/**
Get the preferred algorithm types from ProposalData.
- @param[in] ProposalData Pointer to related IKEV2_PROPOSAL_DATA.
- @param[out] PreferEncryptAlgorithm Output of preferred encrypt algorithm.
- @param[out] PreferIntegrityAlgorithm Output of preferred integrity algorithm.
- @param[out] PreferPrfAlgorithm Output of preferred PRF algorithm. Only
- for IKE SA.
- @param[out] PreferDhGroup Output of preferred DH group. Only for
- IKE SA.
- @param[out] PreferEncryptKeylength Output of preferred encrypt key length
- in bytes.
- @param[out] IsSupportEsn Output of value about the Extented Sequence
- Number is support or not. Only for Child SA.
- @param[in] IsChildSa If it is ture, the ProposalData is for IKE
- SA. Otherwise the proposalData is for Child SA.
+ @param[in] ProposalData Pointer to related IKEV2_PROPOSAL_DATA.
+ @param[in, out] PreferEncryptAlgorithm Pointer to buffer which is used to store the
+ preferred encrypt algorithm.
+ Input value shall be initialized to zero that
+ indicates to be parsed from ProposalData.
+ Output of preferred encrypt algorithm.
+ @param[in, out] PreferIntegrityAlgorithm Pointer to buffer which is used to store the
+ preferred integrity algorithm.
+ Input value shall be initialized to zero that
+ indicates to be parsed from ProposalData.
+ Output of preferred integrity algorithm.
+ @param[in, out] PreferPrfAlgorithm Pointer to buffer which is used to store the
+ preferred PRF algorithm.
+ Input value shall be initialized to zero that
+ indicates to be parsed from ProposalData.
+ Output of preferred PRF algorithm. Only
+ for IKE SA.
+ @param[in, out] PreferDhGroup Pointer to buffer which is used to store the
+ preferred DH group.
+ Input value shall be initialized to zero that
+ indicates to be parsed from ProposalData.
+ Output of preferred DH group. Only for
+ IKE SA.
+ @param[in, out] PreferEncryptKeylength Pointer to buffer which is used to store the
+ preferred encrypt key length in bytes.
+ @param[in, out] IsSupportEsn Pointer to buffer which is used to store the
+ value about the Extented Sequence Number is
+ support or not. Only for Child SA.
+ @param[in] IsChildSa If it is ture, the ProposalData is for IKE
+ SA. Otherwise the proposalData is for Child SA.
**/
VOID
Ikev2ParseProposalData (
IN IKEV2_PROPOSAL_DATA *ProposalData,
- OUT UINT16 *PreferEncryptAlgorithm,
- OUT UINT16 *PreferIntegrityAlgorithm,
- OUT UINT16 *PreferPrfAlgorithm,
- OUT UINT16 *PreferDhGroup,
- OUT UINTN *PreferEncryptKeylength,
- OUT BOOLEAN *IsSupportEsn,
+ IN OUT UINT16 *PreferEncryptAlgorithm,
+ IN OUT UINT16 *PreferIntegrityAlgorithm,
+ IN OUT UINT16 *PreferPrfAlgorithm,
+ IN OUT UINT16 *PreferDhGroup,
+ IN OUT UINTN *PreferEncryptKeylength,
+ IN OUT BOOLEAN *IsSupportEsn,
IN BOOLEAN IsChildSa
)
{
IKEV2_TRANSFORM_DATA *TransformData;
UINT8 TransformIndex;
@@ -2502,15 +2519,16 @@ Ikev2ChildSaParseSaPayload (
IntegrityAlgorithm == PreferIntegrityAlgorithm &&
IsSupportEsn == PreferIsSupportEsn
) {
IsMatch = TRUE;
} else {
- PreferEncryptAlgorithm = 0;
- PreferIntegrityAlgorithm = 0;
- IsSupportEsn = TRUE;
+ IntegrityAlgorithm = 0;
+ EncryptAlgorithm = 0;
+ EncryptKeylength = 0;
+ IsSupportEsn = FALSE;
}
- ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) +
+ ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1)
+ +
ProposalData->NumTransforms * sizeof (IKEV2_TRANSFORM_DATA));
}
ProposalData = (IKEV2_PROPOSAL_DATA *)((IKEV2_SA_DATA *)SaPayload->PayloadBuf + 1);
if (IsMatch) {
--
2.17.1.windows.2
prev parent reply other threads:[~2018-10-19 7:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 8:44 [PATCH v2] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload Jiaxin Wu
2018-10-19 7:08 ` Ye, Ting [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BC0C045B0E2A584CA4575E779FA2C12A1AB356E9@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox