2 This file defines the EFI Supplicant Protocol.
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 @par Revision Reference:
14 This Protocol is introduced in UEFI Specification 2.6
18 #ifndef __EFI_SUPPLICANT_PROTOCOL_H__
19 #define __EFI_SUPPLICANT_PROTOCOL_H__
21 #include <Protocol/WiFi2.h>
24 /// The EFI Supplicant Service Binding Protocol is used to locate EFI
25 /// Supplicant Protocol drivers to create and destroy child of the driver to
26 /// communicate with other host using Supplicant protocol.
28 #define EFI_SUPPLICANT_SERVICE_BINDING_PROTOCOL_GUID \
30 0x45bcd98e, 0x59ad, 0x4174, { 0x95, 0x46, 0x34, 0x4a, 0x7, 0x48, 0x58, 0x98 } \
34 /// The EFI Supplicant protocol provides services to process authentication and
35 /// data encryption/decryption for security management.
37 #define EFI_SUPPLICANT_PROTOCOL_GUID \
39 0x54fcc43e, 0xaa89, 0x4333, { 0x9a, 0x85, 0xcd, 0xea, 0x24, 0x5, 0x1e, 0x9e } \
42 typedef struct _EFI_SUPPLICANT_PROTOCOL EFI_SUPPLICANT_PROTOCOL
;
45 /// EFI_SUPPLICANT_CRYPT_MODE
49 // Encrypt data provided in the fragment buffers.
53 // Decrypt data provided in the fragment buffers.
56 } EFI_SUPPLICANT_CRYPT_MODE
;
59 /// EFI_SUPPLICANT_DATA_TYPE
63 // Session Configuration
67 // Current authentication type in use. The corresponding Data is of type
68 // EFI_80211_AKM_SUITE_SELECTOR.
70 EfiSupplicant80211AKMSuite
,
72 // Group data encryption type in use. The corresponding Data is of type
73 // EFI_SUPPLICANT_CIPHER_SUITE_SELECTOR.
75 EfiSupplicant80211GroupDataCipherSuite
,
77 // Pairwise encryption type in use. The corresponding Data is of type
78 // EFI_80211_CIPHER_SUITE_SELECTOR.
80 EfiSupplicant80211PairwiseCipherSuite
,
82 // PSK password. The corresponding Data is a NULL-terminated ASCII string.
84 EfiSupplicant80211PskPassword
,
86 // Target SSID name. The corresponding Data is of type EFI_80211_SSID.
88 EfiSupplicant80211TargetSSIDName
,
90 // Station MAC address. The corresponding Data is of type
91 // EFI_80211_MAC_ADDRESS.
93 EfiSupplicant80211StationMac
,
95 // Target SSID MAC address. The corresponding Data is 6 bytes MAC address.
97 EfiSupplicant80211TargetSSIDMac
,
100 // Session Information
104 // 802.11 PTK. The corresponding Data is of type EFI_SUPPLICANT_KEY.
106 EfiSupplicant80211PTK
,
108 // 802.11 GTK. The corresponding Data is of type EFI_SUPPLICANT_GTK_LIST.
110 EfiSupplicant80211GTK
,
112 // Supplicant state. The corresponding Data is
113 // EFI_EAPOL_SUPPLICANT_PAE_STATE.
117 // 802.11 link state. The corresponding Data is EFI_80211_LINK_STATE.
119 EfiSupplicant80211LinkState
,
121 // Flag indicates key is refreshed. The corresponding Data is
122 // EFI_SUPPLICANT_KEY_REFRESH.
124 EfiSupplicantKeyRefresh
,
127 // Session Configuration
131 // Supported authentication types. The corresponding Data is of type
132 // EFI_80211_AKM_SUITE_SELECTOR.
134 EfiSupplicant80211SupportedAKMSuites
,
136 // Supported software encryption types provided by supplicant driver. The
137 // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.
139 EfiSupplicant80211SupportedSoftwareCipherSuites
,
141 // Supported hardware encryption types provided by wireless UNDI driver. The
142 // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.
144 EfiSupplicant80211SupportedHardwareCipherSuites
,
147 // Session Information
151 // 802.11 Integrity GTK. The corresponding Data is of type
152 // EFI_SUPPLICANT_GTK_LIST.
154 EfiSupplicant80211IGTK
,
156 // 802.11 PMK. The corresponding Data is 32 bytes pairwise master key.
158 EfiSupplicant80211PMK
,
159 EfiSupplicantDataTypeMaximum
160 } EFI_SUPPLICANT_DATA_TYPE
;
163 /// EFI_80211_LINK_STATE
167 // Indicates initial start state, unauthenticated, unassociated.
169 Ieee80211UnauthenticatedUnassociated
,
171 // Indicates authenticated, unassociated.
173 Ieee80211AuthenticatedUnassociated
,
175 // Indicates authenticated and associated, but pending RSN authentication.
177 Ieee80211PendingRSNAuthentication
,
179 // Indicates authenticated and associated.
181 Ieee80211AuthenticatedAssociated
182 } EFI_80211_LINK_STATE
;
185 /// EFI_SUPPLICANT_KEY_TYPE (IEEE Std 802.11 Section 6.3.19.1.2)
192 } EFI_SUPPLICANT_KEY_TYPE
;
195 /// EFI_SUPPLICANT_KEY_DIRECTION (IEEE Std 802.11 Section 6.3.19.1.2)
199 // Indicates that the keys are being installed for the receive direction.
203 // Indicates that the keys are being installed for the transmit direction.
207 // Indicates that the keys are being installed for both the receive and
208 // transmit directions.
211 } EFI_SUPPLICANT_KEY_DIRECTION
;
214 /// EFI_SUPPLICANT_KEY_REFRESH
218 // If TRUE, indicates GTK is just refreshed after a successful call to
219 // EFI_SUPPLICANT_PROTOCOL.BuildResponsePacket().
222 } EFI_SUPPLICANT_KEY_REFRESH
;
224 #define EFI_MAX_KEY_LEN 64
227 /// EFI_SUPPLICANT_KEY
233 UINT8 Key
[EFI_MAX_KEY_LEN
];
235 // Length in bytes of the Key. Should be up to EFI_MAX_KEY_LEN.
239 // The key identifier.
243 // Defines whether this key is a group key, pairwise key, PeerKey, or
246 EFI_SUPPLICANT_KEY_TYPE KeyType
;
248 // The value is set according to the KeyType.
250 EFI_80211_MAC_ADDRESS Addr
;
252 // The Receive Sequence Count value.
256 // Length in bytes of the Rsc. Should be up to 8.
260 // Indicates whether the key is configured by the Authenticator or
261 // Supplicant. The value true indicates Authenticator.
263 BOOLEAN IsAuthenticator
;
265 // The cipher suite required for this association.
267 EFI_80211_SUITE_SELECTOR CipherSuite
;
269 // Indicates the direction for which the keys are to be installed.
271 EFI_SUPPLICANT_KEY_DIRECTION Direction
;
272 } EFI_SUPPLICANT_KEY
;
275 /// EFI_SUPPLICANT_GTK_LIST
279 // Indicates the number of GTKs that are contained in GTKList.
283 // A variable-length array of GTKs of type EFI_SUPPLICANT_KEY. The number of
284 // entries is specified by GTKCount.
286 EFI_SUPPLICANT_KEY GTKList
[1];
287 } EFI_SUPPLICANT_GTK_LIST
;
290 /// EFI_SUPPLICANT_FRAGMENT_DATA
294 // Length of data buffer in the fragment.
296 UINT32 FragmentLength
;
298 // Pointer to the data buffer in the fragment.
300 VOID
*FragmentBuffer
;
301 } EFI_SUPPLICANT_FRAGMENT_DATA
;
304 BuildResponsePacket() is called during STA and AP authentication is in
305 progress. Supplicant derives the PTK or session keys depend on type of
306 authentication is being employed.
308 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
310 @param[in] RequestBuffer Pointer to the most recently received EAPOL
311 packet. NULL means the supplicant need
312 initiate the EAP authentication session and
313 send EAPOL-Start message.
314 @param[in] RequestBufferSize
315 Packet size in bytes for the most recently
316 received EAPOL packet. 0 is only valid when
317 RequestBuffer is NULL.
318 @param[out] Buffer Pointer to the buffer to hold the built
320 @param[in, out] BufferSize Pointer to the buffer size in bytes. On
321 input, it is the buffer size provided by the
322 caller. On output, it is the buffer size in
323 fact needed to contain the packet.
325 @retval EFI_SUCCESS The required EAPOL packet is built
327 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
329 RequestBuffer is NULL, but RequestSize is
331 RequestBufferSize is 0.
332 Buffer is NULL, but RequestBuffer is NOT 0.
334 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response
336 @retval EFI_NOT_READY Current EAPOL session state is NOT ready to
337 build ResponsePacket.
342 (EFIAPI
*EFI_SUPPLICANT_BUILD_RESPONSE_PACKET
) (
343 IN EFI_SUPPLICANT_PROTOCOL
*This
,
344 IN UINT8
*RequestBuffer
, OPTIONAL
345 IN UINTN RequestBufferSize
, OPTIONAL
347 IN OUT UINTN
*BufferSize
351 ProcessPacket() is called to Supplicant driver to encrypt or decrypt the data
352 depending type of authentication type.
354 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
356 @param[in, out] FragmentTable Pointer to a list of fragment. The caller
357 will take responsible to handle the original
358 FragmentTable while it may be reallocated in
360 @param[in] FragmentCount Number of fragment.
361 @param[in] CryptMode Crypt mode.
363 @retval EFI_SUCCESS The operation completed successfully.
364 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
366 FragmentTable is NULL.
367 FragmentCount is NULL.
368 CryptMode is invalid.
369 @retval EFI_NOT_READY Current supplicant state is NOT Authenticated.
370 @retval EFI_ABORTED Something wrong decryption the message.
371 @retval EFI_UNSUPPORTED This API is not supported.
376 (EFIAPI
*EFI_SUPPLICANT_PROCESS_PACKET
) (
377 IN EFI_SUPPLICANT_PROTOCOL
*This
,
378 IN OUT EFI_SUPPLICANT_FRAGMENT_DATA
**FragmentTable
,
379 IN UINT32
*FragmentCount
,
380 IN EFI_SUPPLICANT_CRYPT_MODE CryptMode
384 Set Supplicant configuration data.
386 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
388 @param[in] DataType The type of data.
389 @param[in] Data Pointer to the buffer to hold the data.
390 @param[in] DataSize Pointer to the buffer size in bytes.
392 @retval EFI_SUCCESS The Supplicant configuration data is set
394 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
398 @retval EFI_UNSUPPORTED The DataType is unsupported.
399 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
404 (EFIAPI
*EFI_SUPPLICANT_SET_DATA
) (
405 IN EFI_SUPPLICANT_PROTOCOL
*This
,
406 IN EFI_SUPPLICANT_DATA_TYPE DataType
,
412 Get Supplicant configuration data.
414 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
416 @param[in] DataType The type of data.
417 @param[out] Data Pointer to the buffer to hold the data.
418 Ignored if DataSize is 0.
419 @param[in, out] DataSize Pointer to the buffer size in bytes. On
420 input, it is the buffer size provided by the
421 caller. On output, it is the buffer size in
422 fact needed to contain the packet.
424 @retval EFI_SUCCESS The Supplicant configuration data is got
426 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
430 Data is NULL if *DataSize is not zero.
431 @retval EFI_UNSUPPORTED The DataType is unsupported.
432 @retval EFI_NOT_FOUND The Supplicant configuration data is not
434 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the
435 specified configuration data and the required
436 size is returned in DataSize.
441 (EFIAPI
*EFI_SUPPLICANT_GET_DATA
) (
442 IN EFI_SUPPLICANT_PROTOCOL
*This
,
443 IN EFI_SUPPLICANT_DATA_TYPE DataType
,
444 OUT UINT8
*Data
, OPTIONAL
445 IN OUT UINTN
*DataSize
449 /// The EFI_SUPPLICANT_PROTOCOL is designed to provide unified place for WIFI
450 /// and EAP security management. Both PSK authentication and 802.1X EAP
451 /// authentication can be managed via this protocol and driver or application
452 /// as a consumer can only focus on about packet transmitting or receiving.
454 struct _EFI_SUPPLICANT_PROTOCOL
{
455 EFI_SUPPLICANT_BUILD_RESPONSE_PACKET BuildResponsePacket
;
456 EFI_SUPPLICANT_PROCESS_PACKET ProcessPacket
;
457 EFI_SUPPLICANT_SET_DATA SetData
;
458 EFI_SUPPLICANT_GET_DATA GetData
;
461 extern EFI_GUID gEfiSupplicantServiceBindingProtocolGuid
;
462 extern EFI_GUID gEfiSupplicantProtocolGuid
;