wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eap_psk_common.h
Go to the documentation of this file.
1 
5 #ifndef EAP_PSK_COMMON_H
6 #define EAP_PSK_COMMON_H
7 
8 
9 #define EAP_PSK_RAND_LEN 16
10 #define EAP_PSK_MAC_LEN 16
11 #define EAP_PSK_TEK_LEN 16
12 #define EAP_PSK_PSK_LEN 16
13 #define EAP_PSK_AK_LEN 16
14 #define EAP_PSK_KDK_LEN 16
15 
16 #define EAP_PSK_R_FLAG_CONT 1
17 #define EAP_PSK_R_FLAG_DONE_SUCCESS 2
18 #define EAP_PSK_R_FLAG_DONE_FAILURE 3
19 #define EAP_PSK_E_FLAG 0x20
20 
21 #define EAP_PSK_FLAGS_GET_T(flags) (((flags) & 0xc0) >> 6)
22 #define EAP_PSK_FLAGS_SET_T(t) ((u8) (t) << 6)
23 
24 #ifdef _MSC_VER
25 #pragma pack(push, 1)
26 #endif /* _MSC_VER */
27 
28 /* EAP-PSK First Message (AS -> Supplicant) */
29 struct eap_psk_hdr_1 {
30  u8 flags;
31  u8 rand_s[EAP_PSK_RAND_LEN];
32  /* Followed by variable length ID_S */
33 } STRUCT_PACKED;
34 
35 /* EAP-PSK Second Message (Supplicant -> AS) */
36 struct eap_psk_hdr_2 {
37  u8 flags;
38  u8 rand_s[EAP_PSK_RAND_LEN];
39  u8 rand_p[EAP_PSK_RAND_LEN];
40  u8 mac_p[EAP_PSK_MAC_LEN];
41  /* Followed by variable length ID_P */
42 } STRUCT_PACKED;
43 
44 /* EAP-PSK Third Message (AS -> Supplicant) */
45 struct eap_psk_hdr_3 {
46  u8 flags;
47  u8 rand_s[EAP_PSK_RAND_LEN];
48  u8 mac_s[EAP_PSK_MAC_LEN];
49  /* Followed by variable length PCHANNEL */
50 } STRUCT_PACKED;
51 
52 /* EAP-PSK Fourth Message (Supplicant -> AS) */
53 struct eap_psk_hdr_4 {
54  u8 flags;
55  u8 rand_s[EAP_PSK_RAND_LEN];
56  /* Followed by variable length PCHANNEL */
57 } STRUCT_PACKED;
58 
59 #ifdef _MSC_VER
60 #pragma pack(pop)
61 #endif /* _MSC_VER */
62 
63 
64 int __must_check eap_psk_key_setup(const u8 *psk, u8 *ak, u8 *kdk);
65 int __must_check eap_psk_derive_keys(const u8 *kdk, const u8 *rand_p, u8 *tek,
66  u8 *msk, u8 *emsk);
67 
68 #endif /* EAP_PSK_COMMON_H */
Definition: eap_psk_common.h:36
Definition: eap_psk_common.h:45
Definition: eap_psk_common.h:29
Definition: eap_psk_common.h:53