Disconnect hostapd from building in base
[dragonfly.git] / contrib / hostapd / src / eap_common / eap_psk_common.h
CommitLineData
ebfa2275
SZ
1/*
2 * EAP server/peer: EAP-PSK shared routines
a875087d 3 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
ebfa2275 4 *
4781064b
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
ebfa2275
SZ
7 */
8
9#ifndef EAP_PSK_COMMON_H
10#define EAP_PSK_COMMON_H
11
12
13#define EAP_PSK_RAND_LEN 16
14#define EAP_PSK_MAC_LEN 16
15#define EAP_PSK_TEK_LEN 16
16#define EAP_PSK_PSK_LEN 16
17#define EAP_PSK_AK_LEN 16
18#define EAP_PSK_KDK_LEN 16
19
20#define EAP_PSK_R_FLAG_CONT 1
21#define EAP_PSK_R_FLAG_DONE_SUCCESS 2
22#define EAP_PSK_R_FLAG_DONE_FAILURE 3
23#define EAP_PSK_E_FLAG 0x20
24
25#define EAP_PSK_FLAGS_GET_T(flags) (((flags) & 0xc0) >> 6)
26#define EAP_PSK_FLAGS_SET_T(t) ((u8) (t) << 6)
27
28#ifdef _MSC_VER
29#pragma pack(push, 1)
30#endif /* _MSC_VER */
31
ebfa2275
SZ
32/* EAP-PSK First Message (AS -> Supplicant) */
33struct eap_psk_hdr_1 {
ebfa2275
SZ
34 u8 flags;
35 u8 rand_s[EAP_PSK_RAND_LEN];
36 /* Followed by variable length ID_S */
37} STRUCT_PACKED;
38
39/* EAP-PSK Second Message (Supplicant -> AS) */
40struct eap_psk_hdr_2 {
ebfa2275
SZ
41 u8 flags;
42 u8 rand_s[EAP_PSK_RAND_LEN];
43 u8 rand_p[EAP_PSK_RAND_LEN];
44 u8 mac_p[EAP_PSK_MAC_LEN];
45 /* Followed by variable length ID_P */
46} STRUCT_PACKED;
47
48/* EAP-PSK Third Message (AS -> Supplicant) */
49struct eap_psk_hdr_3 {
ebfa2275
SZ
50 u8 flags;
51 u8 rand_s[EAP_PSK_RAND_LEN];
52 u8 mac_s[EAP_PSK_MAC_LEN];
53 /* Followed by variable length PCHANNEL */
54} STRUCT_PACKED;
55
56/* EAP-PSK Fourth Message (Supplicant -> AS) */
57struct eap_psk_hdr_4 {
ebfa2275
SZ
58 u8 flags;
59 u8 rand_s[EAP_PSK_RAND_LEN];
60 /* Followed by variable length PCHANNEL */
61} STRUCT_PACKED;
62
63#ifdef _MSC_VER
64#pragma pack(pop)
65#endif /* _MSC_VER */
66
67
a875087d
JL
68int __must_check eap_psk_key_setup(const u8 *psk, u8 *ak, u8 *kdk);
69int __must_check eap_psk_derive_keys(const u8 *kdk, const u8 *rand_p, u8 *tek,
70 u8 *msk, u8 *emsk);
ebfa2275
SZ
71
72#endif /* EAP_PSK_COMMON_H */