Return-path: Received: from ms6.Sony.CO.JP ([211.125.136.204]:39365 "EHLO ms6.sony.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753606AbYDYFHp (ORCPT ); Fri, 25 Apr 2008 01:07:45 -0400 Received: from mta6.sony.co.jp (mta6.Sony.CO.JP [137.153.71.9]) by ms6.sony.co.jp (R8/Sony) with ESMTP id m3P57gLo020163 for ; Fri, 25 Apr 2008 14:07:42 +0900 (JST) Received: from mta6.sony.co.jp (localhost [127.0.0.1]) by mta6.sony.co.jp (R8/Sony) with ESMTP id m3P57g9i014785 for ; Fri, 25 Apr 2008 14:07:42 +0900 (JST) Received: from smail1.sm.sony.co.jp (smail1.sm.sony.co.jp [43.11.253.1]) by mta6.sony.co.jp (R8/Sony) with ESMTP id m3P57fIg014777 for ; Fri, 25 Apr 2008 14:07:42 +0900 (JST) Received: from imail.sm.sony.co.jp (imail.sm.sony.co.jp [43.4.141.32]) by smail1.sm.sony.co.jp (8.11.6p2/8.11.6) with ESMTP id m3P57gP18331 for ; Fri, 25 Apr 2008 14:07:42 +0900 (JST) Received: from [43.4.146.40] (bluenote.sm.sony.co.jp [43.4.146.40]) by imail.sm.sony.co.jp (8.12.11/3.7W) with ESMTP id m3P57fD8025275 for ; Fri, 25 Apr 2008 14:07:41 +0900 (JST) Date: Fri, 25 Apr 2008 14:05:39 +0900 From: Masakazu Mokuno To: linux-wireless@vger.kernel.org Subject: [PATCH 2/3] RFC: PS3: gelic: Use the new PMK interface in the gelic driver In-Reply-To: <20080424204950.03DD.40F06B3A@sm.sony.co.jp> References: <20080424204950.03DD.40F06B3A@sm.sony.co.jp> Message-Id: <20080425135835.03F8.40F06B3A@sm.sony.co.jp> (sfid-20080425_070823_096121_8326B753) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Sender: linux-wireless-owner@vger.kernel.org List-ID: 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 --- drivers/net/ps3_gelic_wireless.c | 46 ++++++++++----------------------------- 1 file changed, 12 insertions(+), 34 deletions(-) --- 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 /* encryption capability */ range->enc_capa = IW_ENC_CAPA_WPA | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; + IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP | + IW_ENC_CAPA_4WAY_HANDSHAKE; if (wpa2_capable()) range->enc_capa |= IW_ENC_CAPA_WPA2; range->encoding_size[0] = 5; /* 40bit WEP */ @@ -1256,42 +1257,19 @@ static int gelic_wl_set_encodeext(struct set_bit(key_index, &wl->key_enabled); /* remember wep info changed */ set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); - } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { - pr_debug("%s: TKIP/CCMP requested alg=%d\n", __func__, alg); - /* check key length */ - if (IW_ENCODING_TOKEN_MAX < ext->key_len) { - pr_info("%s: key is too long %d\n", __func__, - ext->key_len); + } else if (alg == IW_ENCODE_ALG_PMK) { + if (ext->key_len != WPA_PSK_LEN) { + pr_err("%s: PSK length wrong %d\n", __func__, + ext->key_len); ret = -EINVAL; goto done; } - if (alg == IW_ENCODE_ALG_CCMP) { - pr_debug("%s: AES selected\n", __func__); - wl->group_cipher_method = GELIC_WL_CIPHER_AES; - wl->pairwise_cipher_method = GELIC_WL_CIPHER_AES; - wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA2; - } else { - pr_debug("%s: TKIP selected, WPA forced\n", __func__); - wl->group_cipher_method = GELIC_WL_CIPHER_TKIP; - wl->pairwise_cipher_method = GELIC_WL_CIPHER_TKIP; - /* FIXME: how do we do if WPA2 + TKIP? */ - wl->wpa_level = GELIC_WL_WPA_LEVEL_WPA; - } - if (flags & IW_ENCODE_RESTRICTED) - BUG(); - wl->auth_method = GELIC_EURUS_AUTH_OPEN; - /* We should use same key for both and unicast */ - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - pr_debug("%s: group key \n", __func__); - else - pr_debug("%s: unicast key \n", __func__); - /* OK, update the key */ - wl->key_len[key_index] = ext->key_len; - memset(wl->key[key_index], 0, IW_ENCODING_TOKEN_MAX); - memcpy(wl->key[key_index], ext->key, ext->key_len); - set_bit(key_index, &wl->key_enabled); - /* remember info changed */ - set_bit(GELIC_WL_STAT_CONFIGURED, &wl->stat); + memset(wl->psk, 0, sizeof(wl->psk)); + memcpy(wl->psk, ext->key, ext->key_len); + wl->psk_len = ext->key_len; + wl->psk_type = GELIC_EURUS_WPA_PSK_BIN; + /* remember PSK configured */ + set_bit(GELIC_WL_STAT_WPA_PSK_SET, &wl->stat); } done: spin_unlock_irqrestore(&wl->lock, irqflag);