1 /*************************************************************************
3 * 4F, No. 2 Technology 5th Rd. *
4 * Science-based Industrial Park *
5 * Hsin-chu, Taiwan, R.O.C. *
7 * (c) Copyright 2002, Ralink Technology, Inc. *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17 * GNU General Public License for more details. *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, write to the *
21 * Free Software Foundation, Inc., *
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 *************************************************************************
34 -------- ---------- ----------------------------------------------
35 Name Date Modification logs
41 //Messages for the wpa state machine,
42 #define WPA_MACHINE_BASE 21
43 #define EAP_MSG_TYPE_EAPPacket 21
44 #define EAP_MSG_TYPE_EAPOLStart 22
45 #define EAP_MSG_TYPE_EAPOLLogoff 23
46 #define EAP_MSG_TYPE_EAPOLKey 24
47 #define EAP_MSG_TYPE_EAPOLASFAlert 25
48 #define MAX_WPA_PSK_MSG 5
50 // WpaPsk EAPOL Key descripter frame format related length
51 #define LEN_KEY_DESC_NONCE 32
52 #define LEN_KEY_DESC_IV 16
53 #define LEN_KEY_DESC_RSC 8
54 #define LEN_KEY_DESC_ID 8
55 #define LEN_KEY_DESC_REPLAY 8
56 #define LEN_KEY_DESC_MIC 16
60 #define DESC_TYPE_TKIP 1
61 #define DESC_TYPE_AES 2
62 #define RSN_KEY_DESC 0xfe
64 #define LEN_MASTER_KEY 32
68 #define LEN_EAP_MICK 16
69 #define LEN_EAP_KEY ((LEN_EAP_EK)+(LEN_EAP_MICK))
71 #define LEN_TKIP_EK 16
72 #define LEN_TKIP_RXMICK 8
73 #define LEN_TKIP_TXMICK 8
75 #define LEN_AES_KEY LEN_AES_EK
76 #define LEN_TKIP_KEY ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
77 #define TKIP_AP_TXMICK_OFFSET ((LEN_EAP_KEY)+(LEN_TKIP_EK))
78 #define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK)
79 #define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
80 #define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY))
81 #define MAX_LEN_OF_RSNIE 48
88 #define EAPOLASFAlert 4
91 #define EAPOL_MSG_INVALID 0
92 #define EAPOL_PAIR_MSG_1 1
93 #define EAPOL_PAIR_MSG_3 2
94 #define EAPOL_GROUP_MSG_1 3
96 // EAPOL Key Information definition within Key descriptor format
97 typedef struct PACKED _KEY_INFO
124 } KEY_INFO
, *PKEY_INFO
;
126 // EAPOL Key descriptor format
127 typedef struct PACKED _KEY_DESCRIPTER
132 UCHAR ReplayCounter
[LEN_KEY_DESC_REPLAY
];
133 UCHAR KeyNonce
[LEN_KEY_DESC_NONCE
];
134 UCHAR KeyIv
[LEN_KEY_DESC_IV
];
135 UCHAR KeyRsc
[LEN_KEY_DESC_RSC
];
136 UCHAR KeyId
[LEN_KEY_DESC_ID
];
137 UCHAR KeyMic
[LEN_KEY_DESC_MIC
];
139 UCHAR KeyData
[MAX_LEN_OF_RSNIE
];
140 } KEY_DESCRIPTER
, *PKEY_DESCRIPTER
;
142 typedef struct PACKED _EAPOL_PACKET
147 KEY_DESCRIPTER KeyDesc
;
148 } EAPOL_PACKET
, *PEAPOL_PACKET
;
150 // For supplicant state machine states. 802.11i Draft 4.1, p. 97
152 typedef enum _WpaState