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