return res;
}
-static int set_group_key(struct rtw_adapter *padapter, u8 *key, u32 alg,
+static int set_group_key(struct rtw_adapter *padapter, const u8 *key, u32 alg,
u8 keyid)
{
u8 keylen;
return res;
}
-static int set_wep_key(struct rtw_adapter *padapter, u8 *key, u16 keylen,
+static int set_wep_key(struct rtw_adapter *padapter, const u8 *key, u16 keylen,
u8 keyid)
{
u32 alg;
struct key_params *keyparms)
{
int ret = 0;
- u16 wep_key_len;
+ int key_len;
u8 wep_key_idx;
struct sta_info *psta = NULL, *pbcmc_sta = NULL;
struct rtw_adapter *padapter = netdev_priv(dev);
goto exit;
}
+ key_len = keyparms->key_len;
+
if (!psta && (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 ||
keyparms->cipher == WLAN_CIPHER_SUITE_WEP104)) {
DBG_8723A("r871x_set_encryption, crypt.alg = WEP\n");
wep_key_idx = param->u.crypt.idx;
- wep_key_len = param->u.crypt.key_len;
DBG_8723A("r871x_set_encryption, wep_key_idx =%d, len =%d\n",
- wep_key_idx, wep_key_len);
+ wep_key_idx, key_len);
- if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) {
+ if (wep_key_idx >= WEP_KEYS || key_len <= 0) {
ret = -EINVAL;
goto exit;
}
- if (wep_key_len > 0) {
- wep_key_len = wep_key_len <= 5 ? 5 : 13;
+ if (key_len > 0) {
+ key_len = key_len <= 5 ? 5 : 13;
}
if (psecuritypriv->bWepDefaultKeyIdxSet == 0) {
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP40;
- if (wep_key_len == 13) {
+ if (key_len == 13) {
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP104;
}
}
memcpy(&psecuritypriv->wep_key[wep_key_idx].key,
- param->u.crypt.key, wep_key_len);
+ keyparms->key, key_len);
- psecuritypriv->wep_key[wep_key_idx].keylen = wep_key_len;
+ psecuritypriv->wep_key[wep_key_idx].keylen = key_len;
- set_wep_key(padapter, param->u.crypt.key, wep_key_len,
- wep_key_idx);
+ set_wep_key(padapter, keyparms->key, key_len, wep_key_idx);
goto exit;
memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.idx].
- skey, param->u.crypt.key,
- (param->u.crypt.key_len >
- 16 ? 16 : param->u.crypt.key_len));
+ skey, keyparms->key,
+ (key_len > 16 ? 16 : key_len));
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_WEP40;
- if (param->u.crypt.key_len == 13) {
+ if (key_len == 13) {
psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_WEP104;
}
memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.idx].
skey, param->u.crypt.key,
- (param->u.crypt.key_len >
- 16 ? 16 : param->u.crypt.key_len));
+ (key_len > 16 ? 16 : key_len));
/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
/* set mic key */
memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.idx].
skey, param->u.crypt.key,
- (param->u.crypt.key_len >
- 16 ? 16 : param->u.crypt.key_len));
+ (key_len > 16 ? 16 : key_len));
} else {
DBG_8723A("%s, set group_key, none\n",
__func__);
/* pairwise key */
memcpy(psta->dot118021x_UncstKey.skey,
param->u.crypt.key,
- (param->u.crypt.key_len >
- 16 ? 16 : param->u.crypt.key_len));
+ (key_len > 16 ? 16 : key_len));
if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 ||
keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) {
psta->dot118021XPrivacy =
WLAN_CIPHER_SUITE_WEP40;
- if (param->u.crypt.key_len == 13) {
+ if (key_len == 13) {
psta->dot118021XPrivacy =
WLAN_CIPHER_SUITE_WEP104;
}
dot118021XGrpKey[param->u.crypt.
idx].skey,
param->u.crypt.key,
- (param->u.crypt.key_len >
- 16 ? 16 : param->u.crypt.key_len));
+ (key_len > 16 ? 16 : key_len));
psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_WEP40;
- if (param->u.crypt.key_len == 13) {
+ if (key_len == 13) {
psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_WEP104;
}
dot118021XGrpKey[param->u.crypt.
idx].skey,
param->u.crypt.key,
- (param->u.crypt.key_len >
- 16 ? 16 : param->u.crypt.key_len));
+ (key_len > 16 ? 16 : key_len));
/* DEBUG_ERR("set key length :param->u"
".crypt.key_len =%d\n",
dot118021XGrpKey[param->u.crypt.
idx].skey,
param->u.crypt.key,
- (param->u.crypt.key_len >
- 16 ? 16 : param->u.crypt.key_len));
+ (key_len > 16 ? 16 : key_len));
} else {
psecuritypriv->dot118021XGrpPrivacy = 0;
}