summaryrefslogtreecommitdiffstats
path: root/NetworkPkg
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2017-07-31 13:36:37 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2017-08-02 15:31:54 +0800
commit45ea8a0c4550e1bb357d9e1d7fe653cd79cacaf5 (patch)
tree62c177d3953ad3069bc2519112a1d8e4b53a4d9c /NetworkPkg
parent6aac2db4a11432b11ba92a0d1652d6ec3d81f353 (diff)
downloadedk2-45ea8a0c4550e1bb357d9e1d7fe653cd79cacaf5.tar.gz
edk2-45ea8a0c4550e1bb357d9e1d7fe653cd79cacaf5.tar.bz2
edk2-45ea8a0c4550e1bb357d9e1d7fe653cd79cacaf5.zip
NetworkPkg/HttpDxe: Destroy the TLS instance when cleaning up the HTTP child
During clean up the HTTP child, all resources used by it should be cleaned. But currently, TLS instance is not destroyed. This patch is to fix this issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/HttpDxe/HttpImpl.c1
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.c7
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.h3
-rw-r--r--NetworkPkg/HttpDxe/HttpsSupport.c14
-rw-r--r--NetworkPkg/HttpDxe/HttpsSupport.h4
5 files changed, 20 insertions, 9 deletions
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index c9ad59b168..8a9e57345a 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -380,6 +380,7 @@ EfiHttpRequest (
HttpInstance->TlsChildHandle = TlsCreateChild (
ImageHandle,
+ &(HttpInstance->TlsSb),
&(HttpInstance->Tls),
&(HttpInstance->TlsConfiguration)
);
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index 3fda294be3..ab00f3d6f2 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -864,6 +864,13 @@ HttpCleanProtocol (
NetMapClean (&HttpInstance->TxTokens);
NetMapClean (&HttpInstance->RxTokens);
+ if (HttpInstance->TlsSb != NULL && HttpInstance->TlsChildHandle != NULL) {
+ //
+ // Destroy the TLS instance.
+ //
+ HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance->TlsChildHandle);
+ }
+
if (HttpInstance->Tcp4ChildHandle != NULL) {
gBS->CloseProtocol (
HttpInstance->Tcp4ChildHandle,
diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h
index 95fb4843ce..04d36aaca0 100644
--- a/NetworkPkg/HttpDxe/HttpProto.h
+++ b/NetworkPkg/HttpDxe/HttpProto.h
@@ -166,7 +166,8 @@ typedef struct _HTTP_PROTOCOL {
// Https Support
//
BOOLEAN UseHttps;
-
+
+ EFI_SERVICE_BINDING_PROTOCOL *TlsSb;
EFI_HANDLE TlsChildHandle; /// Tls ChildHandle
TLS_CONFIG_DATA TlsConfigData;
EFI_TLS_PROTOCOL *Tls;
diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c b/NetworkPkg/HttpDxe/HttpsSupport.c
index e4d9a37bee..e6f4d5a6cc 100644
--- a/NetworkPkg/HttpDxe/HttpsSupport.c
+++ b/NetworkPkg/HttpDxe/HttpsSupport.c
@@ -140,6 +140,7 @@ IsHttpsUrl (
Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
+ @param[out] TlsSb Pointer to the TLS SERVICE_BINDING_PROTOCOL.
@param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instance.
@param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
@@ -150,15 +151,14 @@ EFI_HANDLE
EFIAPI
TlsCreateChild (
IN EFI_HANDLE ImageHandle,
+ OUT EFI_SERVICE_BINDING_PROTOCOL **TlsSb,
OUT EFI_TLS_PROTOCOL **TlsProto,
OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration
)
{
EFI_STATUS Status;
- EFI_SERVICE_BINDING_PROTOCOL *TlsSb;
EFI_HANDLE TlsChildHandle;
- TlsSb = NULL;
TlsChildHandle = 0;
//
@@ -167,13 +167,13 @@ TlsCreateChild (
gBS->LocateProtocol (
&gEfiTlsServiceBindingProtocolGuid,
NULL,
- (VOID **) &TlsSb
+ (VOID **) TlsSb
);
- if (TlsSb == NULL) {
+ if (*TlsSb == NULL) {
return NULL;
}
- Status = TlsSb->CreateChild (TlsSb, &TlsChildHandle);
+ Status = (*TlsSb)->CreateChild (*TlsSb, &TlsChildHandle);
if (EFI_ERROR (Status)) {
return NULL;
}
@@ -187,7 +187,7 @@ TlsCreateChild (
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
- TlsSb->DestroyChild (TlsSb, TlsChildHandle);
+ (*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle);
return NULL;
}
@@ -200,7 +200,7 @@ TlsCreateChild (
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
- TlsSb->DestroyChild (TlsSb, TlsChildHandle);
+ (*TlsSb)->DestroyChild (*TlsSb, TlsChildHandle);
return NULL;
}
diff --git a/NetworkPkg/HttpDxe/HttpsSupport.h b/NetworkPkg/HttpDxe/HttpsSupport.h
index 68a6073ceb..f7a2d303e6 100644
--- a/NetworkPkg/HttpDxe/HttpsSupport.h
+++ b/NetworkPkg/HttpDxe/HttpsSupport.h
@@ -1,7 +1,7 @@
/** @file
The header files of miscellaneous routines specific to Https for HttpDxe driver.
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -37,6 +37,7 @@ IsHttpsUrl (
Creates a Tls child handle, open EFI_TLS_PROTOCOL and EFI_TLS_CONFIGURATION_PROTOCOL.
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
+ @param[out] TlsSb Pointer to the TLS SERVICE_BINDING_PROTOCOL.
@param[out] TlsProto Pointer to the EFI_TLS_PROTOCOL instance.
@param[out] TlsConfiguration Pointer to the EFI_TLS_CONFIGURATION_PROTOCOL instance.
@@ -47,6 +48,7 @@ EFI_HANDLE
EFIAPI
TlsCreateChild (
IN EFI_HANDLE ImageHandle,
+ OUT EFI_SERVICE_BINDING_PROTOCOL **TlsSb,
OUT EFI_TLS_PROTOCOL **TlsProto,
OUT EFI_TLS_CONFIGURATION_PROTOCOL **TlsConfiguration
);