Commit 9e3d6df2 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman
Browse files

staging: rtl8723au: Use WLAN_CIPHER_SUITE_* to mark crypto type

parent 07a4b1b1
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
@@ -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;
	}

+5 −4
Original line number Diff line number Diff line
@@ -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;

+3 −3
Original line number Diff line number Diff line
@@ -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"));
+8 −7
Original line number Diff line number Diff line
@@ -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
+7 −8
Original line number Diff line number Diff line
@@ -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;
	}
Loading