1 /* 2 ************************************************************************* 3 * Ralink Tech Inc. 4 * 5F., No.36, Taiyuan St., Jhubei City, 5 * Hsinchu County 302, 6 * Taiwan, R.O.C. 7 * 8 * (c) Copyright 2002-2007, Ralink Technology, Inc. 9 * 10 * This program is free software; you can redistribute it and/or modify * 11 * it under the terms of the GNU General Public License as published by * 12 * the Free Software Foundation; either version 2 of the License, or * 13 * (at your option) any later version. * 14 * * 15 * This program is distributed in the hope that it will be useful, * 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 18 * GNU General Public License for more details. * 19 * * 20 * You should have received a copy of the GNU General Public License * 21 * along with this program; if not, write to the * 22 * Free Software Foundation, Inc., * 23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 24 * * 25 ************************************************************************* 26 27 Module Name: 28 leap.h 29 30 Abstract: 31 32 Revision History: 33 Who When What 34 -------- ---------- ---------------------------------------------- 35 Name Date Modification logs 36 */ 37 #ifndef __LEAP_H__ 38 #define __LEAP_H__ 39 40 // Messages for Associate state machine 41 #define LEAP_MACHINE_BASE 30 42 43 #define LEAP_MSG_REQUEST_IDENTITY 31 44 #define LEAP_MSG_REQUEST_LEAP 32 45 #define LEAP_MSG_SUCCESS 33 46 #define LEAP_MSG_FAILED 34 47 #define LEAP_MSG_RESPONSE_LEAP 35 48 #define LEAP_MSG_EAPOLKEY 36 49 #define LEAP_MSG_UNKNOWN 37 50 #define LEAP_MSG 38 51 //! assoc state-machine states 52 #define LEAP_IDLE 0 53 #define LEAP_WAIT_IDENTITY_REQUEST 1 54 #define LEAP_WAIT_CHANLLENGE_REQUEST 2 55 #define LEAP_WAIT_SUCCESS 3 56 #define LEAP_WAIT_CHANLLENGE_RESPONSE 4 57 #define LEAP_WAIT_EAPOLKEY 5 58 59 #define LEAP_REASON_INVALID_AUTH 0x01 60 #define LEAP_REASON_AUTH_TIMEOUT 0x02 61 #define LEAP_REASON_CHALLENGE_FROM_AP_FAILED 0x03 62 #define LEAP_REASON_CHALLENGE_TO_AP_FAILED 0x04 63 64 #define CISCO_AuthModeLEAP 0x80 65 #define CISCO_AuthModeLEAPNone 0x00 66 #define LEAP_AUTH_TIMEOUT 30000 67 #define LEAP_CHALLENGE_RESPONSE_LENGTH 24 68 #define LEAP_CHALLENGE_REQUEST_LENGTH 8 69 70 typedef struct _LEAP_EAPOL_HEADER_ { 71 UCHAR Version; 72 UCHAR Type; 73 UCHAR Length[2]; 74 } LEAP_EAPOL_HEADER, *PLEAP_EAPOL_HEADER; 75 76 typedef struct _LEAP_EAPOL_PACKET_ { 77 UCHAR Code; 78 UCHAR Identifier; 79 UCHAR Length[2]; 80 UCHAR Type; 81 } LEAP_EAPOL_PACKET, *PLEAP_EAPOL_PACKET; 82 83 typedef struct _LEAP_EAP_CONTENTS_ { 84 UCHAR Version; 85 UCHAR Reserved; 86 UCHAR Length; 87 } LEAP_EAP_CONTENTS, *PLEAP_EAP_CONTENTS; 88 89 /*** EAPOL key ***/ 90 typedef struct _EAPOL_KEY_HEADER_ { 91 UCHAR Type; 92 UCHAR Length[2]; 93 UCHAR Counter[8]; 94 UCHAR IV[16]; 95 UCHAR Index; 96 UCHAR Signature[16]; 97 } EAPOL_KEY_HEADER, *PEAPOL_KEY_HEADER; 98 99 BOOLEAN LeapMsgTypeSubst( 100 IN UCHAR EAPType, 101 OUT ULONG *MsgType); 102 103 VOID LeapMachinePerformAction( 104 IN PRTMP_ADAPTER pAd, 105 IN STATE_MACHINE *S, 106 IN MLME_QUEUE_ELEM *Elem); 107 108 VOID LeapMacHeaderInit( 109 IN PRTMP_ADAPTER pAd, 110 IN OUT PHEADER_802_11 pHdr80211, 111 IN UCHAR wep, 112 IN PUCHAR pAddr3); 113 114 VOID LeapStartAction( 115 IN PRTMP_ADAPTER pAd, 116 IN MLME_QUEUE_ELEM *Elem); 117 118 VOID LeapIdentityAction( 119 IN PRTMP_ADAPTER pAd, 120 IN MLME_QUEUE_ELEM *Elem); 121 122 VOID LeapPeerChallengeAction( 123 IN PRTMP_ADAPTER pAd, 124 IN MLME_QUEUE_ELEM *Elem); 125 126 VOID HashPwd( 127 IN PUCHAR pwd, 128 IN INT pwdlen, 129 OUT PUCHAR hash); 130 131 VOID PeerChallengeResponse( 132 IN PUCHAR szChallenge, 133 IN PUCHAR smbPasswd, 134 OUT PUCHAR szResponse); 135 136 VOID ParityKey( 137 OUT PUCHAR szOut, 138 IN PUCHAR szIn); 139 140 VOID DesKey( 141 OUT ULONG k[16][2], 142 IN PUCHAR key, 143 IN INT decrypt); 144 145 VOID Des( 146 IN ULONG ks[16][2], 147 OUT UCHAR block[8]); 148 149 VOID DesEncrypt( 150 IN PUCHAR szClear, 151 IN PUCHAR szKey, 152 OUT PUCHAR szOut); 153 154 VOID LeapNetworkChallengeAction( 155 IN PRTMP_ADAPTER pAd, 156 IN MLME_QUEUE_ELEM *Elem); 157 158 VOID LeapNetworkChallengeResponse( 159 IN PRTMP_ADAPTER pAd, 160 IN MLME_QUEUE_ELEM *Elem); 161 162 VOID HashpwdHash( 163 IN PUCHAR hash, 164 IN PUCHAR hashhash); 165 166 VOID ProcessSessionKey( 167 OUT PUCHAR SessionKey, 168 IN PUCHAR hash2, 169 IN PUCHAR ChallengeToRadius, 170 IN PUCHAR ChallengeResponseFromRadius, 171 IN PUCHAR ChallengeFromRadius, 172 IN PUCHAR ChallengeResponseToRadius); 173 174 VOID LeapEapolKeyAction( 175 IN PRTMP_ADAPTER pAd, 176 IN MLME_QUEUE_ELEM *Elem); 177 178 VOID RogueApTableInit( 179 IN ROGUEAP_TABLE *Tab); 180 181 ULONG RogueApTableSearch( 182 IN ROGUEAP_TABLE *Tab, 183 IN PUCHAR pAddr); 184 185 VOID RogueApEntrySet( 186 IN PRTMP_ADAPTER pAd, 187 OUT ROGUEAP_ENTRY *pRogueAp, 188 IN PUCHAR pAddr, 189 IN UCHAR FaileCode); 190 191 ULONG RogueApTableSetEntry( 192 IN PRTMP_ADAPTER pAd, 193 OUT ROGUEAP_TABLE *Tab, 194 IN PUCHAR pAddr, 195 IN UCHAR FaileCode); 196 197 VOID RogueApTableDeleteEntry( 198 IN OUT ROGUEAP_TABLE *Tab, 199 IN PUCHAR pAddr); 200 201 VOID LeapAuthTimeout( 202 IN PVOID SystemSpecific1, 203 IN PVOID FunctionContext, 204 IN PVOID SystemSpecific2, 205 IN PVOID SystemSpecific3); 206 207 VOID LeapSendRogueAPReport( 208 IN PRTMP_ADAPTER pAd); 209 210 BOOLEAN CCKMAssocRspSanity( 211 IN PRTMP_ADAPTER pAd, 212 IN VOID *Msg, 213 IN ULONG MsgLen); 214 215 #endif // __LEAP_H__ 216