mirror of
https://github.com/torvalds/linux.git
synced 2024-12-17 08:31:39 +00:00
staging:vt6655:wpa2: Whitespace cleanups
Neatening only. git diff -w shows no differences. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f0c35239af
commit
3e28383f2d
@ -36,7 +36,7 @@
|
|||||||
#include "wmgr.h"
|
#include "wmgr.h"
|
||||||
|
|
||||||
/*--------------------- Static Definitions -------------------------*/
|
/*--------------------- Static Definitions -------------------------*/
|
||||||
static int msglevel =MSG_LEVEL_INFO;
|
static int msglevel = MSG_LEVEL_INFO;
|
||||||
//static int msglevel =MSG_LEVEL_DEBUG;
|
//static int msglevel =MSG_LEVEL_DEBUG;
|
||||||
/*--------------------- Static Classes ----------------------------*/
|
/*--------------------- Static Classes ----------------------------*/
|
||||||
|
|
||||||
@ -71,25 +71,25 @@ const unsigned char abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 };
|
|||||||
*
|
*
|
||||||
* Return Value: none.
|
* Return Value: none.
|
||||||
*
|
*
|
||||||
-*/
|
-*/
|
||||||
void
|
void
|
||||||
WPA2_ClearRSN (
|
WPA2_ClearRSN(
|
||||||
PKnownBSS pBSSNode
|
PKnownBSS pBSSNode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
pBSSNode->bWPA2Valid = false;
|
pBSSNode->bWPA2Valid = false;
|
||||||
|
|
||||||
pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP;
|
pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP;
|
||||||
for (ii=0; ii < 4; ii ++)
|
for (ii = 0; ii < 4; ii++)
|
||||||
pBSSNode->abyCSSPK[ii] = WLAN_11i_CSS_CCMP;
|
pBSSNode->abyCSSPK[ii] = WLAN_11i_CSS_CCMP;
|
||||||
pBSSNode->wCSSPKCount = 1;
|
pBSSNode->wCSSPKCount = 1;
|
||||||
for (ii=0; ii < 4; ii ++)
|
for (ii = 0; ii < 4; ii++)
|
||||||
pBSSNode->abyAKMSSAuthType[ii] = WLAN_11i_AKMSS_802_1X;
|
pBSSNode->abyAKMSSAuthType[ii] = WLAN_11i_AKMSS_802_1X;
|
||||||
pBSSNode->wAKMSSAuthCount = 1;
|
pBSSNode->wAKMSSAuthCount = 1;
|
||||||
pBSSNode->sRSNCapObj.bRSNCapExist = false;
|
pBSSNode->sRSNCapObj.bRSNCapExist = false;
|
||||||
pBSSNode->sRSNCapObj.wRSNCap = 0;
|
pBSSNode->sRSNCapObj.wRSNCap = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*+
|
/*+
|
||||||
@ -106,144 +106,144 @@ WPA2_ClearRSN (
|
|||||||
*
|
*
|
||||||
* Return Value: none.
|
* Return Value: none.
|
||||||
*
|
*
|
||||||
-*/
|
-*/
|
||||||
void
|
void
|
||||||
WPA2vParseRSN (
|
WPA2vParseRSN(
|
||||||
PKnownBSS pBSSNode,
|
PKnownBSS pBSSNode,
|
||||||
PWLAN_IE_RSN pRSN
|
PWLAN_IE_RSN pRSN
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned short m = 0, n = 0;
|
unsigned short m = 0, n = 0;
|
||||||
unsigned char *pbyOUI;
|
unsigned char *pbyOUI;
|
||||||
bool bUseGK = false;
|
bool bUseGK = false;
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"WPA2_ParseRSN: [%d]\n", pRSN->len);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WPA2_ParseRSN: [%d]\n", pRSN->len);
|
||||||
|
|
||||||
WPA2_ClearRSN(pBSSNode);
|
WPA2_ClearRSN(pBSSNode);
|
||||||
|
|
||||||
if (pRSN->len == 2) { // ver(2)
|
if (pRSN->len == 2) { // ver(2)
|
||||||
if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) {
|
if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) {
|
||||||
pBSSNode->bWPA2Valid = true;
|
pBSSNode->bWPA2Valid = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRSN->len < 6) { // ver(2) + GK(4)
|
if (pRSN->len < 6) { // ver(2) + GK(4)
|
||||||
// invalid CSS, P802.11i/D10.0, p31
|
// invalid CSS, P802.11i/D10.0, p31
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// information element header makes sense
|
// information element header makes sense
|
||||||
if ((pRSN->byElementID == WLAN_EID_RSN) &&
|
if ((pRSN->byElementID == WLAN_EID_RSN) &&
|
||||||
(pRSN->wVersion == 1)) {
|
(pRSN->wVersion == 1)) {
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Legal 802.11i RSN\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal 802.11i RSN\n");
|
||||||
|
|
||||||
pbyOUI = &(pRSN->abyRSN[0]);
|
pbyOUI = &(pRSN->abyRSN[0]);
|
||||||
if ( !memcmp(pbyOUI, abyOUIWEP40, 4))
|
if (!memcmp(pbyOUI, abyOUIWEP40, 4))
|
||||||
pBSSNode->byCSSGK = WLAN_11i_CSS_WEP40;
|
pBSSNode->byCSSGK = WLAN_11i_CSS_WEP40;
|
||||||
else if ( !memcmp(pbyOUI, abyOUITKIP, 4))
|
else if (!memcmp(pbyOUI, abyOUITKIP, 4))
|
||||||
pBSSNode->byCSSGK = WLAN_11i_CSS_TKIP;
|
pBSSNode->byCSSGK = WLAN_11i_CSS_TKIP;
|
||||||
else if ( !memcmp(pbyOUI, abyOUICCMP, 4))
|
else if (!memcmp(pbyOUI, abyOUICCMP, 4))
|
||||||
pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP;
|
pBSSNode->byCSSGK = WLAN_11i_CSS_CCMP;
|
||||||
else if ( !memcmp(pbyOUI, abyOUIWEP104, 4))
|
else if (!memcmp(pbyOUI, abyOUIWEP104, 4))
|
||||||
pBSSNode->byCSSGK = WLAN_11i_CSS_WEP104;
|
pBSSNode->byCSSGK = WLAN_11i_CSS_WEP104;
|
||||||
else if ( !memcmp(pbyOUI, abyOUIGK, 4)) {
|
else if (!memcmp(pbyOUI, abyOUIGK, 4)) {
|
||||||
// invalid CSS, P802.11i/D10.0, p32
|
// invalid CSS, P802.11i/D10.0, p32
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
// any vendor checks here
|
// any vendor checks here
|
||||||
pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN;
|
pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN;
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"802.11i CSS: %X\n", pBSSNode->byCSSGK);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "802.11i CSS: %X\n", pBSSNode->byCSSGK);
|
||||||
|
|
||||||
if (pRSN->len == 6) {
|
if (pRSN->len == 6) {
|
||||||
pBSSNode->bWPA2Valid = true;
|
pBSSNode->bWPA2Valid = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRSN->len >= 8) { // ver(2) + GK(4) + PK count(2)
|
if (pRSN->len >= 8) { // ver(2) + GK(4) + PK count(2)
|
||||||
pBSSNode->wCSSPKCount = *((unsigned short *) &(pRSN->abyRSN[4]));
|
pBSSNode->wCSSPKCount = *((unsigned short *)&(pRSN->abyRSN[4]));
|
||||||
j = 0;
|
j = 0;
|
||||||
pbyOUI = &(pRSN->abyRSN[6]);
|
pbyOUI = &(pRSN->abyRSN[6]);
|
||||||
|
|
||||||
for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char)); i++) {
|
for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char)); i++) {
|
||||||
|
|
||||||
if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i)
|
if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i)
|
||||||
if ( !memcmp(pbyOUI, abyOUIGK, 4)) {
|
if (!memcmp(pbyOUI, abyOUIGK, 4)) {
|
||||||
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP;
|
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP;
|
||||||
bUseGK = true;
|
bUseGK = true;
|
||||||
} else if ( !memcmp(pbyOUI, abyOUIWEP40, 4)) {
|
} else if (!memcmp(pbyOUI, abyOUIWEP40, 4)) {
|
||||||
// Invalid CSS, continue to parsing
|
// Invalid CSS, continue to parsing
|
||||||
} else if ( !memcmp(pbyOUI, abyOUITKIP, 4)) {
|
} else if (!memcmp(pbyOUI, abyOUITKIP, 4)) {
|
||||||
if (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP)
|
if (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP)
|
||||||
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_TKIP;
|
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_TKIP;
|
||||||
else
|
else
|
||||||
; // Invalid CSS, continue to parsing
|
; // Invalid CSS, continue to parsing
|
||||||
} else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) {
|
} else if (!memcmp(pbyOUI, abyOUICCMP, 4)) {
|
||||||
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP;
|
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP;
|
||||||
} else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) {
|
} else if (!memcmp(pbyOUI, abyOUIWEP104, 4)) {
|
||||||
// Invalid CSS, continue to parsing
|
// Invalid CSS, continue to parsing
|
||||||
} else {
|
} else {
|
||||||
// any vendor checks here
|
// any vendor checks here
|
||||||
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN;
|
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN;
|
||||||
}
|
}
|
||||||
pbyOUI += 4;
|
pbyOUI += 4;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]);
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
} //for
|
} //for
|
||||||
|
|
||||||
if (bUseGK == true) {
|
if (bUseGK == true) {
|
||||||
if (j != 1) {
|
if (j != 1) {
|
||||||
// invalid CSS, This should be only PK CSS.
|
// invalid CSS, This should be only PK CSS.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pBSSNode->byCSSGK == WLAN_11i_CSS_CCMP) {
|
if (pBSSNode->byCSSGK == WLAN_11i_CSS_CCMP) {
|
||||||
// invalid CSS, If CCMP is enable , PK can't be CSSGK.
|
// invalid CSS, If CCMP is enable , PK can't be CSSGK.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((pBSSNode->wCSSPKCount != 0) && (j == 0)) {
|
if ((pBSSNode->wCSSPKCount != 0) && (j == 0)) {
|
||||||
// invalid CSS, No valid PK.
|
// invalid CSS, No valid PK.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pBSSNode->wCSSPKCount = (unsigned short)j;
|
pBSSNode->wCSSPKCount = (unsigned short)j;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
m = *((unsigned short *) &(pRSN->abyRSN[4]));
|
m = *((unsigned short *)&(pRSN->abyRSN[4]));
|
||||||
|
|
||||||
if (pRSN->len >= 10+m*4) { // ver(2) + GK(4) + PK count(2) + PKS(4*m) + AKMSS count(2)
|
if (pRSN->len >= 10+m*4) { // ver(2) + GK(4) + PK count(2) + PKS(4*m) + AKMSS count(2)
|
||||||
pBSSNode->wAKMSSAuthCount = *((unsigned short *) &(pRSN->abyRSN[6+4*m]));
|
pBSSNode->wAKMSSAuthCount = *((unsigned short *)&(pRSN->abyRSN[6+4*m]));
|
||||||
j = 0;
|
j = 0;
|
||||||
pbyOUI = &(pRSN->abyRSN[8+4*m]);
|
pbyOUI = &(pRSN->abyRSN[8+4*m]);
|
||||||
for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(unsigned char)); i++) {
|
for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(unsigned char)); i++) {
|
||||||
if (pRSN->len >= 10+(m+i)*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSS(2)+AKS(4*i)
|
if (pRSN->len >= 10+(m+i)*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSS(2)+AKS(4*i)
|
||||||
if ( !memcmp(pbyOUI, abyOUI8021X, 4))
|
if (!memcmp(pbyOUI, abyOUI8021X, 4))
|
||||||
pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_802_1X;
|
pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_802_1X;
|
||||||
else if ( !memcmp(pbyOUI, abyOUIPSK, 4))
|
else if (!memcmp(pbyOUI, abyOUIPSK, 4))
|
||||||
pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_PSK;
|
pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_PSK;
|
||||||
else
|
else
|
||||||
// any vendor checks here
|
// any vendor checks here
|
||||||
pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN;
|
pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]);
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pBSSNode->wAKMSSAuthCount = (unsigned short)j;
|
pBSSNode->wAKMSSAuthCount = (unsigned short)j;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount);
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount);
|
||||||
|
|
||||||
n = *((unsigned short *) &(pRSN->abyRSN[6+4*m]));
|
n = *((unsigned short *)&(pRSN->abyRSN[6+4*m]));
|
||||||
if (pRSN->len >= 12+4*m+4*n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2)
|
if (pRSN->len >= 12 + 4 * m + 4 * n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2)
|
||||||
pBSSNode->sRSNCapObj.bRSNCapExist = true;
|
pBSSNode->sRSNCapObj.bRSNCapExist = true;
|
||||||
pBSSNode->sRSNCapObj.wRSNCap = *((unsigned short *) &(pRSN->abyRSN[8+4*m+4*n]));
|
pBSSNode->sRSNCapObj.wRSNCap = *((unsigned short *)&(pRSN->abyRSN[8+4*m+4*n]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//ignore PMKID lists bcs only (Re)Assocrequest has this field
|
//ignore PMKID lists bcs only (Re)Assocrequest has this field
|
||||||
pBSSNode->bWPA2Valid = true;
|
pBSSNode->bWPA2Valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -260,105 +260,105 @@ WPA2vParseRSN (
|
|||||||
*
|
*
|
||||||
* Return Value: length of IEs.
|
* Return Value: length of IEs.
|
||||||
*
|
*
|
||||||
-*/
|
-*/
|
||||||
unsigned int
|
unsigned int
|
||||||
WPA2uSetIEs(
|
WPA2uSetIEs(
|
||||||
void *pMgmtHandle,
|
void *pMgmtHandle,
|
||||||
PWLAN_IE_RSN pRSNIEs
|
PWLAN_IE_RSN pRSNIEs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
|
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
|
||||||
unsigned char *pbyBuffer = NULL;
|
unsigned char *pbyBuffer = NULL;
|
||||||
unsigned int ii = 0;
|
unsigned int ii = 0;
|
||||||
unsigned short *pwPMKID = NULL;
|
unsigned short *pwPMKID = NULL;
|
||||||
|
|
||||||
if (pRSNIEs == NULL) {
|
if (pRSNIEs == NULL) {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
|
if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
|
||||||
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) &&
|
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) &&
|
||||||
(pMgmt->pCurrBSS != NULL)) {
|
(pMgmt->pCurrBSS != NULL)) {
|
||||||
/* WPA2 IE */
|
/* WPA2 IE */
|
||||||
pbyBuffer = (unsigned char *) pRSNIEs;
|
pbyBuffer = (unsigned char *)pRSNIEs;
|
||||||
pRSNIEs->byElementID = WLAN_EID_RSN;
|
pRSNIEs->byElementID = WLAN_EID_RSN;
|
||||||
pRSNIEs->len = 6; //Version(2)+GK(4)
|
pRSNIEs->len = 6; //Version(2)+GK(4)
|
||||||
pRSNIEs->wVersion = 1;
|
pRSNIEs->wVersion = 1;
|
||||||
//Group Key Cipher Suite
|
//Group Key Cipher Suite
|
||||||
pRSNIEs->abyRSN[0] = 0x00;
|
pRSNIEs->abyRSN[0] = 0x00;
|
||||||
pRSNIEs->abyRSN[1] = 0x0F;
|
pRSNIEs->abyRSN[1] = 0x0F;
|
||||||
pRSNIEs->abyRSN[2] = 0xAC;
|
pRSNIEs->abyRSN[2] = 0xAC;
|
||||||
if (pMgmt->byCSSGK == KEY_CTL_WEP) {
|
if (pMgmt->byCSSGK == KEY_CTL_WEP) {
|
||||||
pRSNIEs->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK;
|
pRSNIEs->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK;
|
||||||
} else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
|
} else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
|
||||||
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_TKIP;
|
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_TKIP;
|
||||||
} else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
|
} else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
|
||||||
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_CCMP;
|
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_CCMP;
|
||||||
} else {
|
} else {
|
||||||
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_UNKNOWN;
|
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pairwise Key Cipher Suite
|
// Pairwise Key Cipher Suite
|
||||||
pRSNIEs->abyRSN[4] = 1;
|
pRSNIEs->abyRSN[4] = 1;
|
||||||
pRSNIEs->abyRSN[5] = 0;
|
pRSNIEs->abyRSN[5] = 0;
|
||||||
pRSNIEs->abyRSN[6] = 0x00;
|
pRSNIEs->abyRSN[6] = 0x00;
|
||||||
pRSNIEs->abyRSN[7] = 0x0F;
|
pRSNIEs->abyRSN[7] = 0x0F;
|
||||||
pRSNIEs->abyRSN[8] = 0xAC;
|
pRSNIEs->abyRSN[8] = 0xAC;
|
||||||
if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
|
if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
|
||||||
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_TKIP;
|
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_TKIP;
|
||||||
} else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
|
} else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
|
||||||
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_CCMP;
|
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_CCMP;
|
||||||
} else if (pMgmt->byCSSPK == KEY_CTL_NONE) {
|
} else if (pMgmt->byCSSPK == KEY_CTL_NONE) {
|
||||||
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_USE_GROUP;
|
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_USE_GROUP;
|
||||||
} else {
|
} else {
|
||||||
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_UNKNOWN;
|
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_UNKNOWN;
|
||||||
}
|
}
|
||||||
pRSNIEs->len += 6;
|
pRSNIEs->len += 6;
|
||||||
|
|
||||||
// Auth Key Management Suite
|
// Auth Key Management Suite
|
||||||
pRSNIEs->abyRSN[10] = 1;
|
pRSNIEs->abyRSN[10] = 1;
|
||||||
pRSNIEs->abyRSN[11] = 0;
|
pRSNIEs->abyRSN[11] = 0;
|
||||||
pRSNIEs->abyRSN[12] = 0x00;
|
pRSNIEs->abyRSN[12] = 0x00;
|
||||||
pRSNIEs->abyRSN[13] = 0x0F;
|
pRSNIEs->abyRSN[13] = 0x0F;
|
||||||
pRSNIEs->abyRSN[14] = 0xAC;
|
pRSNIEs->abyRSN[14] = 0xAC;
|
||||||
if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) {
|
if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) {
|
||||||
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_PSK;
|
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_PSK;
|
||||||
} else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
|
} else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
|
||||||
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_802_1X;
|
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_802_1X;
|
||||||
} else {
|
} else {
|
||||||
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN;
|
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN;
|
||||||
}
|
}
|
||||||
pRSNIEs->len +=6;
|
pRSNIEs->len += 6;
|
||||||
|
|
||||||
// RSN Capabilities
|
// RSN Capabilities
|
||||||
if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) {
|
if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) {
|
||||||
memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
|
memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
|
||||||
} else {
|
} else {
|
||||||
pRSNIEs->abyRSN[16] = 0;
|
pRSNIEs->abyRSN[16] = 0;
|
||||||
pRSNIEs->abyRSN[17] = 0;
|
pRSNIEs->abyRSN[17] = 0;
|
||||||
}
|
}
|
||||||
pRSNIEs->len +=2;
|
pRSNIEs->len += 2;
|
||||||
|
|
||||||
if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) &&
|
if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) &&
|
||||||
(pMgmt->bRoaming == true) &&
|
(pMgmt->bRoaming == true) &&
|
||||||
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
|
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
|
||||||
// RSN PMKID
|
// RSN PMKID
|
||||||
pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]); // Point to PMKID count
|
pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]); // Point to PMKID count
|
||||||
*pwPMKID = 0; // Initialize PMKID count
|
*pwPMKID = 0; // Initialize PMKID count
|
||||||
pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list
|
pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list
|
||||||
for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) {
|
for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) {
|
||||||
if ( !memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, ETH_ALEN)) {
|
if (!memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, ETH_ALEN)) {
|
||||||
(*pwPMKID) ++;
|
(*pwPMKID)++;
|
||||||
memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16);
|
memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16);
|
||||||
pbyBuffer += 16;
|
pbyBuffer += 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*pwPMKID != 0) {
|
if (*pwPMKID != 0) {
|
||||||
pRSNIEs->len += (2 + (*pwPMKID)*16);
|
pRSNIEs->len += (2 + (*pwPMKID)*16);
|
||||||
} else {
|
} else {
|
||||||
pbyBuffer = &pRSNIEs->abyRSN[18];
|
pbyBuffer = &pRSNIEs->abyRSN[18];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(pRSNIEs->len + WLAN_IEHDR_LEN);
|
return(pRSNIEs->len + WLAN_IEHDR_LEN);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -40,13 +40,13 @@
|
|||||||
#define MAX_PMKID_CACHE 16
|
#define MAX_PMKID_CACHE 16
|
||||||
|
|
||||||
typedef struct tagsPMKIDInfo {
|
typedef struct tagsPMKIDInfo {
|
||||||
unsigned char abyBSSID[6];
|
unsigned char abyBSSID[6];
|
||||||
unsigned char abyPMKID[16];
|
unsigned char abyPMKID[16];
|
||||||
} PMKIDInfo, *PPMKIDInfo;
|
} PMKIDInfo, *PPMKIDInfo;
|
||||||
|
|
||||||
typedef struct tagSPMKIDCache {
|
typedef struct tagSPMKIDCache {
|
||||||
unsigned long BSSIDInfoCount;
|
unsigned long BSSIDInfoCount;
|
||||||
PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
|
PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
|
||||||
} SPMKIDCache, *PSPMKIDCache;
|
} SPMKIDCache, *PSPMKIDCache;
|
||||||
|
|
||||||
|
|
||||||
@ -59,20 +59,20 @@ typedef struct tagSPMKIDCache {
|
|||||||
/*--------------------- Export Functions --------------------------*/
|
/*--------------------- Export Functions --------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
WPA2_ClearRSN (
|
WPA2_ClearRSN(
|
||||||
PKnownBSS pBSSNode
|
PKnownBSS pBSSNode
|
||||||
);
|
);
|
||||||
|
|
||||||
void
|
void
|
||||||
WPA2vParseRSN (
|
WPA2vParseRSN(
|
||||||
PKnownBSS pBSSNode,
|
PKnownBSS pBSSNode,
|
||||||
PWLAN_IE_RSN pRSN
|
PWLAN_IE_RSN pRSN
|
||||||
);
|
);
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
WPA2uSetIEs(
|
WPA2uSetIEs(
|
||||||
void *pMgmtHandle,
|
void *pMgmtHandle,
|
||||||
PWLAN_IE_RSN pRSNIEs
|
PWLAN_IE_RSN pRSNIEs
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // __WPA2_H__
|
#endif // __WPA2_H__
|
||||||
|
Loading…
Reference in New Issue
Block a user