2 Header file of the Driver Binding and Service Binding Protocol for TlsDxe driver.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __EFI_TLS_DRIVER_H__
11 #define __EFI_TLS_DRIVER_H__
18 #include <Protocol/ServiceBinding.h>
23 #define TLS_VERSION 0x00000000
25 #define TLS_SERVICE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'S')
27 #define TLS_INSTANCE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'I')
32 typedef struct _TLS_SERVICE TLS_SERVICE
;
37 typedef struct _TLS_INSTANCE TLS_INSTANCE
;
42 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
44 UINT16 TlsChildrenNum
;
45 LIST_ENTRY TlsChildrenList
;
48 // Handle to install TlsServiceBinding protocol.
51 EFI_HANDLE ImageHandle
;
54 // Main SSL Context object which is created by a server or client once per program
55 // life-time and which holds mainly default values for the SSL object which are later
56 // created for the connections.
61 struct _TLS_INSTANCE
{
68 EFI_HANDLE ChildHandle
;
71 EFI_TLS_CONFIGURATION_PROTOCOL TlsConfig
;
73 EFI_TLS_SESSION_STATE TlsSessionState
;
76 // Main SSL Connection which is created by a server or a client
77 // per established connection.
83 #define TLS_SERVICE_FROM_THIS(a) \
84 CR (a, TLS_SERVICE, ServiceBinding, TLS_SERVICE_SIGNATURE)
86 #define TLS_INSTANCE_FROM_PROTOCOL(a) \
87 CR (a, TLS_INSTANCE, Tls, TLS_INSTANCE_SIGNATURE)
89 #define TLS_INSTANCE_FROM_CONFIGURATION(a) \
90 CR (a, TLS_INSTANCE, TlsConfig, TLS_INSTANCE_SIGNATURE)
94 Release all the resources used by the TLS instance.
96 @param[in] Instance The TLS instance data.
101 IN TLS_INSTANCE
*Instance
105 Create the TLS instance and initialize it.
107 @param[in] Service The pointer to the TLS service.
108 @param[out] Instance The pointer to the TLS instance.
110 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
111 @retval EFI_SUCCESS The TLS instance is created.
116 IN TLS_SERVICE
*Service
,
117 OUT TLS_INSTANCE
**Instance
121 Release all the resources used by the TLS service binding instance.
123 @param[in] Service The TLS service data.
128 IN TLS_SERVICE
*Service
132 Create then initialize a TLS service.
134 @param[in] Image ImageHandle of the TLS driver
135 @param[out] Service The service for TLS driver
137 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to create the service.
138 @retval EFI_SUCCESS The service is created for the driver.
144 OUT TLS_SERVICE
**Service
150 @param[in] ImageHandle Handle that identifies the image to be unloaded.
152 @retval EFI_SUCCESS The image has been unloaded.
153 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
159 IN EFI_HANDLE ImageHandle
163 This is the declaration of an EFI image entry point. This entry point is
164 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
165 both device drivers and bus drivers.
167 @param ImageHandle The firmware allocated handle for the UEFI image.
168 @param SystemTable A pointer to the EFI System Table.
170 @retval EFI_SUCCESS The operation completed successfully.
171 @retval Others An unexpected error occurred.
175 TlsDriverEntryPoint (
176 IN EFI_HANDLE ImageHandle
,
177 IN EFI_SYSTEM_TABLE
*SystemTable
181 Creates a child handle and installs a protocol.
183 The CreateChild() function installs a protocol on ChildHandle.
184 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
185 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
187 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
188 @param[in] ChildHandle Pointer to the handle of the child to create. If it is NULL,
189 then a new handle is created. If it is a pointer to an existing UEFI handle,
190 then the protocol is added to the existing UEFI handle.
192 @retval EFI_SUCCESS The protocol was added to ChildHandle.
193 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
194 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
196 @retval other The child handle was not created.
201 TlsServiceBindingCreateChild (
202 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
203 IN EFI_HANDLE
*ChildHandle
207 Destroys a child handle with a protocol installed on it.
209 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
210 that was installed by CreateChild() from ChildHandle. If the removed protocol is the
211 last protocol on ChildHandle, then ChildHandle is destroyed.
213 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
214 @param ChildHandle Handle of the child to destroy.
216 @retval EFI_SUCCESS The protocol was removed from ChildHandle.
217 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
218 @retval EFI_INVALID_PARAMETER Child handle is NULL.
219 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
220 because its services are being used.
221 @retval other The child handle was not destroyed.
226 TlsServiceBindingDestroyChild (
227 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
228 IN EFI_HANDLE ChildHandle