44 static const u8 RSN_CIPHER_SUITE_NONE[] = {0x00, 0x0f, 0xac, 0};
45 static const u8 RSN_CIPHER_SUITE_WEP40[] = {0x00, 0x0f, 0xac, 1};
46 static const u8 RSN_CIPHER_SUITE_TKIP[] = {0x00, 0x0f, 0xac, 2};
47 static const u8 RSN_CIPHER_SUITE_CCMP[] = {0x00, 0x0f, 0xac, 4};
48 static const u8 RSN_CIPHER_SUITE_WEP104[] = {0x00, 0x0f, 0xac, 5};
55 static u8 WIFI_CCKRATES[] = {
62 static u8 WIFI_OFDMRATES[] = {
77 while (rate[i] != 0) {
78 if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) ||
79 (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22))
90 while (rate[i] != 0) {
91 if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
92 (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22))
103 *(pbuf + 1) = (
u8)
len;
105 memcpy((
void *)(pbuf + 2), (
void *)source, len);
106 *frlen = *frlen + (len + 2);
107 return pbuf + len + 2;
138 static void set_supported_rate(
u8 *SupportedRates,
uint mode)
143 memcpy(SupportedRates, WIFI_CCKRATES,
148 memcpy(SupportedRates, WIFI_OFDMRATES,
159 static uint r8712_get_rateset_len(
u8 *rateset)
164 if ((rateset[i]) == 0)
177 u8 *ie = pdev_network->
IEs;
197 pdev_network->
Ssid.Ssid, &sz);
223 unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
230 if (
memcmp((pbuf + 2), wpa_oui_type,
231 sizeof(wpa_oui_type)))
234 memcpy((
u8 *)&val16, (pbuf + 6),
sizeof(val16));
238 *wpa_ie_len = *(pbuf + 1);
245 limit = limit - (pbuf - pie) - 2 - len;
259 static int r8712_get_wpa_cipher_suite(
u8 *
s)
274 static int r8712_get_wpa2_cipher_suite(
u8 *s)
290 int *pairwise_cipher)
296 if (wpa_ie_len <= 0) {
300 if ((*wpa_ie !=
_WPA_IE_ID_) || (*(wpa_ie + 1) != (
u8)(wpa_ie_len - 2))
305 left = wpa_ie_len - 8;
308 *group_cipher = r8712_get_wpa_cipher_suite(pos);
320 for (i = 0; i <
count; i++) {
321 *pairwise_cipher |= r8712_get_wpa_cipher_suite(pos);
325 }
else if (left == 1)
331 int *pairwise_cipher)
337 if (rsn_ie_len <= 0) {
341 if ((*rsn_ie !=
_WPA2_IE_ID_) || (*(rsn_ie+1) != (
u8)(rsn_ie_len - 2)))
345 left = rsn_ie_len - 4;
348 *group_cipher = r8712_get_wpa2_cipher_suite(pos);
360 for (i = 0; i <
count; i++) {
361 *pairwise_cipher |= r8712_get_wpa2_cipher_suite(pos);
365 }
else if (left == 1)
371 u8 *wpa_ie,
u16 *wpa_len)
373 u8 authmode, sec_idx;
374 u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
380 while (cnt < in_len) {
381 authmode = in_ie[
cnt];
383 (!
memcmp(&in_ie[cnt + 2], &wpa_oui[0], 4))) {
384 memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
385 *wpa_len = in_ie[cnt+1]+2;
386 cnt += in_ie[cnt + 1] + 2;
389 memcpy(rsn_ie, &in_ie[cnt],
391 *rsn_len = in_ie[cnt+1] + 2;
392 cnt += in_ie[cnt+1] + 2;
394 cnt += in_ie[cnt+1] + 2;
397 return *rsn_len + *wpa_len;
404 u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
408 while (cnt < in_len) {
411 (!
memcmp(&in_ie[cnt+2], wps_oui, 4))) {
412 memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2);
413 *wps_ielen = in_ie[cnt+1]+2;
414 cnt += in_ie[cnt+1]+2;
418 cnt += in_ie[cnt+1]+2;