rtl8188eu: Remove dead code for CONFIG_TDLS

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-07-11 20:13:07 -05:00
parent 0e4009c999
commit e79535e153
23 changed files with 50 additions and 5135 deletions

View file

@ -1552,18 +1552,6 @@ _func_enter_;
{
prwskey=&stainfo->dot118021x_UncstKey.skey[0];
}
#ifdef CONFIG_TDLS /* swencryption */
{
struct sta_info *ptdls_sta;
ptdls_sta=rtw_get_stainfo(&padapter->stapriv ,&pattrib->dst[0] );
if ((ptdls_sta != NULL) && (ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE) )
{
DBG_88E("[%s] for tdls link\n", __func__);
prwskey=&ptdls_sta->tpk.tk[0];
}
}
#endif /* CONFIG_TDLS */
for (curfragnum=0;curfragnum<pattrib->nr_frags;curfragnum++){
if ((curfragnum+1)==pattrib->nr_frags){ /* 4 the last fragment */
@ -2640,176 +2628,6 @@ static int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
return omac1_aes_128_vector(key, 1, &data, &data_len, mac);
}
#ifdef CONFIG_TDLS
void wpa_tdls_generate_tpk(_adapter *padapter, struct sta_info *psta)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
u8 *SNonce = psta->SNonce;
u8 *ANonce = psta->ANonce;
u8 key_input[SHA256_MAC_LEN];
u8 *nonce[2];
size_t len[2];
u8 data[3 * ETH_ALEN];
/* IEEE Std 802.11z-2010 8.5.9.1:
* TPK-Key-Input = SHA-256(min(SNonce, ANonce) || max(SNonce, ANonce))
*/
len[0] = 32;
len[1] = 32;
if (os_memcmp(SNonce, ANonce, 32) < 0) {
nonce[0] = SNonce;
nonce[1] = ANonce;
} else {
nonce[0] = ANonce;
nonce[1] = SNonce;
}
sha256_vector(2, nonce, len, key_input);
/*
* TPK-Key-Data = KDF-N_KEY(TPK-Key-Input, "TDLS PMK",
* min(MAC_I, MAC_R) || max(MAC_I, MAC_R) || BSSID || N_KEY)
* TODO: is N_KEY really included in KDF Context and if so, in which
* presentation format (little endian 16-bit?) is it used? It gets
* added by the KDF anyway..
*/
if (os_memcmp(myid(&(padapter->eeprompriv)), psta->hwaddr, ETH_ALEN) < 0) {
_rtw_memcpy(data, myid(&(padapter->eeprompriv)), ETH_ALEN);
_rtw_memcpy(data + ETH_ALEN, psta->hwaddr, ETH_ALEN);
} else {
_rtw_memcpy(data, psta->hwaddr, ETH_ALEN);
_rtw_memcpy(data + ETH_ALEN, myid(&(padapter->eeprompriv)), ETH_ALEN);
}
_rtw_memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN);
sha256_prf(key_input, SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk));
}
/**
* wpa_tdls_ftie_mic - Calculate TDLS FTIE MIC
* @kck: TPK-KCK
* @lnkid: Pointer to the beginning of Link Identifier IE
* @rsnie: Pointer to the beginning of RSN IE used for handshake
* @timeoutie: Pointer to the beginning of Timeout IE used for handshake
* @ftie: Pointer to the beginning of FT IE
* @mic: Pointer for writing MIC
*
* Calculate MIC for TDLS frame.
*/
int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq,
u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie,
u8 *mic)
{
u8 *buf, *pos;
struct wpa_tdls_ftie *_ftie;
struct wpa_tdls_lnkid *_lnkid;
int ret;
int len = 2 * ETH_ALEN + 1 + 2 + lnkid[1] + 2 + rsnie[1] +
2 + timeoutie[1] + 2 + ftie[1];
buf = rtw_zmalloc(len);
if (!buf) {
DBG_88E("TDLS: No memory for MIC calculation\n");
return -1;
}
pos = buf;
_lnkid = (struct wpa_tdls_lnkid *) lnkid;
/* 1) TDLS initiator STA MAC address */
_rtw_memcpy(pos, _lnkid->init_sta, ETH_ALEN);
pos += ETH_ALEN;
/* 2) TDLS responder STA MAC address */
_rtw_memcpy(pos, _lnkid->resp_sta, ETH_ALEN);
pos += ETH_ALEN;
/* 3) Transaction Sequence number */
*pos++ = trans_seq;
/* 4) Link Identifier IE */
_rtw_memcpy(pos, lnkid, 2 + lnkid[1]);
pos += 2 + lnkid[1];
/* 5) RSN IE */
_rtw_memcpy(pos, rsnie, 2 + rsnie[1]);
pos += 2 + rsnie[1];
/* 6) Timeout Interval IE */
_rtw_memcpy(pos, timeoutie, 2 + timeoutie[1]);
pos += 2 + timeoutie[1];
/* 7) FTIE, with the MIC field of the FTIE set to 0 */
_rtw_memcpy(pos, ftie, 2 + ftie[1]);
_ftie = (struct wpa_tdls_ftie *) pos;
_rtw_memset(_ftie->mic, 0, TDLS_MIC_LEN);
pos += 2 + ftie[1];
ret = omac1_aes_128(kck, buf, pos - buf, mic);
rtw_mfree(buf, len);
return ret;
}
int tdls_verify_mic(u8 *kck, u8 trans_seq,
u8 *lnkid, u8 *rsnie, u8 *timeoutie, u8 *ftie)
{
u8 *buf, *pos;
int len;
u8 mic[16];
int ret;
u8 *rx_ftie, *tmp_ftie;
if (lnkid == NULL || rsnie == NULL ||
timeoutie == NULL || ftie == NULL){
return 0;
}
len = 2 * ETH_ALEN + 1 + 2 + 18 + 2 + *(rsnie+1) + 2 + *(timeoutie+1) + 2 + *(ftie+1);
buf = rtw_zmalloc(len);
if (buf == NULL)
return 0;
pos = buf;
/* 1) TDLS initiator STA MAC address */
_rtw_memcpy(pos, lnkid + ETH_ALEN + 2, ETH_ALEN);
pos += ETH_ALEN;
/* 2) TDLS responder STA MAC address */
_rtw_memcpy(pos, lnkid + 2 * ETH_ALEN + 2, ETH_ALEN);
pos += ETH_ALEN;
/* 3) Transaction Sequence number */
*pos++ = trans_seq;
/* 4) Link Identifier IE */
_rtw_memcpy(pos, lnkid, 2 + 18);
pos += 2 + 18;
/* 5) RSN IE */
_rtw_memcpy(pos, rsnie, 2 + *(rsnie+1));
pos += 2 + *(rsnie+1);
/* 6) Timeout Interval IE */
_rtw_memcpy(pos, timeoutie, 2 + *(timeoutie+1));
pos += 2 + *(timeoutie+1);
/* 7) FTIE, with the MIC field of the FTIE set to 0 */
_rtw_memcpy(pos, ftie, 2 + *(ftie+1));
pos += 2;
tmp_ftie = (u8 *) (pos+2);
_rtw_memset(tmp_ftie, 0, 16);
pos += *(ftie+1);
ret = omac1_aes_128(kck, buf, pos - buf, mic);
rtw_mfree(buf, len);
if (ret)
return 0;
rx_ftie = ftie+4;
if (os_memcmp(mic, rx_ftie, 16) == 0) {
/* Valid MIC */
return 1;
}
/* Invalid MIC */
DBG_88E( "[%s] Invalid MIC\n", __func__);
return 0;
}
#endif /* CONFIG_TDLS */
void rtw_use_tkipkey_handler(void *FunctionContext)
{
_adapter *padapter = (_adapter *)FunctionContext;