aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/rt2860/leap.h
blob: 6818c1ff4d7351947bb892821d531ee341033c7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
 *************************************************************************
 * Ralink Tech Inc.
 * 5F., No.36, Taiyuan St., Jhubei City,
 * Hsinchu County 302,
 * Taiwan, R.O.C.
 *
 * (c) Copyright 2002-2007, Ralink Technology, Inc.
 *
 * This program is free software; you can redistribute it and/or modify  *
 * it under the terms of the GNU General Public License as published by  *
 * the Free Software Foundation; either version 2 of the License, or     *
 * (at your option) any later version.                                   *
 *                                                                       *
 * This program is distributed in the hope that it will be useful,       *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 * GNU General Public License for more details.                          *
 *                                                                       *
 * You should have received a copy of the GNU General Public License     *
 * along with this program; if not, write to the                         *
 * Free Software Foundation, Inc.,                                       *
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 *                                                                       *
 *************************************************************************

	Module Name:
	leap.h

	Abstract:

	Revision History:
	Who			When			What
	--------	----------		----------------------------------------------
	Name		Date			Modification logs
*/
#ifndef __LEAP_H__
#define __LEAP_H__

// Messages for Associate state machine
#define LEAP_MACHINE_BASE                   30

#define LEAP_MSG_REQUEST_IDENTITY           31
#define LEAP_MSG_REQUEST_LEAP               32
#define LEAP_MSG_SUCCESS                    33
#define LEAP_MSG_FAILED                     34
#define LEAP_MSG_RESPONSE_LEAP              35
#define LEAP_MSG_EAPOLKEY                   36
#define LEAP_MSG_UNKNOWN                    37
#define LEAP_MSG                            38
//! assoc state-machine states
#define LEAP_IDLE                           0
#define LEAP_WAIT_IDENTITY_REQUEST          1
#define LEAP_WAIT_CHANLLENGE_REQUEST        2
#define LEAP_WAIT_SUCCESS                   3
#define LEAP_WAIT_CHANLLENGE_RESPONSE       4
#define LEAP_WAIT_EAPOLKEY                  5

#define LEAP_REASON_INVALID_AUTH                    0x01
#define LEAP_REASON_AUTH_TIMEOUT                    0x02
#define LEAP_REASON_CHALLENGE_FROM_AP_FAILED        0x03
#define LEAP_REASON_CHALLENGE_TO_AP_FAILED          0x04

#define CISCO_AuthModeLEAP                          0x80
#define CISCO_AuthModeLEAPNone                      0x00
#define LEAP_AUTH_TIMEOUT                           30000
#define LEAP_CHALLENGE_RESPONSE_LENGTH              24
#define LEAP_CHALLENGE_REQUEST_LENGTH               8

typedef struct _LEAP_EAPOL_HEADER_ {
    UCHAR       Version;
    UCHAR       Type;
    UCHAR       Length[2];
} LEAP_EAPOL_HEADER, *PLEAP_EAPOL_HEADER;

typedef struct _LEAP_EAPOL_PACKET_ {
    UCHAR       Code;
    UCHAR       Identifier;
    UCHAR       Length[2];
    UCHAR       Type;
} LEAP_EAPOL_PACKET, *PLEAP_EAPOL_PACKET;

typedef struct _LEAP_EAP_CONTENTS_ {
    UCHAR       Version;
    UCHAR       Reserved;
    UCHAR       Length;
} LEAP_EAP_CONTENTS, *PLEAP_EAP_CONTENTS;

/*** EAPOL key ***/
typedef struct _EAPOL_KEY_HEADER_ {
    UCHAR       Type;
    UCHAR       Length[2];
    UCHAR       Counter[8];
    UCHAR       IV[16];
    UCHAR       Index;
    UCHAR       Signature[16];
} EAPOL_KEY_HEADER, *PEAPOL_KEY_HEADER;

BOOLEAN LeapMsgTypeSubst(
    IN  UCHAR   EAPType,
    OUT ULONG   *MsgType);

VOID LeapMachinePerformAction(
    IN PRTMP_ADAPTER    pAd,
    IN STATE_MACHINE    *S,
    IN MLME_QUEUE_ELEM  *Elem);

VOID LeapMacHeaderInit(
    IN  PRTMP_ADAPTER       pAd,
    IN  OUT PHEADER_802_11  pHdr80211,
    IN  UCHAR               wep,
    IN  PUCHAR              pAddr3);

VOID LeapStartAction(
    IN PRTMP_ADAPTER    pAd,
    IN MLME_QUEUE_ELEM  *Elem);

VOID LeapIdentityAction(
    IN PRTMP_ADAPTER    pAd,
    IN MLME_QUEUE_ELEM  *Elem);

VOID LeapPeerChallengeAction(
    IN PRTMP_ADAPTER    pAd,
    IN MLME_QUEUE_ELEM  *Elem);

VOID HashPwd(
    IN  PUCHAR  pwd,
    IN  INT     pwdlen,
    OUT PUCHAR  hash);

VOID PeerChallengeResponse(
    IN  PUCHAR  szChallenge,
    IN  PUCHAR  smbPasswd,
    OUT PUCHAR  szResponse);

VOID ParityKey(
    OUT PUCHAR  szOut,
    IN  PUCHAR  szIn);

VOID DesKey(
    OUT ULONG   k[16][2],
    IN  PUCHAR  key,
    IN  INT     decrypt);

VOID Des(
    IN  ULONG   ks[16][2],
    OUT UCHAR   block[8]);

VOID DesEncrypt(
    IN  PUCHAR  szClear,
    IN  PUCHAR  szKey,
    OUT PUCHAR  szOut);

VOID LeapNetworkChallengeAction(
    IN PRTMP_ADAPTER    pAd,
    IN MLME_QUEUE_ELEM  *Elem);

VOID LeapNetworkChallengeResponse(
    IN PRTMP_ADAPTER    pAd,
    IN MLME_QUEUE_ELEM  *Elem);

VOID HashpwdHash(
    IN  PUCHAR  hash,
    IN  PUCHAR  hashhash);

VOID ProcessSessionKey(
    OUT PUCHAR  SessionKey,
    IN  PUCHAR  hash2,
    IN  PUCHAR  ChallengeToRadius,
    IN  PUCHAR  ChallengeResponseFromRadius,
    IN  PUCHAR  ChallengeFromRadius,
    IN  PUCHAR  ChallengeResponseToRadius);

VOID LeapEapolKeyAction(
    IN PRTMP_ADAPTER    pAd,
    IN MLME_QUEUE_ELEM  *Elem);

VOID RogueApTableInit(
    IN ROGUEAP_TABLE    *Tab);

ULONG RogueApTableSearch(
    IN ROGUEAP_TABLE    *Tab,
    IN PUCHAR           pAddr);

VOID RogueApEntrySet(
    IN  PRTMP_ADAPTER   pAd,
    OUT ROGUEAP_ENTRY   *pRogueAp,
    IN PUCHAR           pAddr,
    IN UCHAR            FaileCode);

ULONG RogueApTableSetEntry(
    IN  PRTMP_ADAPTER   pAd,
    OUT ROGUEAP_TABLE  *Tab,
    IN PUCHAR           pAddr,
    IN UCHAR            FaileCode);

VOID RogueApTableDeleteEntry(
    IN OUT ROGUEAP_TABLE *Tab,
    IN PUCHAR          pAddr);

VOID LeapAuthTimeout(
    IN PVOID SystemSpecific1,
    IN PVOID FunctionContext,
    IN PVOID SystemSpecific2,
    IN PVOID SystemSpecific3);

VOID LeapSendRogueAPReport(
    IN  PRTMP_ADAPTER   pAd);

BOOLEAN CCKMAssocRspSanity(
    IN PRTMP_ADAPTER    pAd,
    IN VOID             *Msg,
    IN ULONG            MsgLen);

#endif  // __LEAP_H__