]>
Commit | Line | Data |
---|---|---|
7618784b HW |
1 | /** @file\r |
2 | Header file of the Driver Binding and Service Binding Protocol for TlsDxe driver.\r | |
3 | \r | |
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r | |
5 | \r | |
ecf98fbc | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
7618784b HW |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #ifndef __EFI_TLS_DRIVER_H__\r | |
11 | #define __EFI_TLS_DRIVER_H__\r | |
12 | \r | |
13 | #include <Uefi.h>\r | |
14 | \r | |
15 | //\r | |
16 | // Driver Protocols\r | |
17 | //\r | |
18 | #include <Protocol/ServiceBinding.h>\r | |
19 | \r | |
20 | //\r | |
21 | // Driver Version\r | |
22 | //\r | |
23 | #define TLS_VERSION 0x00000000\r | |
24 | \r | |
25 | #define TLS_SERVICE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'S')\r | |
26 | \r | |
27 | #define TLS_INSTANCE_SIGNATURE SIGNATURE_32 ('T', 'L', 'S', 'I')\r | |
28 | \r | |
29 | ///\r | |
30 | /// TLS Service Data\r | |
31 | ///\r | |
32 | typedef struct _TLS_SERVICE TLS_SERVICE;\r | |
33 | \r | |
34 | ///\r | |
35 | /// TLS Instance Data\r | |
36 | ///\r | |
37 | typedef struct _TLS_INSTANCE TLS_INSTANCE;\r | |
38 | \r | |
39 | \r | |
40 | struct _TLS_SERVICE {\r | |
41 | UINT32 Signature;\r | |
42 | EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;\r | |
43 | \r | |
44 | UINT16 TlsChildrenNum;\r | |
45 | LIST_ENTRY TlsChildrenList;\r | |
46 | \r | |
47 | //\r | |
48 | // Handle to install TlsServiceBinding protocol.\r | |
49 | //\r | |
50 | EFI_HANDLE Handle;\r | |
51 | EFI_HANDLE ImageHandle;\r | |
52 | \r | |
53 | //\r | |
54 | // Main SSL Context object which is created by a server or client once per program\r | |
55 | // life-time and which holds mainly default values for the SSL object which are later\r | |
56 | // created for the connections.\r | |
57 | //\r | |
58 | VOID *TlsCtx;\r | |
59 | };\r | |
60 | \r | |
61 | struct _TLS_INSTANCE {\r | |
62 | UINT32 Signature;\r | |
63 | LIST_ENTRY Link;\r | |
64 | \r | |
65 | BOOLEAN InDestroy;\r | |
66 | \r | |
67 | TLS_SERVICE *Service;\r | |
68 | EFI_HANDLE ChildHandle;\r | |
69 | \r | |
70 | EFI_TLS_PROTOCOL Tls;\r | |
71 | EFI_TLS_CONFIGURATION_PROTOCOL TlsConfig;\r | |
72 | \r | |
73 | EFI_TLS_SESSION_STATE TlsSessionState;\r | |
74 | \r | |
75 | //\r | |
76 | // Main SSL Connection which is created by a server or a client\r | |
77 | // per established connection.\r | |
78 | //\r | |
79 | VOID *TlsConn;\r | |
80 | };\r | |
81 | \r | |
82 | \r | |
83 | #define TLS_SERVICE_FROM_THIS(a) \\r | |
84 | CR (a, TLS_SERVICE, ServiceBinding, TLS_SERVICE_SIGNATURE)\r | |
85 | \r | |
86 | #define TLS_INSTANCE_FROM_PROTOCOL(a) \\r | |
87 | CR (a, TLS_INSTANCE, Tls, TLS_INSTANCE_SIGNATURE)\r | |
88 | \r | |
89 | #define TLS_INSTANCE_FROM_CONFIGURATION(a) \\r | |
90 | CR (a, TLS_INSTANCE, TlsConfig, TLS_INSTANCE_SIGNATURE)\r | |
91 | \r | |
92 | \r | |
93 | /**\r | |
94 | Release all the resources used by the TLS instance.\r | |
95 | \r | |
96 | @param[in] Instance The TLS instance data.\r | |
97 | \r | |
98 | **/\r | |
99 | VOID\r | |
100 | TlsCleanInstance (\r | |
101 | IN TLS_INSTANCE *Instance\r | |
102 | );\r | |
103 | \r | |
104 | /**\r | |
105 | Create the TLS instance and initialize it.\r | |
106 | \r | |
107 | @param[in] Service The pointer to the TLS service.\r | |
108 | @param[out] Instance The pointer to the TLS instance.\r | |
109 | \r | |
110 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r | |
111 | @retval EFI_SUCCESS The TLS instance is created.\r | |
112 | \r | |
113 | **/\r | |
114 | EFI_STATUS\r | |
115 | TlsCreateInstance (\r | |
116 | IN TLS_SERVICE *Service,\r | |
117 | OUT TLS_INSTANCE **Instance\r | |
118 | );\r | |
119 | \r | |
120 | /**\r | |
121 | Release all the resources used by the TLS service binding instance.\r | |
122 | \r | |
123 | @param[in] Service The TLS service data.\r | |
124 | \r | |
125 | **/\r | |
126 | VOID\r | |
127 | TlsCleanService (\r | |
128 | IN TLS_SERVICE *Service\r | |
129 | );\r | |
130 | \r | |
131 | /**\r | |
132 | Create then initialize a TLS service.\r | |
133 | \r | |
134 | @param[in] Image ImageHandle of the TLS driver\r | |
135 | @param[out] Service The service for TLS driver\r | |
136 | \r | |
137 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to create the service.\r | |
138 | @retval EFI_SUCCESS The service is created for the driver.\r | |
139 | \r | |
140 | **/\r | |
141 | EFI_STATUS\r | |
142 | TlsCreateService (\r | |
143 | IN EFI_HANDLE Image,\r | |
144 | OUT TLS_SERVICE **Service\r | |
145 | );\r | |
146 | \r | |
147 | /**\r | |
148 | Unloads an image.\r | |
149 | \r | |
150 | @param[in] ImageHandle Handle that identifies the image to be unloaded.\r | |
151 | \r | |
152 | @retval EFI_SUCCESS The image has been unloaded.\r | |
153 | @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r | |
154 | \r | |
155 | **/\r | |
156 | EFI_STATUS\r | |
157 | EFIAPI\r | |
158 | TlsUnload (\r | |
159 | IN EFI_HANDLE ImageHandle\r | |
160 | );\r | |
161 | \r | |
162 | /**\r | |
163 | This is the declaration of an EFI image entry point. This entry point is\r | |
164 | the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r | |
165 | both device drivers and bus drivers.\r | |
166 | \r | |
167 | @param ImageHandle The firmware allocated handle for the UEFI image.\r | |
168 | @param SystemTable A pointer to the EFI System Table.\r | |
169 | \r | |
170 | @retval EFI_SUCCESS The operation completed successfully.\r | |
171 | @retval Others An unexpected error occurred.\r | |
172 | **/\r | |
173 | EFI_STATUS\r | |
174 | EFIAPI\r | |
175 | TlsDriverEntryPoint (\r | |
176 | IN EFI_HANDLE ImageHandle,\r | |
177 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
178 | );\r | |
179 | \r | |
180 | /**\r | |
181 | Creates a child handle and installs a protocol.\r | |
182 | \r | |
183 | The CreateChild() function installs a protocol on ChildHandle.\r | |
184 | If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r | |
185 | If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r | |
186 | \r | |
187 | @param[in] This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r | |
188 | @param[in] ChildHandle Pointer to the handle of the child to create. If it is NULL,\r | |
189 | then a new handle is created. If it is a pointer to an existing UEFI handle,\r | |
190 | then the protocol is added to the existing UEFI handle.\r | |
191 | \r | |
dad13c80 | 192 | @retval EFI_SUCCESS The protocol was added to ChildHandle.\r |
7618784b HW |
193 | @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r |
194 | @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r | |
195 | the child.\r | |
196 | @retval other The child handle was not created.\r | |
197 | \r | |
198 | **/\r | |
199 | EFI_STATUS\r | |
200 | EFIAPI\r | |
201 | TlsServiceBindingCreateChild (\r | |
202 | IN EFI_SERVICE_BINDING_PROTOCOL *This,\r | |
203 | IN EFI_HANDLE *ChildHandle\r | |
204 | );\r | |
205 | \r | |
206 | /**\r | |
207 | Destroys a child handle with a protocol installed on it.\r | |
208 | \r | |
209 | The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r | |
210 | that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r | |
211 | last protocol on ChildHandle, then ChildHandle is destroyed.\r | |
212 | \r | |
213 | @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r | |
214 | @param ChildHandle Handle of the child to destroy.\r | |
215 | \r | |
dad13c80 | 216 | @retval EFI_SUCCESS The protocol was removed from ChildHandle.\r |
7618784b HW |
217 | @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.\r |
218 | @retval EFI_INVALID_PARAMETER Child handle is NULL.\r | |
219 | @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle\r | |
220 | because its services are being used.\r | |
221 | @retval other The child handle was not destroyed.\r | |
222 | \r | |
223 | **/\r | |
224 | EFI_STATUS\r | |
225 | EFIAPI\r | |
226 | TlsServiceBindingDestroyChild (\r | |
227 | IN EFI_SERVICE_BINDING_PROTOCOL *This,\r | |
228 | IN EFI_HANDLE ChildHandle\r | |
229 | );\r | |
230 | \r | |
231 | #endif\r | |
232 | \r |