]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Supplicant.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / Supplicant.h
CommitLineData
392988a0
HW
1/** @file\r
2 This file defines the EFI Supplicant Protocol.\r
3\r
b941c34e 4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
392988a0
HW
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 @par Revision Reference:\r
14 This Protocol is introduced in UEFI Specification 2.6\r
15\r
16**/\r
17\r
18#ifndef __EFI_SUPPLICANT_PROTOCOL_H__\r
19#define __EFI_SUPPLICANT_PROTOCOL_H__\r
20\r
21#include <Protocol/WiFi2.h>\r
22\r
23///\r
24/// The EFI Supplicant Service Binding Protocol is used to locate EFI\r
25/// Supplicant Protocol drivers to create and destroy child of the driver to\r
26/// communicate with other host using Supplicant protocol.\r
27///\r
28#define EFI_SUPPLICANT_SERVICE_BINDING_PROTOCOL_GUID \\r
29 { \\r
30 0x45bcd98e, 0x59ad, 0x4174, { 0x95, 0x46, 0x34, 0x4a, 0x7, 0x48, 0x58, 0x98 } \\r
31 }\r
32\r
33///\r
34/// The EFI Supplicant protocol provides services to process authentication and\r
35/// data encryption/decryption for security management.\r
36///\r
37#define EFI_SUPPLICANT_PROTOCOL_GUID \\r
38 { \\r
39 0x54fcc43e, 0xaa89, 0x4333, { 0x9a, 0x85, 0xcd, 0xea, 0x24, 0x5, 0x1e, 0x9e } \\r
40 }\r
41\r
42typedef struct _EFI_SUPPLICANT_PROTOCOL EFI_SUPPLICANT_PROTOCOL;\r
43\r
44///\r
45/// EFI_SUPPLICANT_CRYPT_MODE\r
46///\r
47typedef enum {\r
48 //\r
49 // Encrypt data provided in the fragment buffers.\r
50 //\r
51 EfiSupplicantEncrypt,\r
52 //\r
53 // Decrypt data provided in the fragment buffers.\r
54 //\r
55 EfiSupplicantDecrypt,\r
56} EFI_SUPPLICANT_CRYPT_MODE;\r
57\r
58///\r
59/// EFI_SUPPLICANT_DATA_TYPE\r
60///\r
61typedef enum {\r
62 //\r
63 // Session Configuration\r
64 //\r
65\r
66 //\r
67 // Current authentication type in use. The corresponding Data is of type\r
68 // EFI_80211_AKM_SUITE_SELECTOR.\r
69 //\r
70 EfiSupplicant80211AKMSuite,\r
71 //\r
72 // Group data encryption type in use. The corresponding Data is of type\r
73 // EFI_SUPPLICANT_CIPHER_SUITE_SELECTOR.\r
74 //\r
75 EfiSupplicant80211GroupDataCipherSuite,\r
76 //\r
77 // Pairwise encryption type in use. The corresponding Data is of type\r
78 // EFI_80211_CIPHER_SUITE_SELECTOR.\r
79 //\r
80 EfiSupplicant80211PairwiseCipherSuite,\r
81 //\r
82 // PSK password. The corresponding Data is a NULL-terminated ASCII string.\r
83 //\r
84 EfiSupplicant80211PskPassword,\r
85 //\r
86 // Target SSID name. The corresponding Data is of type EFI_80211_SSID.\r
87 //\r
88 EfiSupplicant80211TargetSSIDName,\r
89 //\r
90 // Station MAC address. The corresponding Data is of type\r
91 // EFI_80211_MAC_ADDRESS.\r
92 //\r
93 EfiSupplicant80211StationMac,\r
94 //\r
95 // Target SSID MAC address. The corresponding Data is 6 bytes MAC address.\r
96 //\r
97 EfiSupplicant80211TargetSSIDMac,\r
98\r
99 //\r
100 // Session Information\r
101 //\r
102\r
103 //\r
104 // 802.11 PTK. The corresponding Data is of type EFI_SUPPLICANT_KEY.\r
105 //\r
106 EfiSupplicant80211PTK,\r
107 //\r
108 // 802.11 GTK. The corresponding Data is of type EFI_SUPPLICANT_GTK_LIST.\r
109 //\r
110 EfiSupplicant80211GTK,\r
111 //\r
112 // Supplicant state. The corresponding Data is\r
113 // EFI_EAPOL_SUPPLICANT_PAE_STATE.\r
114 //\r
115 EfiSupplicantState,\r
116 //\r
117 // 802.11 link state. The corresponding Data is EFI_80211_LINK_STATE.\r
118 //\r
119 EfiSupplicant80211LinkState,\r
120 //\r
121 // Flag indicates key is refreshed. The corresponding Data is\r
122 // EFI_SUPPLICANT_KEY_REFRESH.\r
123 //\r
124 EfiSupplicantKeyRefresh,\r
125\r
126 //\r
127 // Session Configuration\r
128 //\r
129\r
130 //\r
131 // Supported authentication types. The corresponding Data is of type\r
132 // EFI_80211_AKM_SUITE_SELECTOR.\r
133 //\r
134 EfiSupplicant80211SupportedAKMSuites,\r
135 //\r
136 // Supported software encryption types provided by supplicant driver. The\r
137 // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.\r
138 //\r
139 EfiSupplicant80211SupportedSoftwareCipherSuites,\r
140 //\r
141 // Supported hardware encryption types provided by wireless UNDI driver. The\r
142 // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.\r
143 //\r
144 EfiSupplicant80211SupportedHardwareCipherSuites,\r
145\r
146 //\r
147 // Session Information\r
148 //\r
149\r
150 //\r
151 // 802.11 Integrity GTK. The corresponding Data is of type\r
152 // EFI_SUPPLICANT_GTK_LIST.\r
153 //\r
154 EfiSupplicant80211IGTK,\r
b941c34e
WF
155 //\r
156 // 802.11 PMK. The corresponding Data is 32 bytes pairwise master key.\r
157 //\r
158 EfiSupplicant80211PMK,\r
392988a0
HW
159 EfiSupplicantDataTypeMaximum\r
160} EFI_SUPPLICANT_DATA_TYPE;\r
161\r
162///\r
163/// EFI_80211_LINK_STATE\r
164///\r
165typedef enum {\r
166 //\r
167 // Indicates initial start state, unauthenticated, unassociated.\r
168 //\r
169 Ieee80211UnauthenticatedUnassociated,\r
170 //\r
171 // Indicates authenticated, unassociated.\r
172 //\r
173 Ieee80211AuthenticatedUnassociated,\r
174 //\r
175 // Indicates authenticated and associated, but pending RSN authentication.\r
176 //\r
177 Ieee80211PendingRSNAuthentication,\r
178 //\r
179 // Indicates authenticated and associated.\r
180 //\r
181 Ieee80211AuthenticatedAssociated\r
182} EFI_80211_LINK_STATE;\r
183\r
184///\r
185/// EFI_SUPPLICANT_KEY_TYPE (IEEE Std 802.11 Section 6.3.19.1.2)\r
186///\r
187typedef enum {\r
188 Group,\r
189 Pairwise,\r
190 PeerKey,\r
191 IGTK\r
192} EFI_SUPPLICANT_KEY_TYPE;\r
193\r
194///\r
195/// EFI_SUPPLICANT_KEY_DIRECTION (IEEE Std 802.11 Section 6.3.19.1.2)\r
196///\r
197typedef enum {\r
198 //\r
199 // Indicates that the keys are being installed for the receive direction.\r
200 //\r
201 Receive,\r
202 //\r
203 // Indicates that the keys are being installed for the transmit direction.\r
204 //\r
205 Transmit,\r
206 //\r
207 // Indicates that the keys are being installed for both the receive and\r
208 // transmit directions.\r
209 //\r
210 Both\r
211} EFI_SUPPLICANT_KEY_DIRECTION;\r
212\r
213///\r
214/// EFI_SUPPLICANT_KEY_REFRESH\r
215///\r
216typedef struct {\r
217 //\r
218 // If TRUE, indicates GTK is just refreshed after a successful call to\r
219 // EFI_SUPPLICANT_PROTOCOL.BuildResponsePacket().\r
220 //\r
221 BOOLEAN GTKRefresh;\r
222} EFI_SUPPLICANT_KEY_REFRESH;\r
223\r
224#define EFI_MAX_KEY_LEN 64\r
225\r
226///\r
227/// EFI_SUPPLICANT_KEY\r
228///\r
229typedef struct {\r
230 //\r
231 // The key value.\r
232 //\r
233 UINT8 Key[EFI_MAX_KEY_LEN];\r
234 //\r
235 // Length in bytes of the Key. Should be up to EFI_MAX_KEY_LEN.\r
236 //\r
237 UINT8 KeyLen;\r
238 //\r
239 // The key identifier.\r
240 //\r
241 UINT8 KeyId;\r
242 //\r
243 // Defines whether this key is a group key, pairwise key, PeerKey, or\r
244 // Integrity Group.\r
245 //\r
246 EFI_SUPPLICANT_KEY_TYPE KeyType;\r
247 //\r
248 // The value is set according to the KeyType.\r
249 //\r
250 EFI_80211_MAC_ADDRESS Addr;\r
251 //\r
252 // The Receive Sequence Count value.\r
253 //\r
254 UINT8 Rsc[8];\r
255 //\r
256 // Length in bytes of the Rsc. Should be up to 8.\r
257 //\r
258 UINT8 RscLen;\r
259 //\r
260 // Indicates whether the key is configured by the Authenticator or\r
261 // Supplicant. The value true indicates Authenticator.\r
262 //\r
263 BOOLEAN IsAuthenticator;\r
264 //\r
265 // The cipher suite required for this association.\r
266 //\r
267 EFI_80211_SUITE_SELECTOR CipherSuite;\r
268 //\r
269 // Indicates the direction for which the keys are to be installed.\r
270 //\r
271 EFI_SUPPLICANT_KEY_DIRECTION Direction;\r
272} EFI_SUPPLICANT_KEY;\r
273\r
274///\r
275/// EFI_SUPPLICANT_GTK_LIST\r
276///\r
277typedef struct {\r
278 //\r
279 // Indicates the number of GTKs that are contained in GTKList.\r
280 //\r
281 UINT8 GTKCount;\r
282 //\r
283 // A variable-length array of GTKs of type EFI_SUPPLICANT_KEY. The number of\r
284 // entries is specified by GTKCount.\r
285 //\r
286 EFI_SUPPLICANT_KEY GTKList[1];\r
287} EFI_SUPPLICANT_GTK_LIST;\r
288\r
289///\r
290/// EFI_SUPPLICANT_FRAGMENT_DATA\r
291///\r
292typedef struct {\r
293 //\r
294 // Length of data buffer in the fragment.\r
295 //\r
296 UINT32 FragmentLength;\r
297 //\r
298 // Pointer to the data buffer in the fragment.\r
299 //\r
300 VOID *FragmentBuffer;\r
301} EFI_SUPPLICANT_FRAGMENT_DATA;\r
302\r
303/**\r
304 BuildResponsePacket() is called during STA and AP authentication is in\r
305 progress. Supplicant derives the PTK or session keys depend on type of\r
306 authentication is being employed.\r
307\r
308 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL\r
309 instance.\r
310 @param[in] RequestBuffer Pointer to the most recently received EAPOL\r
311 packet. NULL means the supplicant need\r
312 initiate the EAP authentication session and\r
313 send EAPOL-Start message.\r
314 @param[in] RequestBufferSize\r
315 Packet size in bytes for the most recently\r
316 received EAPOL packet. 0 is only valid when\r
317 RequestBuffer is NULL.\r
318 @param[out] Buffer Pointer to the buffer to hold the built\r
319 packet.\r
320 @param[in, out] BufferSize Pointer to the buffer size in bytes. On\r
321 input, it is the buffer size provided by the\r
322 caller. On output, it is the buffer size in\r
323 fact needed to contain the packet.\r
324\r
325 @retval EFI_SUCCESS The required EAPOL packet is built\r
326 successfully.\r
327 @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r
328 TRUE:\r
329 RequestBuffer is NULL, but RequestSize is\r
330 NOT 0.\r
331 RequestBufferSize is 0.\r
332 Buffer is NULL, but RequestBuffer is NOT 0.\r
333 BufferSize is NULL.\r
334 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response\r
335 packet.\r
336 @retval EFI_NOT_READY Current EAPOL session state is NOT ready to\r
337 build ResponsePacket.\r
338\r
339**/\r
340typedef\r
341EFI_STATUS\r
342(EFIAPI *EFI_SUPPLICANT_BUILD_RESPONSE_PACKET) (\r
343 IN EFI_SUPPLICANT_PROTOCOL *This,\r
344 IN UINT8 *RequestBuffer, OPTIONAL\r
345 IN UINTN RequestBufferSize, OPTIONAL\r
346 OUT UINT8 *Buffer,\r
347 IN OUT UINTN *BufferSize\r
348 );\r
349\r
350/**\r
351 ProcessPacket() is called to Supplicant driver to encrypt or decrypt the data\r
352 depending type of authentication type.\r
353\r
354 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL\r
355 instance.\r
356 @param[in, out] FragmentTable Pointer to a list of fragment. The caller\r
357 will take responsible to handle the original\r
358 FragmentTable while it may be reallocated in\r
359 Supplicant driver.\r
360 @param[in] FragmentCount Number of fragment.\r
361 @param[in] CryptMode Crypt mode.\r
362\r
363 @retval EFI_SUCCESS The operation completed successfully.\r
364 @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r
365 TRUE:\r
366 FragmentTable is NULL.\r
367 FragmentCount is NULL.\r
368 CryptMode is invalid.\r
369 @retval EFI_NOT_READY Current supplicant state is NOT Authenticated.\r
370 @retval EFI_ABORTED Something wrong decryption the message.\r
371 @retval EFI_UNSUPPORTED This API is not supported.\r
372\r
373**/\r
374typedef\r
375EFI_STATUS\r
376(EFIAPI *EFI_SUPPLICANT_PROCESS_PACKET) (\r
377 IN EFI_SUPPLICANT_PROTOCOL *This,\r
378 IN OUT EFI_SUPPLICANT_FRAGMENT_DATA **FragmentTable,\r
379 IN UINT32 *FragmentCount,\r
380 IN EFI_SUPPLICANT_CRYPT_MODE CryptMode\r
381 );\r
382\r
383/**\r
384 Set Supplicant configuration data.\r
385\r
386 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL\r
387 instance.\r
388 @param[in] DataType The type of data.\r
389 @param[in] Data Pointer to the buffer to hold the data.\r
390 @param[in] DataSize Pointer to the buffer size in bytes.\r
391\r
392 @retval EFI_SUCCESS The Supplicant configuration data is set\r
393 successfully.\r
394 @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r
395 TRUE:\r
396 Data is NULL.\r
397 DataSize is 0.\r
398 @retval EFI_UNSUPPORTED The DataType is unsupported.\r
399 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.\r
400\r
401**/\r
402typedef\r
403EFI_STATUS\r
404(EFIAPI *EFI_SUPPLICANT_SET_DATA) (\r
405 IN EFI_SUPPLICANT_PROTOCOL *This,\r
406 IN EFI_SUPPLICANT_DATA_TYPE DataType,\r
407 IN VOID *Data,\r
408 IN UINTN DataSize\r
409 );\r
410\r
411/**\r
412 Get Supplicant configuration data.\r
413\r
414 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL\r
415 instance.\r
416 @param[in] DataType The type of data.\r
417 @param[out] Data Pointer to the buffer to hold the data.\r
418 Ignored if DataSize is 0.\r
419 @param[in, out] DataSize Pointer to the buffer size in bytes. On\r
420 input, it is the buffer size provided by the\r
421 caller. On output, it is the buffer size in\r
422 fact needed to contain the packet.\r
423\r
424 @retval EFI_SUCCESS The Supplicant configuration data is got\r
425 successfully.\r
426 @retval EFI_INVALID_PARAMETER One or more of the following conditions is\r
427 TRUE:\r
428 This is NULL.\r
429 DataSize is NULL.\r
430 Data is NULL if *DataSize is not zero.\r
431 @retval EFI_UNSUPPORTED The DataType is unsupported.\r
432 @retval EFI_NOT_FOUND The Supplicant configuration data is not\r
433 found.\r
434 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the\r
435 specified configuration data and the required\r
436 size is returned in DataSize.\r
437\r
438**/\r
439typedef\r
440EFI_STATUS\r
441(EFIAPI *EFI_SUPPLICANT_GET_DATA) (\r
442 IN EFI_SUPPLICANT_PROTOCOL *This,\r
443 IN EFI_SUPPLICANT_DATA_TYPE DataType,\r
444 OUT UINT8 *Data, OPTIONAL\r
445 IN OUT UINTN *DataSize\r
446 );\r
447\r
448///\r
449/// The EFI_SUPPLICANT_PROTOCOL is designed to provide unified place for WIFI\r
450/// and EAP security management. Both PSK authentication and 802.1X EAP\r
451/// authentication can be managed via this protocol and driver or application\r
452/// as a consumer can only focus on about packet transmitting or receiving.\r
453///\r
454struct _EFI_SUPPLICANT_PROTOCOL {\r
455 EFI_SUPPLICANT_BUILD_RESPONSE_PACKET BuildResponsePacket;\r
456 EFI_SUPPLICANT_PROCESS_PACKET ProcessPacket;\r
457 EFI_SUPPLICANT_SET_DATA SetData;\r
458 EFI_SUPPLICANT_GET_DATA GetData;\r
459};\r
460\r
461extern EFI_GUID gEfiSupplicantServiceBindingProtocolGuid;\r
462extern EFI_GUID gEfiSupplicantProtocolGuid;\r
463\r
464#endif\r