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 39F02740032 for ; Tue, 9 Jan 2024 23:25:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=d9mKZE041oF+qCPx1gRDlBSF0IYuFddZg4puqL7ugT0=; 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: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=1704842748; v=1; b=ivdqSYNJqsOP/MQ4nAgd1tMrTor0KopWXvp7R16ljjGCuQSdOB3Eo+bWh9c0UcMYW/G7BL/+ S2m4EPXPHtFwl3MabUPteuSM/izir03iUsxATwdmUwOYKnbI6Z6YeAl8wvl7JkLdFWo+SoHl0+8 ihObMXM3yhJxpLg/Igyw5HLA= X-Received: by 127.0.0.2 with SMTP id ReGlYY7687511x86YEsVUCkQ; Tue, 09 Jan 2024 15:25:48 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.32515.1704842747701254420 for ; Tue, 09 Jan 2024 15:25:47 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="484536459" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="484536459" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2024 15:25:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="23731682" X-Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 09 Jan 2024 15:25:47 -0800 X-Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 9 Jan 2024 15:25:46 -0800 X-Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 9 Jan 2024 15:25:46 -0800 X-Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 9 Jan 2024 15:25:46 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 9 Jan 2024 15:25:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=miQHpg52UUwOihLh8fn6wswxPi0Evkz/HNKbmLvQs1LaIPCke9ofks2HGH3egWJ56wdMf68FOphgMUqy4CBL5iJ6vKoveFNu/djQJLqZJ1smY9T0Om0z5UByp4lPgH+mO1bUI+5elgzPiWY2UQySv9K6P6BEIG+Rll1wt3av7FQNvT++ecvi/TnfrYKM+j8oLqbcxqOs2BKQ4ZCycQynXDP/cvnqh3QMdavtQt3jND5cQTYWUhRdoSYvDI1OqnpKJMi1rOt3ZGCZBJGnoa2IfxKua+m/XEaM/YlJQg4jxMqp/G9NiJ7D9rsVrPMmy2r3GsAYLc3amqKu4ABIiJs9ZQ== 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=IYBr2eSEiTtEb9m5JmZWU47SFJ1FCivoqYjhdl0NuF4=; b=mczxmjzr0YKh4PWZJ8MXx1ofOrNX83Tpt1bApEFaScN0VtEPvxIkPihURO89URlVD7kZ93se3guxfGI+l//+Jfp89v/PBdodPdglHgP3a8JRCoOYYv4ExGVw8ZZAJw40aF4GetvCbFlPDKZziXJcyOD3xeYooS5+tw+HL6azFNtf+XvWiU86JvsDmTqGaWzKeeSkJ6v0gVNCBErvVUIA/yZ4d3QOuwktdIZ/qMDm/440eGqLA0WFsN70rFS9ev6IXIsufiU/jVlT7tgjR4k7s3R4YWQmmJgdq+pW7yBEmK1A2c9WEIjygbtobvEcSu8SKD+477vuBlyyuXYxOru34w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from SN7PR11MB8281.namprd11.prod.outlook.com (2603:10b6:806:26b::20) by PH8PR11MB6904.namprd11.prod.outlook.com (2603:10b6:510:227::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 23:25:43 +0000 X-Received: from SN7PR11MB8281.namprd11.prod.outlook.com ([fe80::d2a9:6c81:214f:f89]) by SN7PR11MB8281.namprd11.prod.outlook.com ([fe80::d2a9:6c81:214f:f89%7]) with mapi id 15.20.7159.020; Tue, 9 Jan 2024 23:25:43 +0000 From: "Saloni Kasbekar" To: "devel@edk2.groups.io" , "abner.chang@amd.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: AQHaQW1MZTRIwHVDXEOgVuWLnhsParDSI3DQ Date: Tue, 9 Jan 2024 23:25:42 +0000 Message-ID: References: <20240107132701.302-1-abner.chang@amd.com> <20240107132701.302-2-abner.chang@amd.com> In-Reply-To: <20240107132701.302-2-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN7PR11MB8281:EE_|PH8PR11MB6904:EE_ x-ms-office365-filtering-correlation-id: 50a0231b-7483-4f36-8c91-08dc116a4caa x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 60kYdux0Z7r/TuQlqk90bJ+ohUB0fdbMPYWkpdx9VMIAG1JX30morpQ8Xz8b507uVYuaTbJXmp3iYGS1y5gqSlq2Q7PPh1+k4AaQe9Iqhp2cCc4gQrD1yl7picqJ7DSjMr8F8Q6yPQ9KYAsMelsAmLmxky/I8DjA2cW6v+otYyF04uMpdXcBFYLTh8gv3RVuO1UncD/57QYOWTtdye1XCod2WyYzZ0250Pxh1avxxAFe6GEuFwImouMNMidzfKf7Trrh+6Or9Hn3XXEE2UVz7ADRI67EJlFYvGkE5+CJjS268gm8rg8HyM8sBt8YLygcFU4qL/0z7tQry97opgEvLZCA11otie57yMSmfXU/XbfijjGWQp211JaYybPU2DRXVV8Pek7twq6iq9vTkL+t7PwSNIhuY1tPYuF7n8B9oauCBlgBk5lkEeQii39CE4DICkrZpS2P0ZzV5aaEUFnIv+iRPjYd4XwlCjCYBLBA/MXicuglB1tmFhoYldpexLJsfURWLFXLOIXd5dmQsyikN+pAWZJqJJTnTUyvYj/aP71mTWvbjRB/0QWPUs9l/fs5QQywZ2uDCZalzNb559hkcjcts+XDdL2qRCWcw2TrmBi44mNRfbd8EISG9gEbGS4+fRFkyV1eFYL0BnG/nsFAcQ== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?c0jQkGcAw5e3etwJVR1Kco/geGMWClv0Kl/QIdPKAHnAici/NW7gS9B5jPAE?= =?us-ascii?Q?hJ0XpTeHw81Ea116rWIGcKk1WBaiUUUPfz6hAMYexF3zDcCrsY413SWExAey?= =?us-ascii?Q?VJrxKeQvqCylHQGVoDuCMUhPFPvbJSnSu1GzJVtCshXaG+M4oojRwOKA8N3q?= =?us-ascii?Q?pJJHcwbTIy+VeHq6ItOCZRd2FFgAFWbI81DM3ASXGG3PU/H+/VibAmobb9dk?= =?us-ascii?Q?jVD1jHZQ4MU42TwzDzra+SwvnLb/ijmGHHT84NP1V922HpEKdHs4ZsJv9fx7?= =?us-ascii?Q?aiWXa+0FIghgPXVRNImoFj2XlCrP3rSBYroscBs8oZYy7wlMYZDU+zgKTV5V?= =?us-ascii?Q?vUMMtOh5ynOoax5knxSQP2mFVcys+NwUrfz7EmAPrSyiJDnxVYdIkbxdFiRv?= =?us-ascii?Q?uF3e63OhHJ8yqHpXkYvSKBfDLDBNNf6gui0axeFuGaixxY2zRJDGlA/AYxW3?= =?us-ascii?Q?rQaMneSNf4kxkLs1EP6fapvgyYFmSwEBhxlvxzTsUcuMtymGvGNUVM9RRVNe?= =?us-ascii?Q?hQhNMkBkOs4xL9Iq/chC3QD2xleZllAJXD44rr3t3SapoviYIQAzziYhD7yn?= =?us-ascii?Q?jQicTrNMZtmyDH4x6NSPY2R74v2KEfZKDNMiziYQFulJizCzP38zebKMdsji?= =?us-ascii?Q?/3hpS75BItghbK8VvBzHRmt7P3J1ZEaibV7twI945sMa/oVtC6o+sif9CGjQ?= =?us-ascii?Q?yBoKXi0dsCGzcy1N5ETRlCCppvObrlzdjV1ZXwpY6vh2Ehf3hKgLC+MPma/k?= =?us-ascii?Q?AtudnGJrwyKJdq7usVZafc6Gvd2eWsAjevKXU2V/mCOedqw++2m0plf2WC5R?= =?us-ascii?Q?s84ynEnTUkgun1a0exuwYB6M8Q5ApeV9i85AwdI2eRnBs2nTzaQjRc1f4Py/?= =?us-ascii?Q?+L6Taj+9uPuN6WMx35GE/3MKpe6T30BSPqy4tv+y6KDwwKhY0gq6EKEMCHW9?= =?us-ascii?Q?tiX4jq9PKrnxp8rPfTvhBqYFHuqUvcP+Rxm4fOvTqMQYYuizJyjAthJGTP9i?= =?us-ascii?Q?Va2fHbzm7vvdqs6/ZasGax4I3U15z0upFzoZ6sXPYSPMaPRhTeXnHaIwAWB6?= =?us-ascii?Q?xg14etC4MRFSXw2adAvjwZoxMXcu5FDZgUAcdFnX9/w0EUW1W2AIUqzMuFU3?= =?us-ascii?Q?6GBXd/wPeeIAw9eplV7AwUTa/qZ5wwWCrm0kb60sA0TboUc5BsOT/bFGKnkp?= =?us-ascii?Q?6SwzGN2zljJOvSUpJxe7p/3G9Fo//f6NGQP9I9oluGwnn8H72wdrX5XRfYYx?= =?us-ascii?Q?mWuk8SQiANQoEY5rEdKIXw5Mc+XtTyBSIhS+HjRizV1WGQWWqBrSHHAoH1QS?= =?us-ascii?Q?pUsWE0lc1qud0FsQK4SWPGxBhVjWMqGMpsI6pgEhR5xXsqeHsprH9ssyYeVh?= =?us-ascii?Q?HcERNewXBZPXvIkArG2ECbIOODTHEfTiW7yUkh/QvnJjuwoOxE6bJeWg66Lf?= =?us-ascii?Q?eAHnfenCaCI+1KWbtBUjXgcY+VgN9ovoFjWFl5Ewbq38IqIF1xc1vmeJfcrv?= =?us-ascii?Q?od50I+Yyd/uHNH3x6cvhCALluU/HV3hrey6sDj6QDiYBfCFexCUdYB9dl4wi?= =?us-ascii?Q?lAIx6fCeMf1pMllN5wqLjFZuSQif/lhkFPlrSRvo?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN7PR11MB8281.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50a0231b-7483-4f36-8c91-08dc116a4caa X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2024 23:25:42.9989 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: a1ytfxy2R5NLZO2RYQ8uRNK1fzl0rQmn6s8BtT8RooJsvD0i29CFD4LAKdHWsdX9DF1X7DgjOJDU5WdZpP6QDcoZJxMBiIjwSPliyaGdLBE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB6904 X-OriginatorOrg: intel.com 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,saloni.kasbekar@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: lXbDPlke5xcL7Sgowd3YhIJTx7686176AA= 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=ivdqSYNJ; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=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; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") 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 <= zachary.clark-williams@intel.com>; Michael Brown ; Nickle W= ang ; Igor Kulchytskyy Subject: [edk2-devel] [PATCH V2 1/6] NetworkPkg/HttpDxe: Refactor TlsCreate= Child 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 @@ =20 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=20 +reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -171,7 +172,7 @@ typedef struct _HTTP_PROTOCOL { BOOLEAN UseHttps; =20 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/HttpsSu= pport.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 HttpDxe= driver. =20 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+Copyright (C) 2024 Advanced Micro Devices, Inc. All rights=20 +reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -30,21 +31,18 @@ IsHttpsUrl ( /** Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURAT= ION_PROTOCOL. =20 - @param[in] ImageHandle The firmware allocated handle for the = UEFI image. - @param[out] TlsSb Pointer to the TLS SERVICE_BINDING_PRO= TOCOL. - @param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instan= ce. - @param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_P= ROTOCOL instance. + @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure. =20 - @return The child handle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFI= GURATION_PROTOCOL. + @return EFI_SUCCESS TLS child handle is returned in HttpInstance= ->TlsChildHandle + with opened EFI_TLS_PROTOCOL and EFI_TLS_CON= FIGURATION_PROTOCOL. + EFI_DEVICE_ERROR TLS service binding protocol is not found. + Otherwise Fail to create TLS chile handle. =20 **/ -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 ); =20 /** 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 @@ =20 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=20 + reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -248,7 +249,6 @@ EfiHttpRequest ( HTTP_TOKEN_WRAP *Wrap; CHAR8 *FileUrl; UINTN RequestMsgSize; - EFI_HANDLE ImageHandle; =20 // // Initializations @@ -371,23 +371,10 @@ EfiHttpRequest ( // // Check whether we need to create Tls child and open the TLS protocol= . // - if (HttpInstance->UseHttps && (HttpInstance->TlsChildHandle =3D=3D NUL= L)) { - // - // 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; } =20 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 @@ =20 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=20 +reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -852,12 +853,12 @@ HttpCleanProtocol ( NetMapClean (&HttpInstance->TxTokens); NetMapClean (&HttpInstance->RxTokens); =20 - if ((HttpInstance->TlsSb !=3D NULL) && (HttpInstance->TlsChildHandle != =3D NULL)) { + if ((HttpInstance->TlsSb !=3D NULL) && HttpInstance->TlsAlreadyCreated)= =20 + { // // 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; } =20 if (HttpInstance->Tcp4ChildHandle !=3D NULL) { diff --git a/NetworkPkg/H= ttpDxe/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 @@ =20 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=20 +reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -134,27 +135,31 @@ IsHttpsUrl ( /** Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURAT= ION_PROTOCOL. =20 - @param[in] ImageHandle The firmware allocated handle for the = UEFI image. - @param[out] TlsSb Pointer to the TLS SERVICE_BINDING_PRO= TOCOL. - @param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instan= ce. - @param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_P= ROTOCOL instance. + @param[in] HttpInstance Pointer to HTTP_PROTOCOL structure. =20 - @return The child handle with opened EFI_TLS_PROTOCOL and EFI_TLS_CONFI= GURATION_PROTOCOL. + @return EFI_SUCCESS TLS child handle is returned in HttpInstance= ->TlsChildHandle + with opened EFI_TLS_PROTOCOL and EFI_TLS_CON= FIGURATION_PROTOCOL. + EFI_DEVICE_ERROR TLS service binding protocol is not found. + Otherwise Fail to create TLS chile handle. =20 **/ -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; =20 - 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; + } =20 // // 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; } =20 - Status =3D (*TlsSb)->CreateChild (*TlsSb, &TlsChildHandle); + // + // Create TLS protocol on HTTP handle, this creates the association=20 + between HTTP and TLS // for HTTP driver external usages. + // + Status =3D HttpInstance->TlsSb->CreateChild (HttpInstance->TlsSb,=20 + &HttpInstance->Handle); if (EFI_ERROR (Status)) { - return NULL; + return Status; } =20 - 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_PROTOCOL + ); if (EFI_ERROR (Status)) { - (*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle); - return NULL; + HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance->= Handle); + HttpInstance->TlsAlreadyCreated =3D FALSE; + return Status; } =20 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; } =20 - return TlsChildHandle; + return EFI_SUCCESS; } =20 /** -- 2.37.1.windows.1 -=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 (#113495): https://edk2.groups.io/g/devel/message/113495 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-