1
0
Fork 0

staging: rtl8723au: Use WLAN_CIPHER_SUITE_* to mark crypto type

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
Jes Sorensen 2014-05-21 09:37:34 +02:00 committed by Greg Kroah-Hartman
parent 07a4b1b1bc
commit 9e3d6df2df
19 changed files with 177 additions and 174 deletions

View File

@ -679,7 +679,10 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf)
if (pmlmepriv->cur_network.join_res != true) {
/* setting only at first time */
/* WEP Key will be set before this function, do not clear CAM. */
if ((psecuritypriv->dot11PrivacyAlgrthm != _WEP40_) && (psecuritypriv->dot11PrivacyAlgrthm != _WEP104_))
if (psecuritypriv->dot11PrivacyAlgrthm !=
WLAN_CIPHER_SUITE_WEP40 &&
psecuritypriv->dot11PrivacyAlgrthm !=
WLAN_CIPHER_SUITE_WEP104)
flush_all_cam_entry23a(padapter); /* clear CAM */
}
@ -897,8 +900,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
/* wpa2 */
group_cipher = 0; pairwise_cipher = 0;
psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
psecuritypriv->wpa2_group_cipher = 0;
psecuritypriv->wpa2_pairwise_cipher = 0;
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len > 0) {
@ -918,8 +921,8 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
ie_len = 0;
group_cipher = 0;
pairwise_cipher = 0;
psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
psecuritypriv->wpa_group_cipher = 0;
psecuritypriv->wpa_pairwise_cipher = 0;
for (p = ie + _BEACON_IE_OFFSET_; ;p += (ie_len + 2)) {
p = rtw_get_ie23a(p, WLAN_EID_VENDOR_SPECIFIC, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_ -
@ -1887,16 +1890,20 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter)
start_bss_network(padapter, (u8*)&mlmepriv->cur_network.network);
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))
{
if (padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_TKIP ||
padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_CCMP) {
/* restore group key, WEP keys is restored in ips_leave23a() */
rtw_set_key23a(padapter, psecuritypriv, psecuritypriv->dot118021XGrpKeyid, 0);
rtw_set_key23a(padapter, psecuritypriv,
psecuritypriv->dot118021XGrpKeyid, 0);
}
/* per sta pairwise key and settings */
if ((padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_) &&
(padapter->securitypriv.dot11PrivacyAlgrthm != _AES_)) {
if (padapter->securitypriv.dot11PrivacyAlgrthm !=
WLAN_CIPHER_SUITE_TKIP &&
padapter->securitypriv.dot11PrivacyAlgrthm !=
WLAN_CIPHER_SUITE_CCMP) {
return;
}

View File

@ -587,13 +587,14 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter,
phtpriv->ht_option = false;
if (pregistrypriv->ht_enable) {
u32 algo = padapter->securitypriv.dot11PrivacyAlgrthm;
/* Added by Albert 2010/06/23 */
/* For the WEP mode, we will use the bg mode to do
the connection to avoid some IOT issue. */
/* Especially for Realtek 8192u SoftAP. */
if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) &&
(padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) &&
(padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) {
if (algo != WLAN_CIPHER_SUITE_WEP40 &&
algo != WLAN_CIPHER_SUITE_WEP104 &&
algo != WLAN_CIPHER_SUITE_TKIP) {
/* rtw_restructure_ht_ie23a */
rtw_restructure_ht_ie23a(padapter,
&pnetwork->network.IEs[0],
@ -807,7 +808,7 @@ int rtw_clearstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 entry,
ether_addr_copy(psetstakey_para->addr, sta->hwaddr);
psetstakey_para->algorithm = _NO_PRIVACY_;
psetstakey_para->algorithm = 0;
psetstakey_para->id = entry;

View File

@ -382,17 +382,17 @@ int rtw_set_802_11_add_wep23a(struct rtw_adapter* padapter,
switch (wep->KeyLength)
{
case 5:
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("MgntActrtw_set_802_11_add_wep23a:wep->KeyLength = 5\n"));
break;
case 13:
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("MgntActrtw_set_802_11_add_wep23a:wep->KeyLength = 13\n"));
break;
default:
psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
psecuritypriv->dot11PrivacyAlgrthm = 0;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("MgntActrtw_set_802_11_add_wep23a:wep->KeyLength!= 5 "
"or 13\n"));

View File

@ -340,10 +340,10 @@ int rtw_is_same_ibss23a(struct rtw_adapter *adapter,
int ret = true;
struct security_priv *psecuritypriv = &adapter->securitypriv;
if (psecuritypriv->dot11PrivacyAlgrthm != _NO_PRIVACY_ &&
if (psecuritypriv->dot11PrivacyAlgrthm != 0 &&
pnetwork->network.Privacy == 0)
ret = false;
else if (psecuritypriv->dot11PrivacyAlgrthm == _NO_PRIVACY_ &&
else if (psecuritypriv->dot11PrivacyAlgrthm == 0 &&
pnetwork->network.Privacy == 1)
ret = false;
else
@ -1911,23 +1911,23 @@ int rtw_set_key23a(struct rtw_adapter *adapter,
"keyid = (u8)keyid =%d\n", psetkeyparm->algorithm, keyid));
switch (psetkeyparm->algorithm) {
case _WEP40_:
case WLAN_CIPHER_SUITE_WEP40:
keylen = 5;
memcpy(&psetkeyparm->key[0],
&psecuritypriv->dot11DefKey[keyid].skey[0], keylen);
break;
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP104:
keylen = 13;
memcpy(&psetkeyparm->key[0],
&psecuritypriv->dot11DefKey[keyid].skey[0], keylen);
break;
case _TKIP_:
case WLAN_CIPHER_SUITE_TKIP:
keylen = 16;
memcpy(&psetkeyparm->key,
&psecuritypriv->dot118021XGrpKey[keyid], keylen);
psetkeyparm->grpkey = 1;
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
keylen = 16;
memcpy(&psetkeyparm->key,
&psecuritypriv->dot118021XGrpKey[keyid], keylen);
@ -2250,7 +2250,8 @@ unsigned int rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie,
&max_rx_ampdu_factor);
ht_capie.ampdu_params_info = max_rx_ampdu_factor & 0x03;
if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
if (padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_CCMP)
ht_capie.ampdu_params_info |=
(IEEE80211_HT_AMPDU_PARM_DENSITY& (0x07 << 2));
else

View File

@ -336,7 +336,7 @@ static void init_mlme_ext_priv23a_value(struct rtw_adapter* padapter)
pmlmeinfo->key_index = 0;
pmlmeinfo->iv = 0;
pmlmeinfo->enc_algo = _NO_PRIVACY_;
pmlmeinfo->enc_algo = 0;
pmlmeinfo->authModeToggle = 0;
memset(pmlmeinfo->chg_txt, 0, 128);
@ -883,8 +883,8 @@ OnAuth23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
DBG_8723A("auth alg =%x, seq =%X\n", algorithm, seq);
if (auth_mode == 2 &&
psecuritypriv->dot11PrivacyAlgrthm != _WEP40_ &&
psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)
psecuritypriv->dot11PrivacyAlgrthm != WLAN_CIPHER_SUITE_WEP40 &&
psecuritypriv->dot11PrivacyAlgrthm != WLAN_CIPHER_SUITE_WEP104)
auth_mode = 0;
/* rx a shared-key auth but shared not enabled, or */
@ -2305,7 +2305,7 @@ void update_mgntframe_attrib23a(struct rtw_adapter *padapter,
else
pattrib->raid = 5;/* a/g mode */
pattrib->encrypt = _NO_PRIVACY_;
pattrib->encrypt = 0;
pattrib->bswenc = false;
pattrib->qos_en = false;
@ -3098,7 +3098,7 @@ void issue_auth23a(struct rtw_adapter *padapter, struct sta_info *psta,
pattrib->hdrlen = sizeof(struct ieee80211_hdr_3addr);
pattrib->encrypt = _WEP40_;
pattrib->encrypt = WLAN_CIPHER_SUITE_WEP40;
pattrib->icv_len = 4;
@ -6282,7 +6282,7 @@ int set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
struct sta_info *psta;
struct sta_priv *pstapriv = &padapter->stapriv;
if (pparm->algorithm == _NO_PRIVACY_) /* clear cam entry */
if (pparm->algorithm == 0) /* clear cam entry */
{
clear_cam_entry23a(padapter, pparm->id);
return H2C_SUCCESS_RSP;
@ -6323,8 +6323,7 @@ int set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
/* below for sta mode */
if (pparm->algorithm == _NO_PRIVACY_) /* clear cam entry */
{
if (pparm->algorithm == 0) { /* clear cam entry */
clear_cam_entry23a(padapter, pparm->id);
return H2C_SUCCESS;
}

View File

@ -79,8 +79,10 @@ int ips_leave23a(struct rtw_adapter * padapter)
DBG_8723A_LEVEL(_drv_always_, "nolinked power save leave\n");
if (psecuritypriv->dot11PrivacyAlgrthm == _WEP40_ ||
psecuritypriv->dot11PrivacyAlgrthm == _WEP104_) {
if (psecuritypriv->dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_WEP40 ||
psecuritypriv->dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_WEP104) {
DBG_8723A("==>%s, channel(%d), processing(%x)\n",
__func__, padapter->mlmeextpriv.cur_channel,
pwrpriv->bips_processing);

View File

@ -296,9 +296,9 @@ int recvframe_chkmic(struct rtw_adapter *adapter,
stainfo = rtw_get_stainfo23a(&adapter->stapriv, &prxattrib->ta[0]);
if (prxattrib->encrypt == _TKIP_) {
if (prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
("\n recvframe_chkmic:prxattrib->encrypt == _TKIP_\n"));
("\n recvframe_chkmic:prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP\n"));
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
("\n recvframe_chkmic:da = 0x%02x:0x%02x:0x%02x:0x%02x:"
"0x%02x:0x%02x\n", prxattrib->ra[0],
@ -491,13 +491,13 @@ struct recv_frame *decryptor(struct rtw_adapter *padapter,
prxattrib->key_index);
switch (prxattrib->encrypt) {
case _WEP40_:
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
prxattrib->key_index =
psecuritypriv->dot11PrivacyKeyIndex;
break;
case _TKIP_:
case _AES_:
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
default:
prxattrib->key_index =
psecuritypriv->dot118021XGrpKeyid;
@ -509,14 +509,14 @@ struct recv_frame *decryptor(struct rtw_adapter *padapter,
if ((prxattrib->encrypt > 0) && ((prxattrib->bdecrypted == 0))) {
psecuritypriv->hw_decrypted = 0;
switch (prxattrib->encrypt) {
case _WEP40_:
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
rtw_wep_decrypt23a(padapter, precv_frame);
break;
case _TKIP_:
case WLAN_CIPHER_SUITE_TKIP:
res = rtw_tkip_decrypt23a(padapter, precv_frame);
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
res = rtw_aes_decrypt23a(padapter, precv_frame);
break;
default:
@ -524,7 +524,7 @@ struct recv_frame *decryptor(struct rtw_adapter *padapter,
}
} else if (prxattrib->bdecrypted == 1 && prxattrib->encrypt > 0 &&
(psecuritypriv->busetkipkey == 1 ||
prxattrib->encrypt != _TKIP_)) {
prxattrib->encrypt != WLAN_CIPHER_SUITE_TKIP)) {
psecuritypriv->hw_decrypted = 1;
}
@ -1408,16 +1408,16 @@ static int validate_recv_data_frame(struct rtw_adapter *adapter,
switch (pattrib->encrypt)
{
case _WEP40_:
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
pattrib->iv_len = 4;
pattrib->icv_len = 4;
break;
case _TKIP_:
case WLAN_CIPHER_SUITE_TKIP:
pattrib->iv_len = 8;
pattrib->icv_len = 4;
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
pattrib->iv_len = 8;
pattrib->icv_len = 8;
break;

View File

@ -170,7 +170,8 @@ void rtw_wep_encrypt23a(struct rtw_adapter *padapter,
pframe = pxmitframe->buf_addr + hw_hdr_offset;
/* start to encrypt each fragment */
if ((pattrib->encrypt != _WEP40_) && (pattrib->encrypt != _WEP104_))
if (pattrib->encrypt != WLAN_CIPHER_SUITE_WEP40 &&
pattrib->encrypt != WLAN_CIPHER_SUITE_WEP104)
return;
index = psecuritypriv->dot11PrivacyKeyIndex;
@ -225,7 +226,8 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
pframe = skb->data;
/* start to decrypt recvframe */
if ((prxattrib->encrypt != _WEP40_) && (prxattrib->encrypt != _WEP104_))
if (prxattrib->encrypt != WLAN_CIPHER_SUITE_WEP40 &&
prxattrib->encrypt != WLAN_CIPHER_SUITE_WEP104)
return;
iv = pframe + prxattrib->hdrlen;
@ -637,14 +639,10 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter,
pframe = pxmitframe->buf_addr + hw_hdr_offset;
/* 4 start to encrypt each fragment */
if (pattrib->encrypt == _TKIP_) {
if (pattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) {
if (pattrib->psta)
{
stainfo = pattrib->psta;
}
else
{
else {
DBG_8723A("%s, call rtw_get_stainfo()\n", __func__);
stainfo = rtw_get_stainfo23a(&padapter->stapriv,
&pattrib->ra[0]);
@ -737,7 +735,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
pframe = skb->data;
/* 4 start to decrypt recvframe */
if (prxattrib->encrypt == _TKIP_) {
if (prxattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) {
stainfo = rtw_get_stainfo23a(&padapter->stapriv,
&prxattrib->ta[0]);
@ -1323,7 +1321,7 @@ int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
pframe = pxmitframe->buf_addr + hw_hdr_offset;
/* 4 start to encrypt each fragment */
if (pattrib->encrypt != _AES_)
if (pattrib->encrypt != WLAN_CIPHER_SUITE_CCMP)
return _FAIL;
if (pattrib->psta) {
@ -1598,7 +1596,7 @@ int rtw_aes_decrypt23a(struct rtw_adapter *padapter,
pframe = skb->data;
/* 4 start to encrypt each fragment */
if (prxattrib->encrypt != _AES_)
if (prxattrib->encrypt != WLAN_CIPHER_SUITE_CCMP)
return _FAIL;
stainfo = rtw_get_stainfo23a(&padapter->stapriv, &prxattrib->ta[0]);

View File

@ -105,8 +105,10 @@ static void sreset_restore_security_station(struct rtw_adapter *padapter)
rtl8723a_set_sec_cfg(padapter, val8);
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
if (padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_TKIP ||
padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_CCMP) {
psta = rtw_get_stainfo23a(pstapriv, get_bssid(mlmepriv));
if (psta == NULL) {
/* DEBUG_ERR(("Set wpa_set_encryption: Obtain Sta_info fail\n")); */

View File

@ -296,9 +296,10 @@ static void update_attrib_vcs_info(struct rtw_adapter *padapter, struct xmit_fra
} else {
while (true) {
/* IOT action */
if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS) &&
(pattrib->ampdu_en) &&
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_ATHEROS &&
pattrib->ampdu_en &&
padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_CCMP) {
pattrib->vcs_mode = CTS_TO_SELF;
break;
}
@ -594,13 +595,13 @@ static int update_attrib(struct rtw_adapter *padapter,
}
switch (pattrib->encrypt) {
case _WEP40_:
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
pattrib->iv_len = 4;
pattrib->icv_len = 4;
break;
case _TKIP_:
case WLAN_CIPHER_SUITE_TKIP:
pattrib->iv_len = 8;
pattrib->icv_len = 4;
@ -614,9 +615,10 @@ static int update_attrib(struct rtw_adapter *padapter,
}
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_,
("pattrib->encrypt =%d (_AES_)\n", pattrib->encrypt));
("pattrib->encrypt =%d (WLAN_CIPHER_SUITE_CCMP)\n",
pattrib->encrypt));
pattrib->iv_len = 8;
pattrib->icv_len = 8;
break;
@ -680,7 +682,7 @@ static int xmitframe_addmic(struct rtw_adapter *padapter,
hw_hdr_offset = TXDESC_OFFSET;
if (pattrib->encrypt == _TKIP_) {
if (pattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) {
/* encode mic code */
if (stainfo) {
u8 null_key[16]={0x0, 0x0, 0x0, 0x0,
@ -834,14 +836,14 @@ static int xmitframe_swencrypt(struct rtw_adapter *padapter,
RT_TRACE(_module_rtl871x_xmit_c_, _drv_alert_,
("### xmitframe_swencrypt\n"));
switch (pattrib->encrypt) {
case _WEP40_:
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
rtw_wep_encrypt23a(padapter, pxmitframe);
break;
case _TKIP_:
case WLAN_CIPHER_SUITE_TKIP:
rtw_tkip_encrypt23a(padapter, pxmitframe);
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
rtw_aes_encrypt23a(padapter, pxmitframe);
break;
default:
@ -1052,7 +1054,7 @@ u32 rtw_calculate_wlan_pkt_size_by_attribue23a(struct pkt_attrib *pattrib)
len = pattrib->hdrlen + pattrib->iv_len; /* WLAN Header and IV */
len += SNAP_SIZE + sizeof(u16); /* LLC */
len += pattrib->pktlen;
if (pattrib->encrypt == _TKIP_) len += 8; /* MIC */
if (pattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) len += 8; /* MIC */
len += ((pattrib->bswenc) ? pattrib->icv_len : 0); /* ICV */
return len;
@ -1144,12 +1146,12 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb,
if (pattrib->iv_len) {
if (psta) {
switch (pattrib->encrypt) {
case _WEP40_:
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
WEP_IV(pattrib->iv, psta->dot11txpn,
pattrib->key_idx);
break;
case _TKIP_:
case WLAN_CIPHER_SUITE_TKIP:
if (bmcst)
TKIP_IV(pattrib->iv,
psta->dot11txpn,
@ -1158,7 +1160,7 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb,
TKIP_IV(pattrib->iv,
psta->dot11txpn, 0);
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
if (bmcst)
AES_IV(pattrib->iv,
psta->dot11txpn,

View File

@ -419,15 +419,14 @@ rtl8723a_set_ampdu_min_space(struct rtw_adapter *padapter, u8 MinSpacingToSet)
if (MinSpacingToSet <= 7) {
switch (padapter->securitypriv.dot11PrivacyAlgrthm) {
case _NO_PRIVACY_:
case _AES_:
case 0:
case WLAN_CIPHER_SUITE_CCMP:
SecMinSpace = 0;
break;
case _WEP40_:
case _WEP104_:
case _TKIP_:
case _TKIP_WTMIC_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
case WLAN_CIPHER_SUITE_TKIP:
SecMinSpace = 6;
break;
default:

View File

@ -2081,18 +2081,17 @@ static void fill_txdesc_sectype(struct pkt_attrib *pattrib,
if ((pattrib->encrypt > 0) && !pattrib->bswenc) {
switch (pattrib->encrypt) {
/* SEC_TYPE */
case _WEP40_:
case _WEP104_:
case _TKIP_:
case _TKIP_WTMIC_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
case WLAN_CIPHER_SUITE_TKIP:
ptxdesc->sectype = 1;
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
ptxdesc->sectype = 3;
break;
case _NO_PRIVACY_:
case 0:
default:
break;
}

View File

@ -73,19 +73,18 @@ static void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxd
if ((pattrib->encrypt > 0) && !pattrib->bswenc) {
switch (pattrib->encrypt) {
/* SEC_TYPE */
case _WEP40_:
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
ptxdesc->txdw1 |= cpu_to_le32((0x01<<22)&0x00c00000);
break;
case _TKIP_:
case _TKIP_WTMIC_:
case WLAN_CIPHER_SUITE_TKIP:
/* ptxdesc->txdw1 |= cpu_to_le32((0x02<<22)&0x00c00000); */
ptxdesc->txdw1 |= cpu_to_le32((0x01<<22)&0x00c00000);
break;
case _AES_:
case WLAN_CIPHER_SUITE_CCMP:
ptxdesc->txdw1 |= cpu_to_le32((0x03<<22)&0x00c00000);
break;
case _NO_PRIVACY_:
case 0:
default:
break;
}

View File

@ -111,7 +111,7 @@ struct rx_pkt_attrib {
u8 privacy; /* in frame_ctrl field */
u8 bdecrypted;
/* when 0 indicate no encrypt. when non-zero, indicate the algorith */
u8 encrypt;
u32 encrypt;
u8 iv_len;
u8 icv_len;
u8 crc_err;

View File

@ -19,14 +19,8 @@
#include <drv_types.h>
#define _NO_PRIVACY_ 0x0
#define _WEP40_ 0x1
#define _TKIP_ 0x2
#define _TKIP_WTMIC_ 0x3
#define _AES_ 0x4
#define _WEP104_ 0x5
#define is_wep_enc(alg) (((alg) == _WEP40_) || ((alg) == _WEP104_))
#define is_wep_enc(alg) (alg == WLAN_CIPHER_SUITE_WEP40 || \
alg == WLAN_CIPHER_SUITE_WEP104)
#define _WPA2_IE_ID_ 0x30

View File

@ -124,8 +124,8 @@ struct pkt_attrib {
u16 hdrlen; /* the WLAN Header Len */
u32 pktlen; /* the original 802.3 pkt raw_data len */
u32 last_txcmdsz;
u32 encrypt; /* when 0 indicate no encrypt. */
u8 nr_frags;
u8 encrypt; /* when 0 indicate no encrypt. */
u8 iv_len;
u8 icv_len;
u8 iv[18];

View File

@ -506,15 +506,14 @@ static int set_group_key(struct rtw_adapter *padapter, u8 *key, u32 alg,
psetkeyparm->set_tx = 1;
switch (alg) {
case _WEP40_:
case WLAN_CIPHER_SUITE_WEP40:
keylen = 5;
break;
case _WEP104_:
case WLAN_CIPHER_SUITE_WEP104:
keylen = 13;
break;
case _TKIP_:
case _TKIP_WTMIC_:
case _AES_:
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
default:
keylen = 16;
}
@ -536,17 +535,17 @@ exit:
static int set_wep_key(struct rtw_adapter *padapter, u8 *key, u8 keylen,
u8 keyid)
{
u8 alg;
u32 alg;
switch (keylen) {
case 5:
alg = _WEP40_;
alg = WLAN_CIPHER_SUITE_WEP40;
break;
case 13:
alg = _WEP104_;
alg = WLAN_CIPHER_SUITE_WEP104;
break;
default:
alg = _NO_PRIVACY_;
alg = 0;
}
return set_group_key(padapter, key, alg, keyid);
@ -626,12 +625,12 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
psecuritypriv->ndisencryptstatus =
Ndis802_11Encryption1Enabled;
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP40;
if (wep_key_len == 13) {
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP104;
}
psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;
@ -660,17 +659,17 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
(param->u.crypt.key_len >
16 ? 16 : param->u.crypt.key_len));
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP40;
if (param->u.crypt.key_len == 13) {
psecuritypriv->dot118021XGrpPrivacy =
_WEP104_;
WLAN_CIPHER_SUITE_WEP104;
}
} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
DBG_8723A("%s, set group_key, TKIP\n",
__func__);
psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_TKIP;
memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.idx].
@ -695,7 +694,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
DBG_8723A("%s, set group_key, CCMP\n",
__func__);
psecuritypriv->dot118021XGrpPrivacy = _AES_;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_CCMP;
memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.idx].
@ -707,7 +706,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
__func__);
psecuritypriv->dot118021XGrpPrivacy =
_NO_PRIVACY_;
0;
}
psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
@ -749,16 +748,16 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
DBG_8723A("%s, set pairwise key, WEP\n",
__func__);
psta->dot118021XPrivacy = _WEP40_;
psta->dot118021XPrivacy = WLAN_CIPHER_SUITE_WEP40;
if (param->u.crypt.key_len == 13) {
psta->dot118021XPrivacy =
_WEP104_;
WLAN_CIPHER_SUITE_WEP104;
}
} else if (!strcmp(param->u.crypt.alg, "TKIP")) {
DBG_8723A("%s, set pairwise key, "
"TKIP\n", __func__);
psta->dot118021XPrivacy = _TKIP_;
psta->dot118021XPrivacy = WLAN_CIPHER_SUITE_TKIP;
/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
/* set mic key */
@ -774,12 +773,12 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
DBG_8723A("%s, set pairwise key, "
"CCMP\n", __func__);
psta->dot118021XPrivacy = _AES_;
psta->dot118021XPrivacy = WLAN_CIPHER_SUITE_CCMP;
} else {
DBG_8723A("%s, set pairwise key, "
"none\n", __func__);
psta->dot118021XPrivacy = _NO_PRIVACY_;
psta->dot118021XPrivacy = 0;
}
set_pairwise_key(padapter, psta);
@ -798,15 +797,15 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
key_len));
psecuritypriv->dot118021XGrpPrivacy =
_WEP40_;
WLAN_CIPHER_SUITE_WEP40;
if (param->u.crypt.key_len == 13) {
psecuritypriv->
dot118021XGrpPrivacy =
_WEP104_;
WLAN_CIPHER_SUITE_WEP104;
}
} else if (!strcmp(param->u.crypt.alg, "TKIP")) {
psecuritypriv->dot118021XGrpPrivacy =
_TKIP_;
WLAN_CIPHER_SUITE_TKIP;
memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.
@ -835,7 +834,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
} else if (!strcmp(param->u.crypt.alg, "CCMP")) {
psecuritypriv->dot118021XGrpPrivacy =
_AES_;
WLAN_CIPHER_SUITE_CCMP;
memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.
@ -846,7 +845,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
key_len));
} else {
psecuritypriv->dot118021XGrpPrivacy =
_NO_PRIVACY_;
0;
}
psecuritypriv->dot118021XGrpKeyid =
@ -932,12 +931,12 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev,
psecuritypriv->ndisencryptstatus =
Ndis802_11Encryption1Enabled;
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP40;
if (wep_key_len == 13) {
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP104;
}
psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;
@ -1203,18 +1202,18 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
__func__, ndev->name, key_index, unicast, multicast);
if ((key_index < WEP_KEYS) &&
((psecuritypriv->dot11PrivacyAlgrthm == _WEP40_) ||
(psecuritypriv->dot11PrivacyAlgrthm == _WEP104_))) {
((psecuritypriv->dot11PrivacyAlgrthm == WLAN_CIPHER_SUITE_WEP40) ||
(psecuritypriv->dot11PrivacyAlgrthm == WLAN_CIPHER_SUITE_WEP104))) {
/* set wep default key */
psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
psecuritypriv->dot11PrivacyKeyIndex = key_index;
psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP40;
if (psecuritypriv->dot11DefKeylen[key_index] == 13) {
psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP104;
}
/* set the flag to represent that wep default key
@ -1705,30 +1704,30 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv,
DBG_8723A("%s, ucast =%d, cipher = 0x%x\n", __func__, ucast, cipher);
if (!cipher) {
*profile_cipher = _NO_PRIVACY_;
*profile_cipher = 0;
psecuritypriv->ndisencryptstatus = ndisencryptstatus;
return 0;
}
switch (cipher) {
case IW_AUTH_CIPHER_NONE:
*profile_cipher = _NO_PRIVACY_;
*profile_cipher = 0;
ndisencryptstatus = Ndis802_11EncryptionDisabled;
break;
case WLAN_CIPHER_SUITE_WEP40:
*profile_cipher = _WEP40_;
*profile_cipher = WLAN_CIPHER_SUITE_WEP40;
ndisencryptstatus = Ndis802_11Encryption1Enabled;
break;
case WLAN_CIPHER_SUITE_WEP104:
*profile_cipher = _WEP104_;
*profile_cipher = WLAN_CIPHER_SUITE_WEP104;
ndisencryptstatus = Ndis802_11Encryption1Enabled;
break;
case WLAN_CIPHER_SUITE_TKIP:
*profile_cipher = _TKIP_;
*profile_cipher = WLAN_CIPHER_SUITE_TKIP;
ndisencryptstatus = Ndis802_11Encryption2Enabled;
break;
case WLAN_CIPHER_SUITE_CCMP:
*profile_cipher = _AES_;
*profile_cipher = WLAN_CIPHER_SUITE_CCMP;
ndisencryptstatus = Ndis802_11Encryption3Enabled;
break;
default:
@ -1838,27 +1837,27 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie,
switch (group_cipher) {
case WPA_CIPHER_NONE:
padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_;
padapter->securitypriv.dot118021XGrpPrivacy = 0;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11EncryptionDisabled;
break;
case WPA_CIPHER_WEP40:
padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_;
padapter->securitypriv.dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP40;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption1Enabled;
break;
case WPA_CIPHER_TKIP:
padapter->securitypriv.dot118021XGrpPrivacy = _TKIP_;
padapter->securitypriv.dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_TKIP;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption2Enabled;
break;
case WPA_CIPHER_CCMP:
padapter->securitypriv.dot118021XGrpPrivacy = _AES_;
padapter->securitypriv.dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_CCMP;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption3Enabled;
break;
case WPA_CIPHER_WEP104:
padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_;
padapter->securitypriv.dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP104;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption1Enabled;
break;
@ -1866,27 +1865,27 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie,
switch (pairwise_cipher) {
case WPA_CIPHER_NONE:
padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_;
padapter->securitypriv.dot11PrivacyAlgrthm = 0;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11EncryptionDisabled;
break;
case WPA_CIPHER_WEP40:
padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_;
padapter->securitypriv.dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption1Enabled;
break;
case WPA_CIPHER_TKIP:
padapter->securitypriv.dot11PrivacyAlgrthm = _TKIP_;
padapter->securitypriv.dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_TKIP;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption2Enabled;
break;
case WPA_CIPHER_CCMP:
padapter->securitypriv.dot11PrivacyAlgrthm = _AES_;
padapter->securitypriv.dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_CCMP;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption3Enabled;
break;
case WPA_CIPHER_WEP104:
padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_;
padapter->securitypriv.dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
padapter->securitypriv.ndisencryptstatus =
Ndis802_11Encryption1Enabled;
break;
@ -1911,9 +1910,10 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie,
}
/* TKIP and AES disallow multicast packets until installing group key */
if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ ||
padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ ||
padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
if (padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_TKIP ||
padapter->securitypriv.dot11PrivacyAlgrthm ==
WLAN_CIPHER_SUITE_CCMP)
/* WPS open need to enable multicast */
/* check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == true)*/
rtl8723a_off_rcr_am(padapter);
@ -2068,8 +2068,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
}
psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
psecuritypriv->dot11PrivacyAlgrthm = 0;
psecuritypriv->dot118021XGrpPrivacy = 0;
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
@ -2135,9 +2135,9 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
if (wep_key_len == 13) {
padapter->securitypriv.dot11PrivacyAlgrthm =
_WEP104_;
WLAN_CIPHER_SUITE_WEP104;
padapter->securitypriv.dot118021XGrpPrivacy =
_WEP104_;
WLAN_CIPHER_SUITE_WEP104;
}
} else {
ret = -EINVAL;

View File

@ -60,10 +60,10 @@ void rtw_reset_securitypriv23a(struct rtw_adapter *adapter)
/* open system */
psec_priv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
psec_priv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
psec_priv->dot11PrivacyAlgrthm = 0;
psec_priv->dot11PrivacyKeyIndex = 0;
psec_priv->dot118021XGrpPrivacy = _NO_PRIVACY_;
psec_priv->dot118021XGrpPrivacy = 0;
psec_priv->dot118021XGrpKeyid = 1;
psec_priv->ndisauthtype = Ndis802_11AuthModeOpen;

View File

@ -405,11 +405,11 @@ static int rtw_init_default_value(struct rtw_adapter *padapter)
/* open system */
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
psecuritypriv->dot11PrivacyAlgrthm = 0;
psecuritypriv->dot11PrivacyKeyIndex = 0;
psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
psecuritypriv->dot118021XGrpPrivacy = 0;
psecuritypriv->dot118021XGrpKeyid = 1;
psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;