aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ps3_gelic_wireless.c
diff options
context:
space:
mode:
authorMasakazu Mokuno <mokuno@sm.sony.co.jp>2008-05-30 03:52:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-03 15:00:28 -0400
commit04b2046c856e36c3c9cf382adb2c0bc8ba780cf7 (patch)
tree088d2849e5dbc178ec5211df5b15357a541524f4 /drivers/net/ps3_gelic_wireless.c
parentba569b4c68f11906da2996ee252bcff0df61cb90 (diff)
PS3: gelic: Use the new PMK interface in the gelic driver
With the new WEXT flags, the PS3 wireless driver can tell the user space that it would do handle 4-way handshake by itself and needs the PSK without private ioctls. Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/ps3_gelic_wireless.c')
-rw-r--r--drivers/net/ps3_gelic_wireless.c46
1 files changed, 12 insertions, 34 deletions
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index 4bc6eaae23ca..5f698099e9b7 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -350,7 +350,8 @@ static int gelic_wl_get_range(struct net_device *netdev,
350 350
351 /* encryption capability */ 351 /* encryption capability */
352 range->enc_capa = IW_ENC_CAPA_WPA | 352 range->enc_capa = IW_ENC_CAPA_WPA |
353 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; 353 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP |
354 IW_ENC_CAPA_4WAY_HANDSHAKE;
354 if (wpa2_capable()) 355 if (wpa2_capable())
355 range->enc_capa |= IW_ENC_CAPA_WPA2; 356 range->enc_capa |= IW_ENC_CAPA_WPA2;
356 range->encoding_size[0] = 5; /* 40bit WEP */ 357 range->encoding_size[0] = 5; /* 40bit WEP */
@@ -1256,42 +1257,19 @@ static int gelic_wl_set_encodeext(struct net_device *netdev,
1256 set_bit(key_index, &wl->key_enabled); 1257 set_bit(key_index, &wl->key_enabled);
1257 /* remember wep info changed */ 1258 /* remember wep info changed */
1258 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); 1259 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat);
1259 } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { 1260 } else if (alg == IW_ENCODE_ALG_PMK) {
1260 pr_debug("%s: TKIP/CCMP requested alg=%d\n", __func__, alg); 1261 if (ext->key_len != WPA_PSK_LEN) {
1261 /* check key length */ 1262 pr_err("%s: PSK length wrong %d\n", __func__,
1262 if (IW_ENCODING_TOKEN_MAX < ext->key_len) { 1263 ext->key_len);
1263 pr_info("%s: key is too long %d\n", __func__,
1264 ext->key_len);
1265 ret = -EINVAL; 1264 ret = -EINVAL;
1266 goto done; 1265 goto done;
1267 } 1266 }
1268 if (alg == IW_ENCODE_ALG_CCMP) { 1267 memset(wl->psk, 0, sizeof(wl->psk));
1269 pr_debug("%s: AES selected\n", __func__); 1268 memcpy(wl->psk, ext->key, ext->key_len);
1270 wl->group_cipher_method = GELIC_WL_CIPHER_AES; 1269 wl->psk_len = ext->key_len;
1271 wl->pairwise_cipher_method = GELIC_WL_CIPHER_AES; 1270 wl->psk_type = GELIC_EURUS_WPA_PSK_BIN;
1272 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA2; 1271 /* remember PSK configured */
1273 } else { 1272 set_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat);
1274 pr_debug("%s: TKIP selected, WPA forced\n", __func__);
1275 wl->group_cipher_method = GELIC_WL_CIPHER_TKIP;
1276 wl->pairwise_cipher_method = GELIC_WL_CIPHER_TKIP;
1277 /* FIXME: how do we do if WPA2 + TKIP? */
1278 wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA;
1279 }
1280 if (flags & IW_ENCODE_RESTRICTED)
1281 BUG();
1282 wl->auth_method = GELIC_EURUS_AUTH_OPEN;
1283 /* We should use same key for both and unicast */
1284 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY)
1285 pr_debug("%s: group key \n", __func__);
1286 else
1287 pr_debug("%s: unicast key \n", __func__);
1288 /* OK, update the key */
1289 wl->key_len[key_index] = ext->key_len;
1290 memset(wl->key[key_index], 0, IW_ENCODING_TOKEN_MAX);
1291 memcpy(wl->key[key_index], ext->key, ext->key_len);
1292 set_bit(key_index, &wl->key_enabled);
1293 /* remember info changed */
1294 set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat);
1295 } 1273 }
1296done: 1274done:
1297 spin_unlock_irqrestore(&wl->lock, irqflag); 1275 spin_unlock_irqrestore(&wl->lock, irqflag);