2 * WPA Supplicant / EAP-PSK shared routines
3 * Copyright (c) 2004-2005, Jouni Malinen <jkmaline@cc.hut.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #ifndef EAP_PSK_COMMON_H
16 #define EAP_PSK_COMMON_H
19 #define EAP_PSK_RAND_LEN 16
20 #define EAP_PSK_MAC_LEN 16
21 #define EAP_PSK_TEK_LEN 16
22 #define EAP_PSK_MSK_LEN 64
23 #define EAP_PSK_PSK_LEN 16
24 #define EAP_PSK_AK_LEN 16
25 #define EAP_PSK_KDK_LEN 16
27 #define EAP_PSK_R_FLAG_CONT 1
28 #define EAP_PSK_R_FLAG_DONE_SUCCESS 2
29 #define EAP_PSK_R_FLAG_DONE_FAILURE 3
30 #define EAP_PSK_E_FLAG 0x20
32 /* Shared prefix for all EAP-PSK frames */
36 u16 length
; /* including code, identifier, and length */
37 u8 type
; /* EAP_TYPE_PSK */
39 } __attribute__ ((packed
));
41 /* EAP-PSK First Message (AS -> Supplicant) */
42 struct eap_psk_hdr_1
{
45 u16 length
; /* including code, identifier, and length */
46 u8 type
; /* EAP_TYPE_PSK */
48 u8 rand_s
[EAP_PSK_RAND_LEN
];
49 /* Followed by variable length ID_S */
50 } __attribute__ ((packed
));
52 /* EAP-PSK Second Message (Supplicant -> AS) */
53 struct eap_psk_hdr_2
{
56 u16 length
; /* including code, identifier, and length */
57 u8 type
; /* EAP_TYPE_PSK */
59 u8 rand_s
[EAP_PSK_RAND_LEN
];
60 u8 rand_p
[EAP_PSK_RAND_LEN
];
61 u8 mac_p
[EAP_PSK_MAC_LEN
];
62 /* Followed by variable length ID_P */
63 } __attribute__ ((packed
));
65 /* EAP-PSK Third Message (AS -> Supplicant) */
66 struct eap_psk_hdr_3
{
69 u16 length
; /* including code, identifier, and length */
70 u8 type
; /* EAP_TYPE_PSK */
72 u8 rand_s
[EAP_PSK_RAND_LEN
];
73 u8 mac_s
[EAP_PSK_MAC_LEN
];
74 /* Followed by variable length PCHANNEL */
75 } __attribute__ ((packed
));
77 /* EAP-PSK Fourth Message (Supplicant -> AS) */
78 struct eap_psk_hdr_4
{
81 u16 length
; /* including code, identifier, and length */
82 u8 type
; /* EAP_TYPE_PSK */
84 u8 rand_s
[EAP_PSK_RAND_LEN
];
85 /* Followed by variable length PCHANNEL */
86 } __attribute__ ((packed
));
89 void eap_psk_key_setup(const u8
*psk
, u8
*ak
, u8
*kdk
);
90 void eap_psk_derive_keys(const u8
*kdk
, const u8
*rand_p
, u8
*tek
, u8
*msk
);
92 #endif /* EAP_PSK_COMMON_H */