From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 0D5A6940E7D for ; Wed, 10 Jan 2024 01:34:58 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Y6e8YsUkLWjofmAEuMdnv0XUURjH1PhRFpFiyrmCQe4=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1704850497; v=1; b=lLPLJsZag9sGJvLx61/NyakfYYIX3m/A95hsBGMuShcO16zWwte88PYv2Gqp9NROyd6+kZz3 W5aYpHn3T+aJYd6Ri+ta27T2Zj9g2RFn7pWc5SwlLSaRUJ0LXcLqu1ee70XmAh5JCuxAAVB0GCa 660Uoz8fux2thJwNzMJtl9aM= X-Received: by 127.0.0.2 with SMTP id 5evNYY7687511xxN7NFPpcAz; Tue, 09 Jan 2024 17:34:57 -0800 X-Received: from NAM04-BN8-obe.outbound.protection.outlook.com (NAM04-BN8-obe.outbound.protection.outlook.com [40.107.100.53]) by mx.groups.io with SMTP id smtpd.web11.2267.1704850496704305312 for ; Tue, 09 Jan 2024 17:34:57 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fN2MuD6xgHSXm9mq8jP88KDtdwsRgHhBOTZkDOVv6nQQsSvSyoRtGy54/1Q5no+tDEI0RRgQA1KMGNyTpAdxXBJ5p0uAjRS4iBXXAI2/+M4lJ7dc2RPNBID8iW4o8r9v4Qau95xpcUF5ZSKJlRyeaHtXFXnbfGfYVaR/PEiEpeK2VZdrA5jU+gOcfvLLqKpkHSZjxXGiyvL/NLIGxx7Ot4218KAXUyDpN2A88lUnZ/10qAv2SU38prXuMMLw7AvPC+gv42QSJR3v2RNBtjsj8tKewh5af5NaJnq2hDi23eWT3rlj3VD+CPyjA0VYOdVO4GQNG+lxII9lycuR8MvfcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LaNXFGUjjqzQRYpmIx3fAJyOQuhztNdUlpMb6OMhe60=; b=EpIyH7yNiVcbchGf0YiQRYKaxA3Wzy7VwGKEFnvtfEGnc2KmhWiGU0rnQAt+eptCpuzf19dF/uxnKJkppBw86TiEzAi8fPHNhOFf2NxvunPOC6jOhP2akNPpySw66958IDFrNqqEsxJAZ+r6vIGR/qxaFHY8g3KUPqWdoh+bcTCrRFZGRGeuPMXmVy7lOp9JHYXLc465cEcMVYYQz2+P8m2lmntIFIBPUjxcIl5Es5e6C+mUZtA7MYMTYBjnRyPRm1yqwoJScmnYvRaLdOBO1TqF+AoCrD+PK4VDxfh0Uu7zcTvCQR1mgghYrEhwo/H9EuH92N4abBSqYRb7sYJrBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) by MW4PR12MB6826.namprd12.prod.outlook.com (2603:10b6:303:20c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Wed, 10 Jan 2024 01:34:53 +0000 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6]) by LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6%7]) with mapi id 15.20.7159.020; Wed, 10 Jan 2024 01:34:53 +0000 From: "Chang, Abner via groups.io" To: "devel@edk2.groups.io" , "saloni.kasbekar@intel.com" CC: "Clark-williams, Zachary" , Michael Brown , Nickle Wang , Igor Kulchytskyy Subject: Re: [edk2-devel] [PATCH V2 1/6] NetworkPkg/HttpDxe: Refactor TlsCreateChild Thread-Topic: [edk2-devel] [PATCH V2 1/6] NetworkPkg/HttpDxe: Refactor TlsCreateChild Thread-Index: AQHaQ1MpGbdYP6jQ+E6H1wYRcr4mirDSQ6hQ Date: Wed, 10 Jan 2024 01:34:53 +0000 Message-ID: References: <20240107132701.302-1-abner.chang@amd.com> <20240107132701.302-2-abner.chang@amd.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=144e7ea6-de84-4451-b406-6a4138a7a9ee;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2024-01-10T01:34:29Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|MW4PR12MB6826:EE_ x-ms-office365-filtering-correlation-id: 3fb2b475-0b06-4692-01cb-08dc117c583d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: R8Xe6+waURCiO4n+pXTRwZhwhaORrb1B7hcgBMja/xdTVrXdUF32EofTjI/CR8KpAp7C8X6JiI5wT9IS2kOYyKsWW5RFm+yo5JoAr28hn7U0MBoZOBeM31uUD5ocspzXjPU4346co7KqKWbTGpjraBIXyQW4Pk5yTFM0peWua2d5EbR+qWpMzapdH9rUumCbnwE2AoTf45UcE9pI1mU4Qymg6VYZ2OUpR3ahuq9g2IUdvIkrqi3wjmieCRJ5SVdtbaI2gwkPaxUOc2C8++aq6X7chVVh6R7CevgfiPRwvX4dNeZqQfX3vvFuMk4k+gHfTbmOEEaZVZyKunLYdurgUgDh8CaCaUZ3549ipbzhnokTq6reLZo+21Hhspbn17O6jj7ZSOxgkXSx6ElqM3Zk/lcplvZcRev0gzE0J1nZNj1kGUhtvWHbwzTIABaDNeZJw4xBevGIeGG4Q1WB0dB25bpEvUjI0dlCHgL45PXn4nUXsGYf0IHNDVp519P8L+CANa76E6NwN8laCTZaT6U1kzZ2towmtFUkmYbA5d2uhu18bKdDdTk7/0THpo3jEV7Xd9rRgoaj9tIcvMTfKIgb/d2trgao2sQUZwEyDFnDC4pMJsVgeFFI0J6c05MF0TwPxksJqg09qqjUhWuVTDhQfw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TxT4H3MLsrJJ3p16EOh8JWidH5r+dU+QLYRZDeHGurGbI+SIXVJvXH2g26Gj?= =?us-ascii?Q?IwwTQetqlvMqCr/y5wQtSY5uazeNnRmJ5B34OU8YY5a1J+sZl/ZnaO8auYz1?= =?us-ascii?Q?3BwDvYTgbnJQ8TYKOAYyq5CPQ2WjQqhRtMNvqTn8zJpU9dz72AQF5iWuXyOY?= =?us-ascii?Q?xMZjMBzqgUPz4/qST2fs9UlUF9B7Oqj3S7BWbG4b9SWRUaRih4dZxNtAwh2L?= =?us-ascii?Q?Iu0FFu5gP5lD+ILKPlezMo6/hQXssvDyoyKY6c8m25YnFowEBck9qbJ0gmpw?= =?us-ascii?Q?sHrVzjguDNH5neeBhlKRnH4hgO3b7uc12/UerNQRj7QnHCsjI5W4J1quInad?= =?us-ascii?Q?RLPy8FYOGl9PH57Ec/jI6imbpArZEu6iM6UNOPjigTgwJEGedmV85l+2rhvs?= =?us-ascii?Q?h9kQgXtcx8Xoqj9QDe6AN3tEuokx3q9/6R+fLjlWV7R5dXumhjVp9FpYtena?= =?us-ascii?Q?4fOEyLxfgfp+GXwGoCgSfB5dGFwh8d2Krrc7OWUV55cBH6x3Udyhoxx7aKE7?= =?us-ascii?Q?hzkPD19zcs3VhZzCSSL36Q1JyKJe/bPFTlaoyjf1R9Aqwe9JYKuem5fAQvpz?= =?us-ascii?Q?zegOjn0lDwBLVOHuDi4fL8S0cJVQlAAYLXlD3BaJw7LEOOrE/7JwbvmVTLA2?= =?us-ascii?Q?H85bQarKE3TPMooi/nv+7ArI1aQ1f5lSotN4XasCni/ohB+VOmc25eRhHIc2?= =?us-ascii?Q?HkqcO7KAVA9CEccq9nRTua6ucwp2rYsfeqqbDnNBWbcPCSLrSE0KeasFbtn+?= =?us-ascii?Q?VYfCKjuS265TV3GeGLTo+xDSnhEiROB0EpxMNRzfCVh64jFqs6sl6QjYi8r9?= =?us-ascii?Q?0rqMD1TVgxiQS6dTOUl/d4CyWRiRZPydG744+Tkp9b15Wf4oXJ6FnzzGkIcy?= =?us-ascii?Q?qPjD5MWA5ApCcrWRAqBPBwK6xtqeM+ZNT0H99FFcEuB4gmjLi1AaxBOnhTGA?= =?us-ascii?Q?6bii4mCTrOgs5w8G6DANNTN47WnrbLZlctaWZ1ipzGW0GQb6oTXZGUS6LSBu?= =?us-ascii?Q?UWHMvV/AzsU079m2YVUgRLKsWGFG+yHCbXDItfLoZn0oYOAmtPZilyGBv7kd?= =?us-ascii?Q?aFTagLNjB1eB1kkTtQ6kHuf3DZMoG4BVWfFU/KwrCicmb1V5vJVoppZWGFP/?= =?us-ascii?Q?pUHAD14ZOc8fdt1z12goJ8ktwUPy4fVDlSEBvtmHTGH2KTtAcRQf/vVpximY?= =?us-ascii?Q?ZS6OW930Qox9kOZzjvJwNWDGU8slxr1hrtyCU42Vy7iy54U0YsrjKhloByRK?= =?us-ascii?Q?TkRYPhAR6reoS1aH0JCYeAZYaGCSOz3TD8Coeias+QWLNCwu6gN2/M5Xdnj1?= =?us-ascii?Q?m1GpJ6Xou1CWJid5fcMPfkqCZI4BWf6YHOjfbdnkdpjTzepeRq6bfmkLekWe?= =?us-ascii?Q?yJZlivfX1NvqfkQZQcRW3TIdZEW8OCkSlYJmAe6D2fMs2/r9R8yiM8VLEdsH?= =?us-ascii?Q?mr78IP08/cVR/jZHt1Py5G4+DP77i0NKhtz/lAUZC9jIzAoPPIT/kq7IfGYr?= =?us-ascii?Q?Pi5mKAiQzn+EAUQixiu6G9hDEnQ6dgBbks7RxY411fc3Az5DdxPfx5tHv2am?= =?us-ascii?Q?FjWHecaVvTY5PeDWWh0=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9452.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3fb2b475-0b06-4692-01cb-08dc117c583d X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2024 01:34:53.3397 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yR7zt+O4t6fsDhvb7V8PYsZ+hkQ1TsUKQthCo0nZFTS8ZKqQ6IhDHcDLWzAAk0/KJybeitDWaQJsAW90fxUXzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6826 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: PIoLuew6GDkcPfmeZQbhPLhjx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=lLPLJsZa; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - General] Thanks Saloni, I will create a PR and merge it. Abner > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Saloni > Kasbekar via groups.io > Sent: Wednesday, January 10, 2024 7:26 AM > To: devel@edk2.groups.io; Chang, Abner > Cc: Clark-williams, Zachary ; Michael > Brown ; Nickle Wang ; Igor > Kulchytskyy > Subject: Re: [edk2-devel] [PATCH V2 1/6] NetworkPkg/HttpDxe: Refactor > TlsCreateChild > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Reviewed-by: Saloni Kasbekar > > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Chang, > Abner via groups.io > Sent: Sunday, January 7, 2024 5:27 AM > To: devel@edk2.groups.io > Cc: Kasbekar, Saloni ; Clark-williams, Zachary > ; Michael Brown ; > Nickle Wang ; Igor Kulchytskyy > Subject: [edk2-devel] [PATCH V2 1/6] NetworkPkg/HttpDxe: Refactor > TlsCreateChild > > From: Abner Chang > > - Use HTTP instance as the parameter for TlsCreateChild function. > - Install TLS protocol on the HTTP instance thats create TLS child. > > Signed-off-by: Abner Chang > Cc: Saloni Kasbekar > Cc: Zachary Clark-williams > Cc: Michael Brown > Cc: Nickle Wang > Cc: Igor Kulchytskyy > Reviewed-by: Michael Brown > --- > NetworkPkg/HttpDxe/HttpProto.h | 3 +- > NetworkPkg/HttpDxe/HttpsSupport.h | 18 ++++--- > NetworkPkg/HttpDxe/HttpImpl.c | 23 ++------- > NetworkPkg/HttpDxe/HttpProto.c | 7 +-- > NetworkPkg/HttpDxe/HttpsSupport.c | 78 ++++++++++++++++++------------ > - > 5 files changed, 64 insertions(+), 65 deletions(-) > > diff --git a/NetworkPkg/HttpDxe/HttpProto.h > b/NetworkPkg/HttpDxe/HttpProto.h index 012f1f4b467..7e77b389a78 > 100644 > --- a/NetworkPkg/HttpDxe/HttpProto.h > +++ b/NetworkPkg/HttpDxe/HttpProto.h > @@ -3,6 +3,7 @@ > > Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> +Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > +reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -171,7 +172,7 @@ typedef struct _HTTP_PROTOCOL { > BOOLEAN UseHttps; > > EFI_SERVICE_BINDING_PROTOCOL *TlsSb; > - EFI_HANDLE TlsChildHandle; /// Tls ChildHandle > + BOOLEAN TlsAlreadyCreated; > TLS_CONFIG_DATA TlsConfigData; > EFI_TLS_PROTOCOL *Tls; > EFI_TLS_CONFIGURATION_PROTOCOL *TlsConfiguration; > diff --git a/NetworkPkg/HttpDxe/HttpsSupport.h > b/NetworkPkg/HttpDxe/HttpsSupport.h > index 3c70825e8c3..5b44c7ac395 100644 > --- a/NetworkPkg/HttpDxe/HttpsSupport.h > +++ b/NetworkPkg/HttpDxe/HttpsSupport.h > @@ -2,6 +2,7 @@ > The header files of miscellaneous routines specific to Https for HttpD= xe > driver. > > Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
> +Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > +reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -30,21 +31,18 @@ IsHttpsUrl ( > /** > Creates a Tls child handle, open EFI_TLS_PROTOCOL and > EFI_TLS_CONFIGURATION_PROTOCOL. > > - @param[in] ImageHandle The firmware allocated handle for th= e UEFI > image. > - @param[out] TlsSb Pointer to the TLS > SERVICE_BINDING_PROTOCOL. > - @param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL inst= ance. > - @param[out] TlsConfiguration Pointer to the > EFI_TLS_CONFIGURATION_PROTOCOL instance. > + @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure. > > - @return The child handle with opened EFI_TLS_PROTOCOL and > EFI_TLS_CONFIGURATION_PROTOCOL. > + @return EFI_SUCCESS TLS child handle is returned in HttpInstan= ce- > >TlsChildHandle > + with opened EFI_TLS_PROTOCOL and > EFI_TLS_CONFIGURATION_PROTOCOL. > + EFI_DEVICE_ERROR TLS service binding protocol is not found. > + Otherwise Fail to create TLS chile handle. > > **/ > -EFI_HANDLE > +EFI_STATUS > EFIAPI > TlsCreateChild ( > - IN EFI_HANDLE ImageHandle, > - OUT EFI_SERVICE_BINDING_PROTOCOL **TlsSb, > - OUT EFI_TLS_PROTOCOL **TlsProto, > - OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration > + IN HTTP_PROTOCOL *HttpInstance > ); > > /** > diff --git a/NetworkPkg/HttpDxe/HttpImpl.c > b/NetworkPkg/HttpDxe/HttpImpl.c index 7c5c925cf78..6606c293421 > 100644 > --- a/NetworkPkg/HttpDxe/HttpImpl.c > +++ b/NetworkPkg/HttpDxe/HttpImpl.c > @@ -3,6 +3,7 @@ > > Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
> (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
> + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -248,7 +249,6 @@ EfiHttpRequest ( > HTTP_TOKEN_WRAP *Wrap; > CHAR8 *FileUrl; > UINTN RequestMsgSize; > - EFI_HANDLE ImageHandle; > > // > // Initializations > @@ -371,23 +371,10 @@ EfiHttpRequest ( > // > // Check whether we need to create Tls child and open the TLS protoc= ol. > // > - if (HttpInstance->UseHttps && (HttpInstance->TlsChildHandle =3D=3D N= ULL)) { > - // > - // Use TlsSb to create Tls child and open the TLS protocol. > - // > - if (HttpInstance->LocalAddressIsIPv6) { > - ImageHandle =3D HttpInstance->Service->Ip6DriverBindingHandle; > - } else { > - ImageHandle =3D HttpInstance->Service->Ip4DriverBindingHandle; > - } > - > - HttpInstance->TlsChildHandle =3D TlsCreateChild ( > - ImageHandle, > - &(HttpInstance->TlsSb), > - &(HttpInstance->Tls), > - &(HttpInstance->TlsConfiguration) > - ); > - if (HttpInstance->TlsChildHandle =3D=3D NULL) { > + if (HttpInstance->UseHttps && !HttpInstance->TlsAlreadyCreated) { > + // Create TLS child for this HTTP instance. > + Status =3D TlsCreateChild (HttpInstance); > + if (EFI_ERROR (Status)) { > return EFI_DEVICE_ERROR; > } > > diff --git a/NetworkPkg/HttpDxe/HttpProto.c > b/NetworkPkg/HttpDxe/HttpProto.c index 7dfb82dd2e5..94900328ba9 > 100644 > --- a/NetworkPkg/HttpDxe/HttpProto.c > +++ b/NetworkPkg/HttpDxe/HttpProto.c > @@ -3,6 +3,7 @@ > > Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> +Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > +reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -852,12 +853,12 @@ HttpCleanProtocol ( > NetMapClean (&HttpInstance->TxTokens); > NetMapClean (&HttpInstance->RxTokens); > > - if ((HttpInstance->TlsSb !=3D NULL) && (HttpInstance->TlsChildHandle != =3D > NULL)) { > + if ((HttpInstance->TlsSb !=3D NULL) && HttpInstance->TlsAlreadyCreated= ) > + { > // > // Destroy the TLS instance. > // > - HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance= - > >TlsChildHandle); > - HttpInstance->TlsChildHandle =3D NULL; > + HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance= - > >Handle); > + HttpInstance->TlsAlreadyCreated =3D FALSE; > } > > if (HttpInstance->Tcp4ChildHandle !=3D NULL) { diff --git > a/NetworkPkg/HttpDxe/HttpsSupport.c > b/NetworkPkg/HttpDxe/HttpsSupport.c > index 7330be42c00..a07323ff0bd 100644 > --- a/NetworkPkg/HttpDxe/HttpsSupport.c > +++ b/NetworkPkg/HttpDxe/HttpsSupport.c > @@ -3,6 +3,7 @@ > > Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> +Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > +reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -134,27 +135,31 @@ IsHttpsUrl ( > /** > Creates a Tls child handle, open EFI_TLS_PROTOCOL and > EFI_TLS_CONFIGURATION_PROTOCOL. > > - @param[in] ImageHandle The firmware allocated handle for th= e UEFI > image. > - @param[out] TlsSb Pointer to the TLS > SERVICE_BINDING_PROTOCOL. > - @param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL inst= ance. > - @param[out] TlsConfiguration Pointer to the > EFI_TLS_CONFIGURATION_PROTOCOL instance. > + @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure. > > - @return The child handle with opened EFI_TLS_PROTOCOL and > EFI_TLS_CONFIGURATION_PROTOCOL. > + @return EFI_SUCCESS TLS child handle is returned in HttpInstan= ce- > >TlsChildHandle > + with opened EFI_TLS_PROTOCOL and > EFI_TLS_CONFIGURATION_PROTOCOL. > + EFI_DEVICE_ERROR TLS service binding protocol is not found. > + Otherwise Fail to create TLS chile handle. > > **/ > -EFI_HANDLE > +EFI_STATUS > EFIAPI > TlsCreateChild ( > - IN EFI_HANDLE ImageHandle, > - OUT EFI_SERVICE_BINDING_PROTOCOL **TlsSb, > - OUT EFI_TLS_PROTOCOL **TlsProto, > - OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration > + IN HTTP_PROTOCOL *HttpInstance > ) > { > + EFI_HANDLE ImageHandle; > EFI_STATUS Status; > - EFI_HANDLE TlsChildHandle; > > - TlsChildHandle =3D 0; > + // > + // Use TlsSb to create Tls child and open the TLS protocol. > + // > + if (HttpInstance->LocalAddressIsIPv6) { > + ImageHandle =3D HttpInstance->Service->Ip6DriverBindingHandle; > + } else { > + ImageHandle =3D HttpInstance->Service->Ip4DriverBindingHandle; > + } > > // > // Locate TlsServiceBinding protocol. > @@ -162,44 +167,51 @@ TlsCreateChild ( > gBS->LocateProtocol ( > &gEfiTlsServiceBindingProtocolGuid, > NULL, > - (VOID **)TlsSb > + (VOID **)&HttpInstance->TlsSb > ); > - if (*TlsSb =3D=3D NULL) { > - return NULL; > + if (HttpInstance->TlsSb =3D=3D NULL) { > + return EFI_DEVICE_ERROR; > } > > - Status =3D (*TlsSb)->CreateChild (*TlsSb, &TlsChildHandle); > + // > + // Create TLS protocol on HTTP handle, this creates the association > + between HTTP and TLS // for HTTP driver external usages. > + // > + Status =3D HttpInstance->TlsSb->CreateChild (HttpInstance->TlsSb, > + &HttpInstance->Handle); > if (EFI_ERROR (Status)) { > - return NULL; > + return Status; > } > > - Status =3D gBS->OpenProtocol ( > - TlsChildHandle, > - &gEfiTlsProtocolGuid, > - (VOID **)TlsProto, > - ImageHandle, > - TlsChildHandle, > - EFI_OPEN_PROTOCOL_GET_PROTOCOL > - ); > + HttpInstance->TlsAlreadyCreated =3D TRUE; > + Status =3D gBS->OpenProtocol ( > + HttpInstance->Handle, > + &gEfiTlsProtocolGuid, > + (VOID **)&HttpInstance->Tls, > + ImageHandle, > + HttpInstance->Handle, > + EFI_OPEN_PROTOCOL_GET_PROTOCO= L > + ); > if (EFI_ERROR (Status)) { > - (*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle); > - return NULL; > + HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance= - > >Handle); > + HttpInstance->TlsAlreadyCreated =3D FALSE; > + return Status; > } > > Status =3D gBS->OpenProtocol ( > - TlsChildHandle, > + HttpInstance->Handle, > &gEfiTlsConfigurationProtocolGuid, > - (VOID **)TlsConfiguration, > + (VOID **)&HttpInstance->TlsConfiguration, > ImageHandle, > - TlsChildHandle, > + HttpInstance->Handle, > EFI_OPEN_PROTOCOL_GET_PROTOCOL > ); > if (EFI_ERROR (Status)) { > - (*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle); > - return NULL; > + HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance= - > >Handle); > + HttpInstance->TlsAlreadyCreated =3D FALSE; > + return Status; > } > > - return TlsChildHandle; > + return EFI_SUCCESS; > } > > /** > -- > 2.37.1.windows.1 > > > > > > > > >=20 > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113507): https://edk2.groups.io/g/devel/message/113507 Mute This Topic: https://groups.io/mt/103577242/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-