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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __EFI_TLS_DRIVER_H__
17 #define __EFI_TLS_DRIVER_H__
24 #include <Protocol/ServiceBinding.h>
29 #define TLS_VERSION 0x00000000
31 #define TLS_SERVICE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'S')
33 #define TLS_INSTANCE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'I')
38 typedef struct _TLS_SERVICE TLS_SERVICE
;
43 typedef struct _TLS_INSTANCE TLS_INSTANCE
;
48 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding
;
50 UINT16 TlsChildrenNum
;
51 LIST_ENTRY TlsChildrenList
;
54 // Handle to install TlsServiceBinding protocol.
57 EFI_HANDLE ImageHandle
;
60 // Main SSL Context object which is created by a server or client once per program
61 // life-time and which holds mainly default values for the SSL object which are later
62 // created for the connections.
67 struct _TLS_INSTANCE
{
74 EFI_HANDLE ChildHandle
;
77 EFI_TLS_CONFIGURATION_PROTOCOL TlsConfig
;
79 EFI_TLS_SESSION_STATE TlsSessionState
;
82 // Main SSL Connection which is created by a server or a client
83 // per established connection.
89 #define TLS_SERVICE_FROM_THIS(a) \
90 CR (a, TLS_SERVICE, ServiceBinding, TLS_SERVICE_SIGNATURE)
92 #define TLS_INSTANCE_FROM_PROTOCOL(a) \
93 CR (a, TLS_INSTANCE, Tls, TLS_INSTANCE_SIGNATURE)
95 #define TLS_INSTANCE_FROM_CONFIGURATION(a) \
96 CR (a, TLS_INSTANCE, TlsConfig, TLS_INSTANCE_SIGNATURE)
100 Release all the resources used by the TLS instance.
102 @param[in] Instance The TLS instance data.
107 IN TLS_INSTANCE
*Instance
111 Create the TLS instance and initialize it.
113 @param[in] Service The pointer to the TLS service.
114 @param[out] Instance The pointer to the TLS instance.
116 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
117 @retval EFI_SUCCESS The TLS instance is created.
122 IN TLS_SERVICE
*Service
,
123 OUT TLS_INSTANCE
**Instance
127 Release all the resources used by the TLS service binding instance.
129 @param[in] Service The TLS service data.
134 IN TLS_SERVICE
*Service
138 Create then initialize a TLS service.
140 @param[in] Image ImageHandle of the TLS driver
141 @param[out] Service The service for TLS driver
143 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to create the service.
144 @retval EFI_SUCCESS The service is created for the driver.
150 OUT TLS_SERVICE
**Service
156 @param[in] ImageHandle Handle that identifies the image to be unloaded.
158 @retval EFI_SUCCESS The image has been unloaded.
159 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
165 IN EFI_HANDLE ImageHandle
169 This is the declaration of an EFI image entry point. This entry point is
170 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
171 both device drivers and bus drivers.
173 @param ImageHandle The firmware allocated handle for the UEFI image.
174 @param SystemTable A pointer to the EFI System Table.
176 @retval EFI_SUCCESS The operation completed successfully.
177 @retval Others An unexpected error occurred.
181 TlsDriverEntryPoint (
182 IN EFI_HANDLE ImageHandle
,
183 IN EFI_SYSTEM_TABLE
*SystemTable
187 Creates a child handle and installs a protocol.
189 The CreateChild() function installs a protocol on ChildHandle.
190 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
191 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
193 @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
194 @param[in] ChildHandle Pointer to the handle of the child to create. If it is NULL,
195 then a new handle is created. If it is a pointer to an existing UEFI handle,
196 then the protocol is added to the existing UEFI handle.
198 @retval EFI_SUCCES The protocol was added to ChildHandle.
199 @retval EFI_INVALID_PARAMETER ChildHandle is NULL.
200 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
202 @retval other The child handle was not created.
207 TlsServiceBindingCreateChild (
208 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
209 IN EFI_HANDLE
*ChildHandle
213 Destroys a child handle with a protocol installed on it.
215 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
216 that was installed by CreateChild() from ChildHandle. If the removed protocol is the
217 last protocol on ChildHandle, then ChildHandle is destroyed.
219 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
220 @param ChildHandle Handle of the child to destroy.
222 @retval EFI_SUCCES The protocol was removed from ChildHandle.
223 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
224 @retval EFI_INVALID_PARAMETER Child handle is NULL.
225 @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
226 because its services are being used.
227 @retval other The child handle was not destroyed.
232 TlsServiceBindingDestroyChild (
233 IN EFI_SERVICE_BINDING_PROTOCOL
*This
,
234 IN EFI_HANDLE ChildHandle