MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / net / wireless / rtlink.org / wpa.h
blobce460e08a65396a52979df8f596bbee4a0b3839e
1 /*
2 ***************************************************************************
3 * Ralink Tech Inc.
4 * 4F, No. 2 Technology 5th Rd.
5 * Science-based Industrial Park
6 * Hsin-chu, Taiwan, R.O.C.
8 * (c) Copyright 2002, Ralink Technology, Inc.
10 * All rights reserved. Ralink's source code is an unpublished work and the
11 * use of a copyright notice does not imply otherwise. This source code
12 * contains confidential trade secret material of Ralink Tech. Any attemp
13 * or participation in deciphering, decoding, reverse engineering or in any
14 * way altering the source code is stricitly prohibited, unless the prior
15 * written consent of Ralink Technology, Inc. is obtained.
16 ***************************************************************************
18 Module Name:
19 wpa.h
21 Abstract:
23 Revision History:
24 Who When What
25 -------- ---------- ----------------------------------------------
26 Name Date Modification logs
29 #ifndef __WPA_H__
30 #define __WPA_H__
32 //Messages for the wpa state machine,
33 #define WPA_MACHINE_BASE 21
34 #define EAP_MSG_TYPE_EAPPacket 21
35 #define EAP_MSG_TYPE_EAPOLStart 22
36 #define EAP_MSG_TYPE_EAPOLLogoff 23
37 #define EAP_MSG_TYPE_EAPOLKey 24
38 #define EAP_MSG_TYPE_EAPOLASFAlert 25
39 #define MAX_WPA_PSK_MSG 5
41 // WpaPsk EAPOL Key descripter frame format related length
42 #define LEN_KEY_DESC_NONCE 32
43 #define LEN_KEY_DESC_IV 16
44 #define LEN_KEY_DESC_RSC 8
45 #define LEN_KEY_DESC_ID 8
46 #define LEN_KEY_DESC_REPLAY 8
47 #define LEN_KEY_DESC_MIC 16
49 //EPA VERSION
50 #define EAPOL_VER 1
51 #define DESC_TYPE_TKIP 1
52 #define DESC_TYPE_AES 2
53 #define RSN_KEY_DESC 0xfe
55 #define LEN_MASTER_KEY 32
57 // EAPOL EK, MK
58 #define LEN_EAP_EK 16
59 #define LEN_EAP_MICK 16
60 #define LEN_EAP_KEY ((LEN_EAP_EK)+(LEN_EAP_MICK))
61 // TKIP key related
62 #define LEN_TKIP_EK 16
63 #define LEN_TKIP_RXMICK 8
64 #define LEN_TKIP_TXMICK 8
65 #define LEN_AES_EK 16
66 #define LEN_AES_KEY LEN_AES_EK
67 #define LEN_TKIP_KEY ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
68 #define TKIP_AP_TXMICK_OFFSET ((LEN_EAP_KEY)+(LEN_TKIP_EK))
69 #define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK)
70 #define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
71 #define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY))
72 #define MAX_LEN_OF_RSNIE 48
74 //EAP Packet Type
75 #define EAPPacket 0
76 #define EAPOLStart 1
77 #define EAPOLLogoff 2
78 #define EAPOLKey 3
79 #define EAPOLASFAlert 4
80 #define EAPTtypeMax 5
82 #define EAPOL_MSG_INVALID 0
83 #define EAPOL_PAIR_MSG_1 1
84 #define EAPOL_PAIR_MSG_3 2
85 #define EAPOL_GROUP_MSG_1 3
87 // EAPOL Key Information definition within Key descriptor format
88 typedef struct PACKED _KEY_INFO
90 #ifdef BIG_ENDIAN
91 UCHAR KeyAck:1;
92 UCHAR Install:1;
93 UCHAR KeyIndex:2;
94 UCHAR KeyType:1;
95 UCHAR KeyDescVer:3;
96 UCHAR Rsvd:3;
97 UCHAR DL:1;
98 UCHAR Request:1;
99 UCHAR Error:1;
100 UCHAR Secure:1;
101 UCHAR KeyMic:1;
102 #else
103 UCHAR KeyMic:1;
104 UCHAR Secure:1;
105 UCHAR Error:1;
106 UCHAR Request:1;
107 UCHAR DL:1;
108 UCHAR Rsvd:3;
109 UCHAR KeyDescVer:3;
110 UCHAR KeyType:1;
111 UCHAR KeyIndex:2;
112 UCHAR Install:1;
113 UCHAR KeyAck:1;
114 #endif
115 } KEY_INFO, *PKEY_INFO;
117 // EAPOL Key descriptor format
118 typedef struct PACKED _KEY_DESCRIPTER
120 UCHAR Type;
121 KEY_INFO KeyInfo;
122 UCHAR KeyLength[2];
123 UCHAR ReplayCounter[LEN_KEY_DESC_REPLAY];
124 UCHAR KeyNonce[LEN_KEY_DESC_NONCE];
125 UCHAR KeyIv[LEN_KEY_DESC_IV];
126 UCHAR KeyRsc[LEN_KEY_DESC_RSC];
127 UCHAR KeyId[LEN_KEY_DESC_ID];
128 UCHAR KeyMic[LEN_KEY_DESC_MIC];
129 UCHAR KeyDataLen[2];
130 UCHAR KeyData[MAX_LEN_OF_RSNIE];
131 } KEY_DESCRIPTER, *PKEY_DESCRIPTER;
133 typedef struct PACKED _EAPOL_PACKET
135 UCHAR Version;
136 UCHAR Type;
137 UCHAR Len[2];
138 KEY_DESCRIPTER KeyDesc;
139 } EAPOL_PACKET, *PEAPOL_PACKET;
141 // For supplicant state machine states. 802.11i Draft 4.1, p. 97
142 // We simplified it
143 typedef enum _WpaState
145 SS_NOTUSE, // 0
146 SS_START, // 1
147 SS_WAIT_MSG_3, // 2
148 SS_WAIT_GROUP, // 3
149 SS_FINISH, // 4
150 SS_KEYUPDATE, // 5
151 } WPA_STATE;
153 #endif