rtl8188eu: Remove dead code associated with WAPI

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-07-12 01:29:15 -05:00
parent 7c593a903d
commit acda213bd2
16 changed files with 5 additions and 841 deletions

View file

@ -27,7 +27,6 @@ CONFIG_HW_PWRP_DETECTION = n
CONFIG_WIFI_TEST = n CONFIG_WIFI_TEST = n
CONFIG_BT_COEXIST = n CONFIG_BT_COEXIST = n
CONFIG_INTEL_WIDI = n CONFIG_INTEL_WIDI = n
CONFIG_WAPI_SUPPORT = n
CONFIG_EFUSE_CONFIG_FILE = n CONFIG_EFUSE_CONFIG_FILE = n
CONFIG_EXT_CLK = n CONFIG_EXT_CLK = n
CONFIG_FTP_PROTECT = n CONFIG_FTP_PROTECT = n
@ -133,10 +132,6 @@ ifeq ($(CONFIG_INTEL_WIDI), y)
EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI
endif endif
ifeq ($(CONFIG_WAPI_SUPPORT), y)
EXTRA_CFLAGS += -DCONFIG_WAPI_SUPPORT
endif
ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y) ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y)
EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE
endif endif
@ -198,8 +193,6 @@ rtk_core := \
8188eu-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o 8188eu-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o
8188eu-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o \
core/rtw_wapi_sms4.o
8188eu-y += $(_HAL_INTFS_FILES) 8188eu-y += $(_HAL_INTFS_FILES)
8188eu-y += $(_OS_INTFS_FILES) 8188eu-y += $(_OS_INTFS_FILES)

View file

@ -755,50 +755,6 @@ int rtw_parse_wpa2_ie(u8* rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
} }
#ifdef CONFIG_WAPI_SUPPORT
int rtw_get_wapi_ie(u8 *in_ie,uint in_len,u8 *wapi_ie,u16 *wapi_len)
{
u8 authmode, i;
uint cnt;
u8 wapi_oui1[4]={0x0,0x14,0x72,0x01};
u8 wapi_oui2[4]={0x0,0x14,0x72,0x02};
_func_enter_;
cnt = (_TIMESTAMP_ + _BEACON_ITERVAL_ + _CAPABILITY_);
while (cnt<in_len)
{
authmode=in_ie[cnt];
/* if (authmode==_WAPI_IE_) */
if (authmode==_WAPI_IE_ && (_rtw_memcmp(&in_ie[cnt+6], wapi_oui1,4)==true ||
_rtw_memcmp(&in_ie[cnt+6], wapi_oui2,4)==true))
{
if (wapi_ie) {
_rtw_memcpy(wapi_ie, &in_ie[cnt],in_ie[cnt+1]+2);
for (i=0;i<(in_ie[cnt+1]+2);i=i+8){
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("\n %2x,%2x,%2x,%2x,%2x,%2x,%2x,%2x\n",
wapi_ie[i],wapi_ie[i+1],wapi_ie[i+2],wapi_ie[i+3],wapi_ie[i+4],
wapi_ie[i+5],wapi_ie[i+6],wapi_ie[i+7]));
}
}
*wapi_len=in_ie[cnt+1]+2;
cnt+=in_ie[cnt+1]+2; /* get next */
}
else
{
cnt+=in_ie[cnt+1]+2; /* get next */
}
}
return *wapi_len;
_func_exit_;
}
#endif
int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 *wpa_len) int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 *wpa_len)
{ {
u8 authmode, sec_idx, i; u8 authmode, sec_idx, i;

View file

@ -609,11 +609,6 @@ _func_enter_;
if (psecuritypriv->ndisauthtype>3) if (psecuritypriv->ndisauthtype>3)
psecuritypriv->dot11AuthAlgrthm=dot11AuthAlgrthm_8021X; psecuritypriv->dot11AuthAlgrthm=dot11AuthAlgrthm_8021X;
#ifdef CONFIG_WAPI_SUPPORT
if (psecuritypriv->ndisauthtype == 6)
psecuritypriv->dot11AuthAlgrthm=dot11AuthAlgrthm_WAPI;
#endif
res=rtw_set_auth(padapter,psecuritypriv); res=rtw_set_auth(padapter,psecuritypriv);
if (res==_SUCCESS) if (res==_SUCCESS)

View file

@ -1327,20 +1327,6 @@ _func_enter_;
_clr_fwstate_(pmlmepriv, _FW_LINKED); _clr_fwstate_(pmlmepriv, _FW_LINKED);
#endif #endif
#ifdef CONFIG_WAPI_SUPPORT
psta = rtw_get_stainfo(pstapriv,cur_network->MacAddress);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
{
rtw_wapi_return_one_sta_info(padapter, psta->hwaddr);
}
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
{
rtw_wapi_return_all_sta_info(padapter);
}
#endif
if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)
#ifdef CONFIG_LAYER2_ROAMING #ifdef CONFIG_LAYER2_ROAMING
|| (pmlmepriv->to_roaming<=0) || (pmlmepriv->to_roaming<=0)
@ -3187,10 +3173,6 @@ void _rtw_roaming(_adapter *padapter, struct wlan_network *tgt_network)
pmlmepriv->assoc_by_bssid = false; pmlmepriv->assoc_by_bssid = false;
#ifdef CONFIG_WAPI_SUPPORT
rtw_wapi_return_all_sta_info(padapter);
#endif
while (1) { while (1) {
if ( _SUCCESS==(do_join_r=rtw_do_join(padapter)) ) { if ( _SUCCESS==(do_join_r=rtw_do_join(padapter)) ) {
break; break;

View file

@ -1962,11 +1962,6 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
} }
#endif #endif
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case _WAPI_IE_:
pWapiIE = pIE;
break;
#endif
case _HT_CAPABILITY_IE_: /* HT caps */ case _HT_CAPABILITY_IE_: /* HT caps */
HT_caps_handler(padapter, pIE); HT_caps_handler(padapter, pIE);
break; break;
@ -1982,10 +1977,6 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
i += (pIE->Length + 2); i += (pIE->Length + 2);
} }
#ifdef CONFIG_WAPI_SUPPORT
rtw_wapi_on_assoc_ok(padapter, pIE);
#endif
pmlmeinfo->state &= (~WIFI_FW_ASSOC_STATE); pmlmeinfo->state &= (~WIFI_FW_ASSOC_STATE);
pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS; pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
@ -6820,10 +6811,6 @@ void issue_assocreq(_adapter *padapter)
if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK) if (pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_REALTEK)
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 6 , REALTEK_96B_IE, &(pattrib->pktlen)); pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 6 , REALTEK_96B_IE, &(pattrib->pktlen));
#ifdef CONFIG_WAPI_SUPPORT
rtw_build_assoc_req_wapi_ie(padapter, pframe, pattrib);
#endif
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
@ -8422,13 +8409,6 @@ void start_clnt_join(_adapter* padapter)
val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf; val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X)? 0xcc: 0xcf;
#ifdef CONFIG_WAPI_SUPPORT
if (padapter->wapiInfo.bWapiEnable && pmlmeinfo->auth_algo == dot11AuthAlgrthm_WAPI)
{
/* Disable TxUseDefaultKey, RxUseDefaultKey, RxBroadcastUseDefaultKey. */
val8 = 0x4c;
}
#endif
rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
/* switch channel */ /* switch channel */
@ -9852,10 +9832,6 @@ u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf)
rtw_antenna_select_cmd(padapter, pparm->network.PhyInfo.Optimum_antenna, false); rtw_antenna_select_cmd(padapter, pparm->network.PhyInfo.Optimum_antenna, false);
#endif #endif
#ifdef CONFIG_WAPI_SUPPORT
rtw_wapi_clear_all_cam_entry(padapter);
#endif
rtw_joinbss_reset(padapter); rtw_joinbss_reset(padapter);
pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20; pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_20;

View file

@ -605,11 +605,6 @@ _func_enter_;
case _AES_: case _AES_:
res = rtw_aes_decrypt(padapter, (u8 * )precv_frame); res = rtw_aes_decrypt(padapter, (u8 * )precv_frame);
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case _SMS4_:
rtw_sms4_decrypt(padapter, (u8 * )precv_frame);
break;
#endif
default: default:
break; break;
} }
@ -1688,14 +1683,6 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame)
struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
#endif #endif
#ifdef CONFIG_WAPI_SUPPORT
PRT_WAPI_T pWapiInfo = &adapter->wapiInfo;
struct recv_frame_hdr *phdr = &precv_frame->u.hdr;
u8 wai_pkt = 0;
u16 sc;
u8 external_len = 0;
#endif
_func_enter_; _func_enter_;
@ -1727,9 +1714,6 @@ _func_enter_;
pattrib->mdata = GetMData(ptr); pattrib->mdata = GetMData(ptr);
pattrib->privacy = GetPrivacy(ptr); pattrib->privacy = GetPrivacy(ptr);
pattrib->order = GetOrder(ptr); pattrib->order = GetOrder(ptr);
#ifdef CONFIG_WAPI_SUPPORT
sc = (pattrib->seq_num<<4) | pattrib->frag_num;
#endif
#if 1 /* Dump rx packets */ #if 1 /* Dump rx packets */
{ {
@ -1787,45 +1771,11 @@ _func_enter_;
retval = _FAIL; /* only data frame return _SUCCESS */ retval = _FAIL; /* only data frame return _SUCCESS */
break; break;
case WIFI_DATA_TYPE: /* data */ case WIFI_DATA_TYPE: /* data */
#ifdef CONFIG_WAPI_SUPPORT
if (pattrib->qos)
external_len = 2;
else
external_len= 0;
wai_pkt = rtw_wapi_is_wai_packet(adapter,ptr);
phdr->bIsWaiPacket = wai_pkt;
if (wai_pkt !=0){
if (sc != adapter->wapiInfo.wapiSeqnumAndFragNum)
{
adapter->wapiInfo.wapiSeqnumAndFragNum = sc;
}
else
{
retval = _FAIL;
break;
}
}
else{
if (rtw_wapi_drop_for_key_absent(adapter,GetAddr2Ptr(ptr))){
retval=_FAIL;
WAPI_TRACE(WAPI_RX,"drop for key absent for rx\n");
break;
}
}
#endif
rtw_led_control(adapter, LED_CTL_RX); rtw_led_control(adapter, LED_CTL_RX);
pattrib->qos = (subtype & BIT(7))? 1:0; pattrib->qos = (subtype & BIT(7))? 1:0;
retval = validate_recv_data_frame(adapter, precv_frame); retval = validate_recv_data_frame(adapter, precv_frame);
if (retval == _FAIL) if (retval == _FAIL) {
{
struct recv_priv *precvpriv = &adapter->recvpriv; struct recv_priv *precvpriv = &adapter->recvpriv;
/* RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("validate_recv_data_frame fail\n")); */
precvpriv->rx_drop++; precvpriv->rx_drop++;
} }
break; break;
@ -2931,10 +2881,6 @@ static int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe)
count_rx_stats(padapter, prframe, NULL); count_rx_stats(padapter, prframe, NULL);
#ifdef CONFIG_WAPI_SUPPORT
rtw_wapi_update_info(padapter, prframe);
#endif
#ifdef CONFIG_80211N_HT #ifdef CONFIG_80211N_HT
ret = process_recv_indicatepkts(padapter, prframe); ret = process_recv_indicatepkts(padapter, prframe);
if (ret != _SUCCESS) if (ret != _SUCCESS)

View file

@ -634,14 +634,8 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
#ifdef CONFIG_LPS #ifdef CONFIG_LPS
/* If EAPOL , ARP , OR DHCP packet, driver must be in active mode. */ /* If EAPOL , ARP , OR DHCP packet, driver must be in active mode. */
#ifdef CONFIG_WAPI_SUPPORT
if ( (pattrib->ether_type == 0x88B4) || (pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1) )
#else
if ( (pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1) ) if ( (pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1) )
#endif
{
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1);
}
#endif #endif
bmcast = IS_MCAST(pattrib->ra); bmcast = IS_MCAST(pattrib->ra);
@ -729,11 +723,6 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
{ {
GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
#ifdef CONFIG_WAPI_SUPPORT
if (pattrib->ether_type == 0x88B4)
pattrib->encrypt=_NO_PRIVACY_;
#endif
switch (psecuritypriv->dot11AuthAlgrthm) switch (psecuritypriv->dot11AuthAlgrthm)
{ {
case dot11AuthAlgrthm_Open: case dot11AuthAlgrthm_Open:
@ -783,14 +772,6 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
pattrib->iv_len = 8; pattrib->iv_len = 8;
pattrib->icv_len = 8; pattrib->icv_len = 8;
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case _SMS4_:
pattrib->iv_len = 18;
pattrib->icv_len = 16;
break;
#endif
default: default:
pattrib->iv_len = 0; pattrib->iv_len = 0;
pattrib->icv_len = 0; pattrib->icv_len = 0;
@ -813,11 +794,6 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr
RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("update_attrib: bswenc=false\n")); RT_TRACE(_module_rtl871x_xmit_c_,_drv_info_,("update_attrib: bswenc=false\n"));
} }
#ifdef CONFIG_WAPI_SUPPORT
if (pattrib->encrypt == _SMS4_)
pattrib->bswenc = false;
#endif
rtw_set_tx_chksum_offload(pkt, pattrib); rtw_set_tx_chksum_offload(pkt, pattrib);
update_attrib_phy_info(pattrib, psta); update_attrib_phy_info(pattrib, psta);
@ -988,10 +964,6 @@ _func_enter_;
case _AES_: case _AES_:
rtw_aes_encrypt(padapter, (u8 * )pxmitframe); rtw_aes_encrypt(padapter, (u8 * )pxmitframe);
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case _SMS4_:
rtw_sms4_encrypt(padapter, (u8 * )pxmitframe);
#endif
default: default:
break; break;
} }
@ -1331,11 +1303,6 @@ _func_enter_;
else else
AES_IV(pattrib->iv, psta->dot11txpn, 0); AES_IV(pattrib->iv, psta->dot11txpn, 0);
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case _SMS4_:
rtw_wapi_get_iv(padapter,pattrib->ra,pattrib->iv);
break;
#endif
} }
} }
@ -2456,16 +2423,6 @@ s32 rtw_xmit(_adapter *padapter, _pkt **ppkt)
res = update_attrib(padapter, *ppkt, &pxmitframe->attrib); res = update_attrib(padapter, *ppkt, &pxmitframe->attrib);
#ifdef CONFIG_WAPI_SUPPORT
if (pxmitframe->attrib.ether_type != 0x88B4)
{
if (rtw_wapi_drop_for_key_absent(padapter, pxmitframe->attrib.ra))
{
WAPI_TRACE(WAPI_RX,"drop for key absend when tx\n");
res = _FAIL;
}
}
#endif
if (res == _FAIL) { if (res == _FAIL) {
RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("rtw_xmit: update attrib fail\n")); RT_TRACE(_module_xmit_osdep_c_, _drv_err_, ("rtw_xmit: update attrib fail\n"));
#ifdef DBG_TX_DROP_FRAME #ifdef DBG_TX_DROP_FRAME

View file

@ -137,12 +137,6 @@ static void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxd
ptxdesc->txdw1 |= cpu_to_le32((0x01<<SEC_TYPE_SHT)&0x00c00000); ptxdesc->txdw1 |= cpu_to_le32((0x01<<SEC_TYPE_SHT)&0x00c00000);
ptxdesc->txdw2 |= cpu_to_le32(0x7 << AMPDU_DENSITY_SHT); ptxdesc->txdw2 |= cpu_to_le32(0x7 << AMPDU_DENSITY_SHT);
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case _SMS4_:
ptxdesc->txdw1 |= cpu_to_le32((0x02<<SEC_TYPE_SHT)&0x00c00000);
ptxdesc->txdw2 |= cpu_to_le32(0x7 << AMPDU_DENSITY_SHT);
break;
#endif
case _AES_: case _AES_:
ptxdesc->txdw1 |= cpu_to_le32((0x03<<SEC_TYPE_SHT)&0x00c00000); ptxdesc->txdw1 |= cpu_to_le32((0x03<<SEC_TYPE_SHT)&0x00c00000);
ptxdesc->txdw2 |= cpu_to_le32(0x7 << AMPDU_DENSITY_SHT); ptxdesc->txdw2 |= cpu_to_le32(0x7 << AMPDU_DENSITY_SHT);

View file

@ -69,10 +69,6 @@ typedef struct _ADAPTER _adapter, ADAPTER,*PADAPTER;
#include <rtw_p2p.h> #include <rtw_p2p.h>
#include <rtw_ap.h> #include <rtw_ap.h>
#ifdef CONFIG_WAPI_SUPPORT
#include <rtw_wapi.h>
#endif
#ifdef CONFIG_DRVEXT_MODULE #ifdef CONFIG_DRVEXT_MODULE
#include <drvext_api.h> #include <drvext_api.h>
#endif #endif
@ -373,12 +369,6 @@ struct _ADAPTER{
struct wifidirect_info wdinfo; struct wifidirect_info wdinfo;
#endif //CONFIG_P2P #endif //CONFIG_P2P
#ifdef CONFIG_WAPI_SUPPORT
u8 WapiSupport;
RT_WAPI_T wapiInfo;
#endif
#ifdef CONFIG_WFD #ifdef CONFIG_WFD
struct wifi_display_info wfd_info; struct wifi_display_info wfd_info;
#endif //CONFIG_WFD #endif //CONFIG_WFD

View file

@ -379,18 +379,8 @@ struct recv_frame_hdr
//for A-MPDU Rx reordering buffer control //for A-MPDU Rx reordering buffer control
struct recv_reorder_ctrl *preorder_ctrl; struct recv_reorder_ctrl *preorder_ctrl;
#ifdef CONFIG_WAPI_SUPPORT
u8 UserPriority;
u8 WapiTempPN[16];
u8 WapiSrcAddr[6];
u8 bWapiCheckPNInDecrypt;
u8 bIsWaiPacket;
#endif
}; };
union recv_frame{ union recv_frame{
union{ union{

View file

@ -1,229 +0,0 @@
#ifndef __INC_WAPI_H
#define __INC_WAPI_H
#include <linux/kernel.h>
#include <linux/list.h>
#include <drv_conf.h>
#include <osdep_service.h>
#include <drv_types.h>
#include <wlan_bssdef.h>
//#include "rtl819x_Qos.h"
#define CONFIG_WAPI_SW_SMS4
#define WAPI_DEBUG
#define SMS4_MIC_LEN 16
#define WAPI_EXT_LEN 18
#define MAX_WAPI_IE_LEN 256
#define sMacHdrLng 24 // octets in data header, no WEP
#ifdef WAPI_DEBUG
/* WAPI trace debug */
extern u32 wapi_debug_component;
static inline void dump_buf(u8 *buf, u32 len)
{
u32 i;
printk("-----------------Len %d----------------\n", len);
for (i=0; i<len; i++)
printk("%2.2x-", *(buf+i));
printk("\n");
}
#define WAPI_TRACE(component, x, args...) \
do { if (wapi_debug_component & (component)) \
printk(KERN_DEBUG "WAPI" ":" x "" , \
##args);\
}while (0);
#define WAPI_DATA(component, x, buf, len) \
do { if (wapi_debug_component & (component)){ \
printk("%s:\n", x);\
dump_buf((buf), (len));}\
}while (0);
#define RT_ASSERT_RET(_Exp) \
if (!(_Exp)) \
{ \
printk("RTWLAN: "); \
printk( "Assertion failed! %s,%s,line=%d\n", \
#_Exp,__func__,__LINE__); \
return; \
}
#define RT_ASSERT_RET_VALUE(_Exp,Ret) \
if (!(_Exp)) \
{ \
printk("RTWLAN: "); \
printk( "Assertion failed! %s,%s,line=%d\n", \
#_Exp,__func__,__LINE__); \
return (Ret); \
}
#else
#define RT_ASSERT_RET(_Exp) do {} while (0)
#define RT_ASSERT_RET_VALUE(_Exp,Ret) do {} while (0)
#define WAPI_TRACE(component, x, args...) do {} while (0)
#define WAPI_DATA(component, x, buf, len) do {} while (0)
#endif
enum WAPI_DEBUG {
WAPI_INIT = 1,
WAPI_API = 1<<1,
WAPI_TX = 1<<2,
WAPI_RX = 1<<3,
WAPI_MLME = 1<<4,
WAPI_IOCTL = 1<<5,
WAPI_ERR = 1<<31
};
#define WAPI_MAX_BKID_NUM 4
#define WAPI_MAX_STAINFO_NUM 4
#define WAPI_CAM_ENTRY_NUM 14 // 28/2=14
typedef struct _RT_WAPI_BKID
{
struct list_head list;
u8 bkid[16];
}RT_WAPI_BKID,*PRT_WAPI_BKID;
typedef struct _RT_WAPI_KEY
{
u8 dataKey[16];
u8 micKey[16];
u8 keyId;
bool bSet;
bool bTxEnable;
}RT_WAPI_KEY,*PRT_WAPI_KEY;
typedef enum _RT_WAPI_PACKET_TYPE
{
WAPI_NONE = 0,
WAPI_PREAUTHENTICATE=1,
WAPI_STAKEY_REQUEST=2,
WAPI_AUTHENTICATE_ACTIVE=3,
WAPI_ACCESS_AUTHENTICATE_REQUEST=4,
WAPI_ACCESS_AUTHENTICATE_RESPONSE=5,
WAPI_CERTIFICATE_AUTHENTICATE_REQUEST=6,
WAPI_CERTIFICATE_AUTHENTICATE_RESPONSE=7,
WAPI_USK_REQUEST=8,
WAPI_USK_RESPONSE=9,
WAPI_USK_CONFIRM=10,
WAPI_MSK_NOTIFICATION=11,
WAPI_MSK_RESPONSE=12
}RT_WAPI_PACKET_TYPE;
typedef struct _RT_WAPI_STA_INFO
{
struct list_head list;
u8 PeerMacAddr[6];
RT_WAPI_KEY wapiUsk;
RT_WAPI_KEY wapiUskUpdate;
RT_WAPI_KEY wapiMsk;
RT_WAPI_KEY wapiMskUpdate;
u8 lastRxUnicastPN[16];
u8 lastTxUnicastPN[16];
u8 lastRxMulticastPN[16];
u8 lastRxUnicastPNBEQueue[16];
u8 lastRxUnicastPNBKQueue[16];
u8 lastRxUnicastPNVIQueue[16];
u8 lastRxUnicastPNVOQueue[16];
bool bSetkeyOk;
bool bAuthenticateInProgress;
bool bAuthenticatorInUpdata;
}RT_WAPI_STA_INFO,*PRT_WAPI_STA_INFO;
//Added for HW wapi en/decryption
typedef struct _RT_WAPI_CAM_ENTRY{
//RT_LIST_ENTRY list;
u8 IsUsed;
u8 entry_idx;//for cam entry
u8 keyidx; // 0 or 1,new or old key
u8 PeerMacAddr[6];
u8 type; //should be 110,wapi
}RT_WAPI_CAM_ENTRY,*PRT_WAPI_CAM_ENTRY;
typedef struct _RT_WAPI_T
{
//BKID
RT_WAPI_BKID wapiBKID[WAPI_MAX_BKID_NUM];
struct list_head wapiBKIDIdleList;
struct list_head wapiBKIDStoreList;
//Key for Tx Multicast/Broadcast
RT_WAPI_KEY wapiTxMsk;
//sec related
u8 lastTxMulticastPN[16];
//STA list
RT_WAPI_STA_INFO wapiSta[WAPI_MAX_STAINFO_NUM];
struct list_head wapiSTAIdleList;
struct list_head wapiSTAUsedList;
//
bool bWapiEnable;
//store WAPI IE
u8 wapiIE[256];
u8 wapiIELength;
bool bWapiPSK;
//last sequece number for wai packet
u16 wapiSeqnumAndFragNum;
int extra_prefix_len;
int extra_postfix_len;
RT_WAPI_CAM_ENTRY wapiCamEntry[WAPI_CAM_ENTRY_NUM];
}RT_WAPI_T,*PRT_WAPI_T;
typedef struct _WLAN_HEADER_WAPI_EXTENSION
{
u8 KeyIdx;
u8 Reserved;
u8 PN[16];
} WLAN_HEADER_WAPI_EXTENSION, *PWLAN_HEADER_WAPI_EXTENSION;
u32 WapiComparePN(u8 *PN1, u8 *PN2);
void rtw_wapi_init(_adapter *padapter);
void rtw_wapi_free(_adapter *padapter);
void rtw_wapi_disable_tx(_adapter *padapter);
u8 rtw_wapi_is_wai_packet(_adapter* padapter,u8 *pkt_data);
void rtw_wapi_update_info(_adapter *padapter, union recv_frame *precv_frame);
u8 rtw_wapi_check_for_drop(_adapter *padapter, union recv_frame *precv_frame);
void rtw_build_probe_resp_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
void rtw_build_beacon_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
void rtw_build_assoc_req_wapi_ie(_adapter *padapter, unsigned char *pframe, struct pkt_attrib *pattrib);
void rtw_wapi_on_assoc_ok(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE);
void rtw_wapi_return_one_sta_info(_adapter *padapter, u8 *MacAddr);
void rtw_wapi_return_all_sta_info(_adapter *padapter);
void rtw_wapi_clear_cam_entry(_adapter *padapter, u8 *pMacAddr);
void rtw_wapi_clear_all_cam_entry(_adapter *padapter);
void rtw_wapi_set_key(_adapter *padapter, RT_WAPI_KEY *pWapiKey, RT_WAPI_STA_INFO *pWapiSta, u8 bGroupKey, u8 bUseDefaultKey);
int rtw_wapi_create_event_send(_adapter *padapter, u8 EventId, u8 *MacAddr, u8 *Buff, u16 BufLen);
u32 rtw_sms4_encrypt(_adapter *padapter, u8 *pxmitframe);
u32 rtw_sms4_decrypt(_adapter *padapter, u8 *precvframe);
void rtw_wapi_get_iv(_adapter *padapter, u8*pRA, u8*IV);
u8 WapiIncreasePN(u8 *PN, u8 AddCount);
bool rtw_wapi_drop_for_key_absent(_adapter *padapter,u8 *pRA);
#endif

View file

@ -1143,21 +1143,4 @@ enum P2P_PS_MODE
#define ICMPV6_MCAST_MAC(mac) ((mac[0]==0x33)&&(mac[1]==0x33)&&(mac[2]!=0xff)) #define ICMPV6_MCAST_MAC(mac) ((mac[0]==0x33)&&(mac[1]==0x33)&&(mac[2]!=0xff))
#endif // CONFIG_TX_MCAST2UNI #endif // CONFIG_TX_MCAST2UNI
#ifdef CONFIG_WAPI_SUPPORT
#ifndef IW_AUTH_WAPI_VERSION_1
#define IW_AUTH_WAPI_VERSION_1 0x00000008
#endif
#ifndef IW_AUTH_KEY_MGMT_WAPI_PSK
#define IW_AUTH_KEY_MGMT_WAPI_PSK 0x04
#endif
#ifndef IW_AUTH_WAPI_ENABLED
#define IW_AUTH_WAPI_ENABLED 0x20
#endif
#ifndef IW_ENCODE_ALG_SM4
#define IW_ENCODE_ALG_SM4 0x20
#endif
#endif
#endif // _WIFI_H_ #endif // _WIFI_H_

View file

@ -1039,14 +1039,9 @@ _func_enter_;
goto exit; goto exit;
} }
} else { } else {
#ifdef CONFIG_WAPI_SUPPORT
if (strcmp(param->u.crypt.alg, "SMS4"))
#endif
{
ret = -EINVAL; ret = -EINVAL;
goto exit; goto exit;
} }
}
if (strcmp(param->u.crypt.alg, "WEP") == 0) if (strcmp(param->u.crypt.alg, "WEP") == 0)
{ {
@ -1179,77 +1174,7 @@ _func_enter_;
} }
} }
} }
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode
{
} }
}
#ifdef CONFIG_WAPI_SUPPORT
if (strcmp(param->u.crypt.alg, "SMS4") == 0)
{
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
PRT_WAPI_STA_INFO pWapiSta;
u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
if (param->u.crypt.set_tx == 1)
{
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
if (_rtw_memcmp(pWapiSta->PeerMacAddr,param->sta_addr,6))
{
_rtw_memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
pWapiSta->wapiUsk.bSet = true;
_rtw_memcpy(pWapiSta->wapiUsk.dataKey,param->u.crypt.key,16);
_rtw_memcpy(pWapiSta->wapiUsk.micKey,param->u.crypt.key+16,16);
pWapiSta->wapiUsk.keyId = param->u.crypt.idx ;
pWapiSta->wapiUsk.bTxEnable = true;
_rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPN,WapiAEPNInitialValueSrc,16);
pWapiSta->wapiUskUpdate.bTxEnable = false;
pWapiSta->wapiUskUpdate.bSet = false;
if (psecuritypriv->sw_encrypt== false || psecuritypriv->sw_decrypt == false)
{
//set unicast key for ASUE
rtw_wapi_set_key(padapter, &pWapiSta->wapiUsk, pWapiSta, false, false);
}
}
}
}
else
{
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
if (_rtw_memcmp(pWapiSta->PeerMacAddr,get_bssid(pmlmepriv),6))
{
pWapiSta->wapiMsk.bSet = true;
_rtw_memcpy(pWapiSta->wapiMsk.dataKey,param->u.crypt.key,16);
_rtw_memcpy(pWapiSta->wapiMsk.micKey,param->u.crypt.key+16,16);
pWapiSta->wapiMsk.keyId = param->u.crypt.idx ;
pWapiSta->wapiMsk.bTxEnable = false;
if (!pWapiSta->bSetkeyOk)
pWapiSta->bSetkeyOk = true;
pWapiSta->bAuthenticateInProgress = false;
_rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16);
if (psecuritypriv->sw_decrypt == false)
{
//set rx broadcast key for ASUE
rtw_wapi_set_key(padapter, &pWapiSta->wapiMsk, pWapiSta, true, false);
}
}
}
}
}
#endif
exit: exit:
@ -1311,23 +1236,6 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
case WLAN_CIPHER_SUITE_CCMP: case WLAN_CIPHER_SUITE_CCMP:
alg_name = "CCMP"; alg_name = "CCMP";
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case WLAN_CIPHER_SUITE_SMS4:
alg_name= "SMS4";
if (pairwise == NL80211_KEYTYPE_PAIRWISE) {
if (key_index != 0 && key_index != 1) {
ret = -ENOTSUPP;
goto addkey_end;
}
_rtw_memcpy((void*)param->sta_addr, (void*)mac_addr, ETH_ALEN);
} else {
DBG_88E("mac_addr is null\n");
}
DBG_88E("rtw_wx_set_enc_ext: SMS4 case\n");
break;
#endif
default: default:
ret = -ENOTSUPP; ret = -ENOTSUPP;
goto addkey_end; goto addkey_end;
@ -2043,28 +1951,15 @@ static int rtw_cfg80211_set_auth_type(struct security_priv *psecuritypriv,
if (psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA) if (psecuritypriv->ndisauthtype>Ndis802_11AuthModeWPA)
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
#ifdef CONFIG_WAPI_SUPPORT
if (psecuritypriv->ndisauthtype == Ndis802_11AuthModeWAPI)
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
#endif
break; break;
case NL80211_AUTHTYPE_SHARED_KEY: case NL80211_AUTHTYPE_SHARED_KEY:
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Shared;
psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
break; break;
default: default:
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
//return -ENOTSUPP;
} }
return 0; return 0;
} }
static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 cipher, bool ucast) static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 cipher, bool ucast)
@ -2087,12 +1982,6 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 ciph
case IW_AUTH_CIPHER_NONE: case IW_AUTH_CIPHER_NONE:
*profile_cipher = _NO_PRIVACY_; *profile_cipher = _NO_PRIVACY_;
ndisencryptstatus = Ndis802_11EncryptionDisabled; ndisencryptstatus = Ndis802_11EncryptionDisabled;
#ifdef CONFIG_WAPI_SUPPORT
if (psecuritypriv->dot11PrivacyAlgrthm ==_SMS4_ )
{
*profile_cipher = _SMS4_;
}
#endif
break; break;
case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP40:
*profile_cipher = _WEP40_; *profile_cipher = _WEP40_;
@ -2110,12 +1999,6 @@ static int rtw_cfg80211_set_cipher(struct security_priv *psecuritypriv, u32 ciph
*profile_cipher = _AES_; *profile_cipher = _AES_;
ndisencryptstatus = Ndis802_11Encryption3Enabled; ndisencryptstatus = Ndis802_11Encryption3Enabled;
break; break;
#ifdef CONFIG_WAPI_SUPPORT
case WLAN_CIPHER_SUITE_SMS4:
*profile_cipher = _SMS4_;
ndisencryptstatus = Ndis802_11_EncrypteionWAPI;
break;
#endif
default: default:
DBG_88E("Unsupported cipher: 0x%x\n", cipher); DBG_88E("Unsupported cipher: 0x%x\n", cipher);
return -ENOTSUPP; return -ENOTSUPP;
@ -2141,22 +2024,9 @@ static int rtw_cfg80211_set_key_mgt(struct security_priv *psecuritypriv, u32 key
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
else if (key_mgt == WLAN_AKM_SUITE_PSK) { else if (key_mgt == WLAN_AKM_SUITE_PSK) {
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
} } else {
#ifdef CONFIG_WAPI_SUPPORT
else if (key_mgt ==WLAN_AKM_SUITE_WAPI_PSK){
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
}
else if (key_mgt ==WLAN_AKM_SUITE_WAPI_CERT){
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
}
#endif
else {
DBG_88E("Invalid key mgt: 0x%x\n", key_mgt); DBG_88E("Invalid key mgt: 0x%x\n", key_mgt);
//return -EINVAL;
} }
return 0; return 0;
} }
@ -2524,31 +2394,11 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system
psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen;
#ifdef CONFIG_WAPI_SUPPORT
padapter->wapiInfo.bWapiEnable = false;
#endif
ret = rtw_cfg80211_set_wpa_version(psecuritypriv, sme->crypto.wpa_versions); ret = rtw_cfg80211_set_wpa_version(psecuritypriv, sme->crypto.wpa_versions);
if (ret < 0) if (ret < 0)
goto exit; goto exit;
#ifdef CONFIG_WAPI_SUPPORT
if (sme->crypto.wpa_versions & NL80211_WAPI_VERSION_1)
{
padapter->wapiInfo.bWapiEnable = true;
padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN;
padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN;
}
#endif
ret = rtw_cfg80211_set_auth_type(psecuritypriv, sme->auth_type); ret = rtw_cfg80211_set_auth_type(psecuritypriv, sme->auth_type);
#ifdef CONFIG_WAPI_SUPPORT
if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_WAPI)
padapter->mlmeextpriv.mlmext_info.auth_algo = psecuritypriv->dot11AuthAlgrthm;
#endif
if (ret < 0) if (ret < 0)
goto exit; goto exit;
@ -2636,15 +2486,6 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
goto exit; goto exit;
} }
#ifdef CONFIG_WAPI_SUPPORT
if (sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_PSK){
padapter->wapiInfo.bWapiPSK = true;
}
else if (sme->crypto.akm_suites[0] ==WLAN_AKM_SUITE_WAPI_CERT){
padapter->wapiInfo.bWapiPSK = false;
}
#endif
authmode = psecuritypriv->ndisauthtype; authmode = psecuritypriv->ndisauthtype;
rtw_set_802_11_authentication_mode(padapter, authmode); rtw_set_802_11_authentication_mode(padapter, authmode);

View file

@ -589,48 +589,6 @@ static char *translate_scan(_adapter *padapter,
} }
} }
#ifdef CONFIG_WAPI_SUPPORT
{
sint out_len_wapi=0;
/* here use static for stack size */
static u8 buf_wapi[MAX_WAPI_IE_LEN];
static u8 wapi_ie[MAX_WAPI_IE_LEN];
u16 wapi_len=0;
u16 i;
_rtw_memset(buf_wapi, 0, MAX_WAPI_IE_LEN);
_rtw_memset(wapi_ie, 0, MAX_WAPI_IE_LEN);
out_len_wapi=rtw_get_wapi_ie(pnetwork->network.IEs ,pnetwork->network.IELength,wapi_ie,&wapi_len);
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_scan: ssid=%s\n",pnetwork->network.Ssid.Ssid));
RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_wx_get_scan: wapi_len=%d\n",wapi_len));
DBG_88E("rtw_wx_get_scan: %s ",pnetwork->network.Ssid.Ssid);
DBG_88E("rtw_wx_get_scan: ssid = %d ",wapi_len);
if (wapi_len > 0)
{
p=buf_wapi;
_rtw_memset(buf_wapi, 0, MAX_WAPI_IE_LEN);
p += sprintf(p, "wapi_ie=");
for (i = 0; i < wapi_len; i++) {
p += sprintf(p, "%02x", wapi_ie[i]);
}
_rtw_memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = strlen(buf_wapi);
start = iwe_stream_add_point(info, start, stop, &iwe,buf_wapi);
_rtw_memset(&iwe, 0, sizeof(iwe));
iwe.cmd =IWEVGENIE;
iwe.u.data.length = wapi_len;
start = iwe_stream_add_point(info, start, stop, &iwe, wapi_ie);
}
}
#endif
{ {
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
u8 ss, sq; u8 ss, sq;
@ -750,15 +708,9 @@ _func_enter_;
goto exit; goto exit;
} }
} else { } else {
#ifdef CONFIG_WAPI_SUPPORT
if (strcmp(param->u.crypt.alg, "SMS4"))
#endif
{
ret = -EINVAL; ret = -EINVAL;
goto exit; goto exit;
} }
}
if (strcmp(param->u.crypt.alg, "WEP") == 0) if (strcmp(param->u.crypt.alg, "WEP") == 0)
{ {
@ -922,76 +874,7 @@ _func_enter_;
} }
} }
} }
else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) //adhoc mode
{
} }
}
#ifdef CONFIG_WAPI_SUPPORT
if (strcmp(param->u.crypt.alg, "SMS4") == 0)
{
PRT_WAPI_T pWapiInfo = &padapter->wapiInfo;
PRT_WAPI_STA_INFO pWapiSta;
u8 WapiASUEPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
u8 WapiAEPNInitialValueSrc[16] = {0x37,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
u8 WapiAEMultiCastPNInitialValueSrc[16] = {0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C,0x36,0x5C} ;
if (param->u.crypt.set_tx == 1)
{
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
if (!memcmp(pWapiSta->PeerMacAddr,param->sta_addr,6))
{
_rtw_memcpy(pWapiSta->lastTxUnicastPN,WapiASUEPNInitialValueSrc,16);
pWapiSta->wapiUsk.bSet = true;
_rtw_memcpy(pWapiSta->wapiUsk.dataKey,param->u.crypt.key,16);
_rtw_memcpy(pWapiSta->wapiUsk.micKey,param->u.crypt.key+16,16);
pWapiSta->wapiUsk.keyId = param->u.crypt.idx ;
pWapiSta->wapiUsk.bTxEnable = true;
_rtw_memcpy(pWapiSta->lastRxUnicastPNBEQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPNBKQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPNVIQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPNVOQueue,WapiAEPNInitialValueSrc,16);
_rtw_memcpy(pWapiSta->lastRxUnicastPN,WapiAEPNInitialValueSrc,16);
pWapiSta->wapiUskUpdate.bTxEnable = false;
pWapiSta->wapiUskUpdate.bSet = false;
if (psecuritypriv->sw_encrypt== false || psecuritypriv->sw_decrypt == false)
{
//set unicast key for ASUE
rtw_wapi_set_key(padapter, &pWapiSta->wapiUsk, pWapiSta, false, false);
}
}
}
}
else
{
list_for_each_entry(pWapiSta, &pWapiInfo->wapiSTAUsedList, list) {
if (!memcmp(pWapiSta->PeerMacAddr,get_bssid(pmlmepriv),6))
{
pWapiSta->wapiMsk.bSet = true;
_rtw_memcpy(pWapiSta->wapiMsk.dataKey,param->u.crypt.key,16);
_rtw_memcpy(pWapiSta->wapiMsk.micKey,param->u.crypt.key+16,16);
pWapiSta->wapiMsk.keyId = param->u.crypt.idx ;
pWapiSta->wapiMsk.bTxEnable = false;
if (!pWapiSta->bSetkeyOk)
pWapiSta->bSetkeyOk = true;
pWapiSta->bAuthenticateInProgress = false;
_rtw_memcpy(pWapiSta->lastRxMulticastPN, WapiAEMultiCastPNInitialValueSrc, 16);
if (psecuritypriv->sw_decrypt == false)
{
//set rx broadcast key for ASUE
rtw_wapi_set_key(padapter, &pWapiSta->wapiMsk, pWapiSta, true, false);
}
}
}
}
}
#endif
exit: exit:
@ -2770,21 +2653,6 @@ static int rtw_wx_set_auth(struct net_device *dev,
switch (param->flags & IW_AUTH_INDEX) { switch (param->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION: case IW_AUTH_WPA_VERSION:
#ifdef CONFIG_WAPI_SUPPORT
#ifndef CONFIG_IOCTL_CFG80211
padapter->wapiInfo.bWapiEnable = false;
if (value == IW_AUTH_WAPI_VERSION_1)
{
padapter->wapiInfo.bWapiEnable = true;
psecuritypriv->dot11PrivacyAlgrthm = _SMS4_;
psecuritypriv->dot118021XGrpPrivacy = _SMS4_;
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_WAPI;
pmlmeinfo->auth_algo = psecuritypriv->dot11AuthAlgrthm;
padapter->wapiInfo.extra_prefix_len = WAPI_EXT_LEN;
padapter->wapiInfo.extra_postfix_len = SMS4_MIC_LEN;
}
#endif
#endif
break; break;
case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_PAIRWISE:
@ -2793,21 +2661,10 @@ static int rtw_wx_set_auth(struct net_device *dev,
break; break;
case IW_AUTH_KEY_MGMT: case IW_AUTH_KEY_MGMT:
#ifdef CONFIG_WAPI_SUPPORT
#ifndef CONFIG_IOCTL_CFG80211
DBG_88E("rtw_wx_set_auth: IW_AUTH_KEY_MGMT case\n");
if (value == IW_AUTH_KEY_MGMT_WAPI_PSK)
padapter->wapiInfo.bWapiPSK = true;
else
padapter->wapiInfo.bWapiPSK = false;
DBG_88E("rtw_wx_set_auth: IW_AUTH_KEY_MGMT bwapipsk %d\n",padapter->wapiInfo.bWapiPSK);
#endif
#endif
/* /*
* ??? does not use these parameters * ??? does not use these parameters
*/ */
break; break;
case IW_AUTH_TKIP_COUNTERMEASURES: case IW_AUTH_TKIP_COUNTERMEASURES:
{ {
if (param->value) if (param->value)
@ -2852,7 +2709,6 @@ static int rtw_wx_set_auth(struct net_device *dev,
} }
case IW_AUTH_80211_AUTH_ALG: case IW_AUTH_80211_AUTH_ALG:
#if defined(CONFIG_ANDROID) || 1 #if defined(CONFIG_ANDROID) || 1
/* /*
* It's the starting point of a link layer connection using wpa_supplicant * It's the starting point of a link layer connection using wpa_supplicant
@ -2865,41 +2721,16 @@ static int rtw_wx_set_auth(struct net_device *dev,
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter, 1);
} }
#endif #endif
ret = wpa_set_auth_algs(dev, (u32)param->value); ret = wpa_set_auth_algs(dev, (u32)param->value);
break; break;
case IW_AUTH_WPA_ENABLED: case IW_AUTH_WPA_ENABLED:
//if (param->value)
// padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; //802.1x
//else
// padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open;//open system
//_disassociate(priv);
break; break;
case IW_AUTH_RX_UNENCRYPTED_EAPOL: case IW_AUTH_RX_UNENCRYPTED_EAPOL:
//ieee->ieee802_1x = param->value;
break; break;
case IW_AUTH_PRIVACY_INVOKED: case IW_AUTH_PRIVACY_INVOKED:
//ieee->privacy_invoked = param->value;
break; break;
#ifdef CONFIG_WAPI_SUPPORT
#ifndef CONFIG_IOCTL_CFG80211
case IW_AUTH_WAPI_ENABLED:
break;
#endif
#endif
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return ret; return ret;
@ -2943,15 +2774,6 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
case IW_ENCODE_ALG_CCMP: case IW_ENCODE_ALG_CCMP:
alg_name = "CCMP"; alg_name = "CCMP";
break; break;
#ifdef CONFIG_WAPI_SUPPORT
#ifndef CONFIG_IOCTL_CFG80211
case IW_ENCODE_ALG_SM4:
alg_name= "SMS4";
_rtw_memcpy(param->sta_addr, pext->addr.sa_data, ETH_ALEN);
DBG_88E("rtw_wx_set_enc_ext: SMS4 case\n");
break;
#endif
#endif
default: default:
return -1; return -1;
} }
@ -2975,16 +2797,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,
param->u.crypt.idx = (pencoding->flags&0x00FF) -1 ; param->u.crypt.idx = (pencoding->flags&0x00FF) -1 ;
if (pext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) if (pext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
{
#ifdef CONFIG_WAPI_SUPPORT
#ifndef CONFIG_IOCTL_CFG80211
if (pext->alg == IW_ENCODE_ALG_SM4)
_rtw_memcpy(param->u.crypt.seq, pext->rx_seq, 16);
else
#endif
#endif
_rtw_memcpy(param->u.crypt.seq, pext->rx_seq, 8); _rtw_memcpy(param->u.crypt.seq, pext->rx_seq, 8);
}
if (pext->key_len) if (pext->key_len)
{ {

View file

@ -1226,11 +1226,6 @@ _func_enter_;
} }
#endif //CONFIG_INTEL_WIDI #endif //CONFIG_INTEL_WIDI
#ifdef CONFIG_WAPI_SUPPORT
padapter->WapiSupport = true; //set true temp, will revise according to Efuse or Registry value later.
rtw_wapi_init(padapter);
#endif
#ifdef CONFIG_BR_EXT #ifdef CONFIG_BR_EXT
_rtw_spinlock_init(&padapter->br_ext_lock); _rtw_spinlock_init(&padapter->br_ext_lock);
#endif // CONFIG_BR_EXT #endif // CONFIG_BR_EXT
@ -1298,10 +1293,6 @@ u8 rtw_free_drv_sw(_adapter *padapter)
RT_TRACE(_module_os_intfs_c_,_drv_info_,("==>rtw_free_drv_sw")); RT_TRACE(_module_os_intfs_c_,_drv_info_,("==>rtw_free_drv_sw"));
#ifdef CONFIG_WAPI_SUPPORT
rtw_wapi_free(padapter);
#endif
//we can call rtw_p2p_enable here, but: //we can call rtw_p2p_enable here, but:
// 1. rtw_p2p_enable may have IO operation // 1. rtw_p2p_enable may have IO operation
// 2. rtw_p2p_enable is bundled with wext interface // 2. rtw_p2p_enable is bundled with wext interface
@ -1689,12 +1680,7 @@ static int netdev_close(struct net_device *pnetdev)
padapter->rtw_wdev->iftype = NL80211_IFTYPE_MONITOR; //set this at the end padapter->rtw_wdev->iftype = NL80211_IFTYPE_MONITOR; //set this at the end
#endif //CONFIG_IOCTL_CFG80211 #endif //CONFIG_IOCTL_CFG80211
#ifdef CONFIG_WAPI_SUPPORT
rtw_wapi_disable_tx(padapter);
#endif
RT_TRACE(_module_os_intfs_c_,_drv_info_,("-88eu_drv - drv_close\n")); RT_TRACE(_module_os_intfs_c_,_drv_info_,("-88eu_drv - drv_close\n"));
DBG_88E("-88eu_drv - drv_close, bup=%d\n", padapter->bup); DBG_88E("-88eu_drv - drv_close, bup=%d\n", padapter->bup);
return 0; return 0;
} }

View file

@ -248,17 +248,8 @@ _func_enter_;
} }
#endif #endif
#ifdef CONFIG_WAPI_SUPPORT
if (rtw_wapi_check_for_drop(padapter,precv_frame))
{
WAPI_TRACE(WAPI_ERR, "%s(): Rx Reorder Drop case!!\n", __func__);
goto _recv_indicatepkt_drop;
}
#endif
skb = precv_frame->u.hdr.pkt; skb = precv_frame->u.hdr.pkt;
if (skb == NULL) if (skb == NULL) {
{
RT_TRACE(_module_recv_osdep_c_,_drv_err_,("rtw_recv_indicatepkt():skb==NULL something wrong!!!!\n")); RT_TRACE(_module_recv_osdep_c_,_drv_err_,("rtw_recv_indicatepkt():skb==NULL something wrong!!!!\n"));
goto _recv_indicatepkt_drop; goto _recv_indicatepkt_drop;
} }