if (!(ieee->host_encrypt || ieee->host_decrypt)) 
if (group_key ? !ieee->host_mc_decrypt : !(ieee->host_encrypt || ieee->host_decrypt || ieee->host_encrypt_msdu)) 
int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,			       struct iw_request_info *info,			       union iwreq_data *wrqu, char *extra){	struct net_device *dev = ieee->dev;	struct iw_point *encoding = &wrqu->encoding;	struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;	int i, idx, ret = 0;	const char *alg, *module;	struct ieee80211_crypto_ops *ops;	struct ieee80211_crypt_data **crypt;	struct ieee80211_security sec = {		.flags = 0,	};	idx = encoding->flags & IW_ENCODE_INDEX;	if (idx) {		if (idx < 1 || idx > WEP_KEYS)			return -EINVAL;		idx--;	} else		idx = ieee->tx_keyidx;	if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY)		crypt = &ieee->crypt[idx];	else {		if (idx != 0)			return -EINVAL;		if (ieee->iw_mode == IW_MODE_INFRA)			crypt = &ieee->crypt[idx];		else			return -EINVAL;	}	sec.flags |= SEC_ENABLED | SEC_ENCRYPT;	if ((encoding->flags & IW_ENCODE_DISABLED) ||	    ext->alg == IW_ENCODE_ALG_NONE) {		if (*crypt)			ieee80211_crypt_delayed_deinit(ieee, crypt);		for (i = 0; i < WEP_KEYS; i++)			if (ieee->crypt[i] != NULL)				break;		if (i == WEP_KEYS) {			sec.enabled = 0;			sec.encrypt = 0;			sec.level = SEC_LEVEL_0;			sec.flags |= SEC_LEVEL;		}		goto done;	}	sec.enabled = 1;	sec.encrypt = 1;	if (!(ieee->host_encrypt || ieee->host_decrypt))		goto skip_host_crypt;	switch (ext->alg) {	case IW_ENCODE_ALG_WEP:		alg = "WEP";		module = "ieee80211_crypt_wep";		break;	case IW_ENCODE_ALG_TKIP:		alg = "TKIP";		module = "ieee80211_crypt_tkip";		break;	case IW_ENCODE_ALG_CCMP:		alg = "CCMP";		module = "ieee80211_crypt_ccmp";		break;	default:		IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",				   dev->name, ext->alg);		ret = -EINVAL;		goto done;	}	ops = ieee80211_get_crypto_ops(alg);	if (ops == NULL) {		request_module(module);		ops = ieee80211_get_crypto_ops(alg);	}	if (ops == NULL) {		IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",				   dev->name, ext->alg);		ret = -EINVAL;		goto done;	}	if (*crypt == NULL || (*crypt)->ops != ops) {		struct ieee80211_crypt_data *new_crypt;		ieee80211_crypt_delayed_deinit(ieee, crypt);		new_crypt = (struct ieee80211_crypt_data *)		    kmalloc(sizeof(*new_crypt), GFP_KERNEL);		if (new_crypt == NULL) {			ret = -ENOMEM;			goto done;		}		memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));		new_crypt->ops = ops;		if (new_crypt->ops && try_module_get(new_crypt->ops->owner))			new_crypt->priv = new_crypt->ops->init(ieee, idx);		if (new_crypt->priv == NULL) {			kfree(new_crypt);			ret = -EINVAL;			goto done;		}		*crypt = new_crypt;	}	if (ext->key_len > 0 && (*crypt)->ops->set_key &&	    (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,				   (*crypt)->priv) < 0) {		IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name);		ret = -EINVAL;		goto done;	}      skip_host_crypt:	if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {		ieee->tx_keyidx = idx;		sec.active_key = idx;		sec.flags |= SEC_ACTIVE_KEY;	}	if (ext->alg != IW_ENCODE_ALG_NONE) {		memcpy(sec.keys[idx], ext->key, ext->key_len);		sec.key_sizes[idx] = ext->key_len;		sec.flags |= (1 << idx);		if (ext->alg == IW_ENCODE_ALG_WEP) {			sec.encode_alg[idx] = SEC_ALG_WEP;			sec.flags |= SEC_LEVEL;			sec.level = SEC_LEVEL_1;		} else if (ext->alg == IW_ENCODE_ALG_TKIP) {			sec.encode_alg[idx] = SEC_ALG_TKIP;			sec.flags |= SEC_LEVEL;			sec.level = SEC_LEVEL_2;		} else if (ext->alg == IW_ENCODE_ALG_CCMP) {			sec.encode_alg[idx] = SEC_ALG_CCMP;			sec.flags |= SEC_LEVEL;			sec.level = SEC_LEVEL_3;		}	}      done:	if (ieee->set_security)		ieee->set_security(ieee->dev, &sec);	/*	 * Do not reset port if card is in Managed mode since resetting will	 * generate new IEEE 802.11 authentication which may end up in looping	 * with IEEE 802.1X. If your hardware requires a reset after WEP	 * configuration (for example... Prism2), implement the reset_port in	 * the callbacks structures used to initialize the 802.11 stack.	 */	if (ieee->reset_on_keychange &&	    ieee->iw_mode != IW_MODE_INFRA &&	    ieee->reset_port && ieee->reset_port(dev)) {		IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name);		return -EINVAL;	}	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/ccd0fda3a6d9186d067893114f65b8df758d5a1f/ieee80211_wx.c/clean/net/ieee80211/ieee80211_wx.c