if (ops->name != NULL) { if (strcmp(ops->name, "WEP") == 0) { memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, param->u.crypt.key_len); sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; sec.flags |= (1 << param->u.crypt.idx); 
if (param->u.crypt.alg != NULL) { memcpy(sec.keys[param->u.crypt.idx], param->u.crypt.key, param->u.crypt.key_len); sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; sec.flags |= (1 << param->u.crypt.idx);  if (strcmp(param->u.crypt.alg, "WEP") == 0) { 
static int ipw_wpa_set_encryption(struct net_device *dev,				  struct ipw_param *param, int param_len){	int ret = 0;	struct ipw_priv *priv = ieee80211_priv(dev);	struct ieee80211_device *ieee = priv->ieee;	struct ieee80211_crypto_ops *ops;	struct ieee80211_crypt_data **crypt;	struct ieee80211_security sec = {		.flags = 0,	};	param->u.crypt.err = 0;	param->u.crypt.alg[IPW_CRYPT_ALG_NAME_LEN - 1] = '\0';	if (param_len !=	    (int)((char *)param->u.crypt.key - (char *)param) +	    param->u.crypt.key_len) {		IPW_DEBUG_INFO("Len mismatch %d, %d\n", param_len,			       param->u.crypt.key_len);		return -EINVAL;	}	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {		if (param->u.crypt.idx >= WEP_KEYS)			return -EINVAL;		crypt = &ieee->crypt[param->u.crypt.idx];	} else {		return -EINVAL;	}	if (strcmp(param->u.crypt.alg, "none") == 0) {		if (crypt) {			sec.enabled = 0;			sec.level = SEC_LEVEL_0;			sec.flags |= SEC_ENABLED | SEC_LEVEL;			ieee80211_crypt_delayed_deinit(ieee, crypt);		}		goto done;	}	sec.enabled = 1;	sec.flags |= SEC_ENABLED;	ops = ieee80211_get_crypto_ops(param->u.crypt.alg);	if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {		request_module("ieee80211_crypt_wep");		ops = ieee80211_get_crypto_ops(param->u.crypt.alg);	} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {		request_module("ieee80211_crypt_tkip");		ops = ieee80211_get_crypto_ops(param->u.crypt.alg);	} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {		request_module("ieee80211_crypt_ccmp");		ops = ieee80211_get_crypto_ops(param->u.crypt.alg);	}	if (ops == NULL) {		IPW_DEBUG_INFO("%s: unknown crypto alg '%s'\n",			       dev->name, param->u.crypt.alg);		param->u.crypt.err = IPW_CRYPT_ERR_UNKNOWN_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(param->u.crypt.idx);		if (new_crypt->priv == NULL) {			kfree(new_crypt);			param->u.crypt.err = IPW_CRYPT_ERR_CRYPT_INIT_FAILED;			ret = -EINVAL;			goto done;		}		*crypt = new_crypt;	}	if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key &&	    (*crypt)->ops->set_key(param->u.crypt.key,				   param->u.crypt.key_len, param->u.crypt.seq,				   (*crypt)->priv) < 0) {		IPW_DEBUG_INFO("%s: key setting failed\n", dev->name);		param->u.crypt.err = IPW_CRYPT_ERR_KEY_SET_FAILED;		ret = -EINVAL;		goto done;	}	if (param->u.crypt.set_tx) {		ieee->tx_keyidx = param->u.crypt.idx;		sec.active_key = param->u.crypt.idx;		sec.flags |= SEC_ACTIVE_KEY;	}	if (ops->name != NULL) {		if (strcmp(ops->name, "WEP") == 0) {			memcpy(sec.keys[param->u.crypt.idx],			       param->u.crypt.key, param->u.crypt.key_len);			sec.key_sizes[param->u.crypt.idx] =			    param->u.crypt.key_len;			sec.flags |= (1 << param->u.crypt.idx);			sec.flags |= SEC_LEVEL;			sec.level = SEC_LEVEL_1;		} else if (strcmp(ops->name, "TKIP") == 0) {			sec.flags |= SEC_LEVEL;			sec.level = SEC_LEVEL_2;		} else if (strcmp(ops->name, "CCMP") == 0) {			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)) {		IPW_DEBUG_INFO("%s: reset_port failed\n", dev->name);		param->u.crypt.err = IPW_CRYPT_ERR_CARD_CONF_FAILED;		return -EINVAL;	}	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b095c3819805f87d73d41641a53e4c070360d783/ipw2200.c/buggy/drivers/net/wireless/ipw2200.c