NetworkPkg/HttpDxe: Refactor TlsCreateChild

- 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 <abner.chang@amd.com>
Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>
Cc: Michael Brown <mcb30@ipxe.org>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Michael Brown <mcb30@ipxe.org>
Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
This commit is contained in:
Abner Chang
2023-12-30 14:42:05 +08:00
committed by mergify[bot]
parent edba0779ba
commit 0abd598e3f
5 changed files with 67 additions and 68 deletions

View File

@@ -3,6 +3,7 @@
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
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 protocol.
//
if (HttpInstance->UseHttps && (HttpInstance->TlsChildHandle == NULL)) {
//
// Use TlsSb to create Tls child and open the TLS protocol.
//
if (HttpInstance->LocalAddressIsIPv6) {
ImageHandle = HttpInstance->Service->Ip6DriverBindingHandle;
} else {
ImageHandle = HttpInstance->Service->Ip4DriverBindingHandle;
}
HttpInstance->TlsChildHandle = TlsCreateChild (
ImageHandle,
&(HttpInstance->TlsSb),
&(HttpInstance->Tls),
&(HttpInstance->TlsConfiguration)
);
if (HttpInstance->TlsChildHandle == NULL) {
if (HttpInstance->UseHttps && !HttpInstance->TlsAlreadyCreated) {
// Create TLS child for this HTTP instance.
Status = TlsCreateChild (HttpInstance);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}