2 This file defines the EFI Supplicant Protocol.
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
7 @par Revision Reference:
8 This Protocol is introduced in UEFI Specification 2.6
12 #ifndef __EFI_SUPPLICANT_PROTOCOL_H__
13 #define __EFI_SUPPLICANT_PROTOCOL_H__
15 #include <Protocol/WiFi2.h>
18 /// The EFI Supplicant Service Binding Protocol is used to locate EFI
19 /// Supplicant Protocol drivers to create and destroy child of the driver to
20 /// communicate with other host using Supplicant protocol.
22 #define EFI_SUPPLICANT_SERVICE_BINDING_PROTOCOL_GUID \
24 0x45bcd98e, 0x59ad, 0x4174, { 0x95, 0x46, 0x34, 0x4a, 0x7, 0x48, 0x58, 0x98 } \
28 /// The EFI Supplicant protocol provides services to process authentication and
29 /// data encryption/decryption for security management.
31 #define EFI_SUPPLICANT_PROTOCOL_GUID \
33 0x54fcc43e, 0xaa89, 0x4333, { 0x9a, 0x85, 0xcd, 0xea, 0x24, 0x5, 0x1e, 0x9e } \
36 typedef struct _EFI_SUPPLICANT_PROTOCOL EFI_SUPPLICANT_PROTOCOL
;
39 /// EFI_SUPPLICANT_CRYPT_MODE
43 // Encrypt data provided in the fragment buffers.
47 // Decrypt data provided in the fragment buffers.
50 } EFI_SUPPLICANT_CRYPT_MODE
;
53 /// EFI_SUPPLICANT_DATA_TYPE
57 // Session Configuration
61 // Current authentication type in use. The corresponding Data is of type
62 // EFI_80211_AKM_SUITE_SELECTOR.
64 EfiSupplicant80211AKMSuite
,
66 // Group data encryption type in use. The corresponding Data is of type
67 // EFI_SUPPLICANT_CIPHER_SUITE_SELECTOR.
69 EfiSupplicant80211GroupDataCipherSuite
,
71 // Pairwise encryption type in use. The corresponding Data is of type
72 // EFI_80211_CIPHER_SUITE_SELECTOR.
74 EfiSupplicant80211PairwiseCipherSuite
,
76 // PSK password. The corresponding Data is a NULL-terminated ASCII string.
78 EfiSupplicant80211PskPassword
,
80 // Target SSID name. The corresponding Data is of type EFI_80211_SSID.
82 EfiSupplicant80211TargetSSIDName
,
84 // Station MAC address. The corresponding Data is of type
85 // EFI_80211_MAC_ADDRESS.
87 EfiSupplicant80211StationMac
,
89 // Target SSID MAC address. The corresponding Data is 6 bytes MAC address.
91 EfiSupplicant80211TargetSSIDMac
,
94 // Session Information
98 // 802.11 PTK. The corresponding Data is of type EFI_SUPPLICANT_KEY.
100 EfiSupplicant80211PTK
,
102 // 802.11 GTK. The corresponding Data is of type EFI_SUPPLICANT_GTK_LIST.
104 EfiSupplicant80211GTK
,
106 // Supplicant state. The corresponding Data is
107 // EFI_EAPOL_SUPPLICANT_PAE_STATE.
111 // 802.11 link state. The corresponding Data is EFI_80211_LINK_STATE.
113 EfiSupplicant80211LinkState
,
115 // Flag indicates key is refreshed. The corresponding Data is
116 // EFI_SUPPLICANT_KEY_REFRESH.
118 EfiSupplicantKeyRefresh
,
121 // Session Configuration
125 // Supported authentication types. The corresponding Data is of type
126 // EFI_80211_AKM_SUITE_SELECTOR.
128 EfiSupplicant80211SupportedAKMSuites
,
130 // Supported software encryption types provided by supplicant driver. The
131 // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.
133 EfiSupplicant80211SupportedSoftwareCipherSuites
,
135 // Supported hardware encryption types provided by wireless UNDI driver. The
136 // corresponding Data is of type EFI_80211_CIPHER_SUITE_SELECTOR.
138 EfiSupplicant80211SupportedHardwareCipherSuites
,
141 // Session Information
145 // 802.11 Integrity GTK. The corresponding Data is of type
146 // EFI_SUPPLICANT_GTK_LIST.
148 EfiSupplicant80211IGTK
,
150 // 802.11 PMK. The corresponding Data is 32 bytes pairwise master key.
152 EfiSupplicant80211PMK
,
153 EfiSupplicantDataTypeMaximum
154 } EFI_SUPPLICANT_DATA_TYPE
;
157 /// EFI_80211_LINK_STATE
161 // Indicates initial start state, unauthenticated, unassociated.
163 Ieee80211UnauthenticatedUnassociated
,
165 // Indicates authenticated, unassociated.
167 Ieee80211AuthenticatedUnassociated
,
169 // Indicates authenticated and associated, but pending RSN authentication.
171 Ieee80211PendingRSNAuthentication
,
173 // Indicates authenticated and associated.
175 Ieee80211AuthenticatedAssociated
176 } EFI_80211_LINK_STATE
;
179 /// EFI_SUPPLICANT_KEY_TYPE (IEEE Std 802.11 Section 6.3.19.1.2)
186 } EFI_SUPPLICANT_KEY_TYPE
;
189 /// EFI_SUPPLICANT_KEY_DIRECTION (IEEE Std 802.11 Section 6.3.19.1.2)
193 // Indicates that the keys are being installed for the receive direction.
197 // Indicates that the keys are being installed for the transmit direction.
201 // Indicates that the keys are being installed for both the receive and
202 // transmit directions.
205 } EFI_SUPPLICANT_KEY_DIRECTION
;
208 /// EFI_SUPPLICANT_KEY_REFRESH
212 // If TRUE, indicates GTK is just refreshed after a successful call to
213 // EFI_SUPPLICANT_PROTOCOL.BuildResponsePacket().
216 } EFI_SUPPLICANT_KEY_REFRESH
;
218 #define EFI_MAX_KEY_LEN 64
221 /// EFI_SUPPLICANT_KEY
227 UINT8 Key
[EFI_MAX_KEY_LEN
];
229 // Length in bytes of the Key. Should be up to EFI_MAX_KEY_LEN.
233 // The key identifier.
237 // Defines whether this key is a group key, pairwise key, PeerKey, or
240 EFI_SUPPLICANT_KEY_TYPE KeyType
;
242 // The value is set according to the KeyType.
244 EFI_80211_MAC_ADDRESS Addr
;
246 // The Receive Sequence Count value.
250 // Length in bytes of the Rsc. Should be up to 8.
254 // Indicates whether the key is configured by the Authenticator or
255 // Supplicant. The value true indicates Authenticator.
257 BOOLEAN IsAuthenticator
;
259 // The cipher suite required for this association.
261 EFI_80211_SUITE_SELECTOR CipherSuite
;
263 // Indicates the direction for which the keys are to be installed.
265 EFI_SUPPLICANT_KEY_DIRECTION Direction
;
266 } EFI_SUPPLICANT_KEY
;
269 /// EFI_SUPPLICANT_GTK_LIST
273 // Indicates the number of GTKs that are contained in GTKList.
277 // A variable-length array of GTKs of type EFI_SUPPLICANT_KEY. The number of
278 // entries is specified by GTKCount.
280 EFI_SUPPLICANT_KEY GTKList
[1];
281 } EFI_SUPPLICANT_GTK_LIST
;
284 /// EFI_SUPPLICANT_FRAGMENT_DATA
288 // Length of data buffer in the fragment.
290 UINT32 FragmentLength
;
292 // Pointer to the data buffer in the fragment.
294 VOID
*FragmentBuffer
;
295 } EFI_SUPPLICANT_FRAGMENT_DATA
;
298 BuildResponsePacket() is called during STA and AP authentication is in
299 progress. Supplicant derives the PTK or session keys depend on type of
300 authentication is being employed.
302 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
304 @param[in] RequestBuffer Pointer to the most recently received EAPOL
305 packet. NULL means the supplicant need
306 initiate the EAP authentication session and
307 send EAPOL-Start message.
308 @param[in] RequestBufferSize
309 Packet size in bytes for the most recently
310 received EAPOL packet. 0 is only valid when
311 RequestBuffer is NULL.
312 @param[out] Buffer Pointer to the buffer to hold the built
314 @param[in, out] BufferSize Pointer to the buffer size in bytes. On
315 input, it is the buffer size provided by the
316 caller. On output, it is the buffer size in
317 fact needed to contain the packet.
319 @retval EFI_SUCCESS The required EAPOL packet is built
321 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
323 RequestBuffer is NULL, but RequestSize is
325 RequestBufferSize is 0.
326 Buffer is NULL, but RequestBuffer is NOT 0.
328 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response
330 @retval EFI_NOT_READY Current EAPOL session state is NOT ready to
331 build ResponsePacket.
336 (EFIAPI
*EFI_SUPPLICANT_BUILD_RESPONSE_PACKET
) (
337 IN EFI_SUPPLICANT_PROTOCOL
*This
,
338 IN UINT8
*RequestBuffer
, OPTIONAL
339 IN UINTN RequestBufferSize
, OPTIONAL
341 IN OUT UINTN
*BufferSize
345 ProcessPacket() is called to Supplicant driver to encrypt or decrypt the data
346 depending type of authentication type.
348 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
350 @param[in, out] FragmentTable Pointer to a list of fragment. The caller
351 will take responsible to handle the original
352 FragmentTable while it may be reallocated in
354 @param[in] FragmentCount Number of fragment.
355 @param[in] CryptMode Crypt mode.
357 @retval EFI_SUCCESS The operation completed successfully.
358 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
360 FragmentTable is NULL.
361 FragmentCount is NULL.
362 CryptMode is invalid.
363 @retval EFI_NOT_READY Current supplicant state is NOT Authenticated.
364 @retval EFI_ABORTED Something wrong decryption the message.
365 @retval EFI_UNSUPPORTED This API is not supported.
370 (EFIAPI
*EFI_SUPPLICANT_PROCESS_PACKET
) (
371 IN EFI_SUPPLICANT_PROTOCOL
*This
,
372 IN OUT EFI_SUPPLICANT_FRAGMENT_DATA
**FragmentTable
,
373 IN UINT32
*FragmentCount
,
374 IN EFI_SUPPLICANT_CRYPT_MODE CryptMode
378 Set Supplicant configuration data.
380 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
382 @param[in] DataType The type of data.
383 @param[in] Data Pointer to the buffer to hold the data.
384 @param[in] DataSize Pointer to the buffer size in bytes.
386 @retval EFI_SUCCESS The Supplicant configuration data is set
388 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
392 @retval EFI_UNSUPPORTED The DataType is unsupported.
393 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
398 (EFIAPI
*EFI_SUPPLICANT_SET_DATA
) (
399 IN EFI_SUPPLICANT_PROTOCOL
*This
,
400 IN EFI_SUPPLICANT_DATA_TYPE DataType
,
406 Get Supplicant configuration data.
408 @param[in] This Pointer to the EFI_SUPPLICANT_PROTOCOL
410 @param[in] DataType The type of data.
411 @param[out] Data Pointer to the buffer to hold the data.
412 Ignored if DataSize is 0.
413 @param[in, out] DataSize Pointer to the buffer size in bytes. On
414 input, it is the buffer size provided by the
415 caller. On output, it is the buffer size in
416 fact needed to contain the packet.
418 @retval EFI_SUCCESS The Supplicant configuration data is got
420 @retval EFI_INVALID_PARAMETER One or more of the following conditions is
424 Data is NULL if *DataSize is not zero.
425 @retval EFI_UNSUPPORTED The DataType is unsupported.
426 @retval EFI_NOT_FOUND The Supplicant configuration data is not
428 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the
429 specified configuration data and the required
430 size is returned in DataSize.
435 (EFIAPI
*EFI_SUPPLICANT_GET_DATA
) (
436 IN EFI_SUPPLICANT_PROTOCOL
*This
,
437 IN EFI_SUPPLICANT_DATA_TYPE DataType
,
438 OUT UINT8
*Data
, OPTIONAL
439 IN OUT UINTN
*DataSize
443 /// The EFI_SUPPLICANT_PROTOCOL is designed to provide unified place for WIFI
444 /// and EAP security management. Both PSK authentication and 802.1X EAP
445 /// authentication can be managed via this protocol and driver or application
446 /// as a consumer can only focus on about packet transmitting or receiving.
448 struct _EFI_SUPPLICANT_PROTOCOL
{
449 EFI_SUPPLICANT_BUILD_RESPONSE_PACKET BuildResponsePacket
;
450 EFI_SUPPLICANT_PROCESS_PACKET ProcessPacket
;
451 EFI_SUPPLICANT_SET_DATA SetData
;
452 EFI_SUPPLICANT_GET_DATA GetData
;
455 extern EFI_GUID gEfiSupplicantServiceBindingProtocolGuid
;
456 extern EFI_GUID gEfiSupplicantProtocolGuid
;