Hi,
I'd like to add support for passing PMK and capability flags to WEXT for
the drivers which want to do 4-way handshake in the driver/firmware.
Prior to 2.6.25, none of the mainlined wireless drivers had been designed
to do 4-way handshakes in the driver/firmware, thus WEXT does not define
the way to do that.
The PS3 wireless device is such kind of device. The current gelic
driver included in 2.6.25 uses private WEXT ioctls to get the PSK
because of the lack of a standard way in WEXT.
With this patch we would be able to:
- define the standard way to pass the PMK to the driver
- let user space programs figure out whether the driver will do 4-way
handshakes
- eliminate the use of private ioctls from the gelic driver
#1 Add support for passing PMK and capability flags to WEXT
#2 Use the new PMK interface in the gelic driver
#3 Deprecate the private ioctls in the gelic driver
#1 adds the flags to WEXT, #2 and #3 let the gelic driver conform.
Please review!
--
Masakazu Mokuno
Hi,
> - define the standard way to pass the PMK to the driver
> - let user space programs figure out whether the driver will do 4-way
> handshakes
> - eliminate the use of private ioctls from the gelic driver
>
> #1 Add support for passing PMK and capability flags to WEXT
> #2 Use the new PMK interface in the gelic driver
> #3 Deprecate the private ioctls in the gelic driver
>
>
> #1 adds the flags to WEXT, #2 and #3 let the gelic driver conform.
>
> Please review!
Looks fine to me. You might want to ask for Jouni's input since took
part in the original design and will have to take the wpa_supplicant
patch :)
johannes
On Sun, 2008-04-27 at 09:35 +0300, Jouni Malinen wrote:
> On Sat, Apr 26, 2008 at 06:13:47PM +0200, Johannes Berg wrote:
>
> > Looks fine to me. You might want to ask for Jouni's input since took
> > part in the original design and will have to take the wpa_supplicant
> > patch :)
>
> Actually, I had already seen this (and the matching wpa_supplicant
> patch) and commented it before it was sent to linux-wireless. I'm fine
> with this version.
Yeah, looks good to me too.
Dan
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 <[email protected]>
---
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);
On Sat, Apr 26, 2008 at 06:13:47PM +0200, Johannes Berg wrote:
> Looks fine to me. You might want to ask for Jouni's input since took
> part in the original design and will have to take the wpa_supplicant
> patch :)
Actually, I had already seen this (and the matching wpa_supplicant
patch) and commented it before it was sent to linux-wireless. I'm fine
with this version.
--
Jouni Malinen PGP id EFC895FA
As the driver has the standard way to handle PSK, deprecate the old
PSK interface.
Signed-off-by: Masakazu Mokuno <[email protected]>
---
drivers/net/Kconfig | 13 +++++++++++++
drivers/net/ps3_gelic_wireless.c | 6 ++++++
2 files changed, 19 insertions(+)
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2297,6 +2297,19 @@ config GELIC_WIRELESS
the driver automatically distinguishes the models, you can
safely enable this option even if you have a wireless-less model.
+config GELIC_WIRELESS_OLD_PSK_INTERFACE
+ bool "PS3 Wireless private PSK interface (OBSOLETE)"
+ depends on GELIC_WIRELESS
+ help
+ This option retains the obsolete private interface to pass
+ the PSK from user space programs to the driver. The PSK
+ stands for 'Pre Shared Key' and is used for WPA[2]-PSK
+ (WPA-Personal) environment.
+ If WPA[2]-PSK is used and you need to use old programs that
+ support only this old interface, say Y. Otherwise N.
+
+ If unsure, say N.
+
config GIANFAR
tristate "Gianfar Ethernet"
depends on FSL_SOC
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -1375,6 +1375,7 @@ static int gelic_wl_get_mode(struct net_
return 0;
}
+#ifdef CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE
/* SIOCIWFIRSTPRIV */
static int hex2bin(u8 *str, u8 *bin, unsigned int len)
{
@@ -1479,6 +1480,7 @@ static int gelic_wl_priv_get_psk(struct
pr_debug("%s:-> %d\n", __func__, data->data.length);
return 0;
}
+#endif
/* SIOCGIWNICKN */
static int gelic_wl_get_nick(struct net_device *net_dev,
@@ -2329,6 +2331,7 @@ static const iw_handler gelic_wl_wext_ha
IW_IOCTL(SIOCGIWNICKN) = gelic_wl_get_nick,
};
+#ifdef CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE
static struct iw_priv_args gelic_wl_private_args[] =
{
{
@@ -2350,15 +2353,18 @@ static const iw_handler gelic_wl_private
gelic_wl_priv_set_psk,
gelic_wl_priv_get_psk,
};
+#endif
static const struct iw_handler_def gelic_wl_wext_handler_def = {
.num_standard = ARRAY_SIZE(gelic_wl_wext_handler),
.standard = gelic_wl_wext_handler,
.get_wireless_stats = gelic_wl_get_wireless_stats,
+#ifdef CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE
.num_private = ARRAY_SIZE(gelic_wl_private_handler),
.num_private_args = ARRAY_SIZE(gelic_wl_private_args),
.private = gelic_wl_private_handler,
.private_args = gelic_wl_private_args,
+#endif
};
static struct net_device *gelic_wl_alloc(struct gelic_card *card)
This defines the flags for setting the PMK to the driver and the
capability flag for this so that the user space program can figure out
whether the target driver wants to do 4-way hand shake by itself and
pass the PMK which is needed before 4-way handshake to the driver.
Signed-off-by: Masakazu Mokuno <[email protected]>
---
include/linux/wireless.h | 2 ++
1 file changed, 2 insertions(+)
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -616,6 +616,7 @@
#define IW_ENCODE_ALG_WEP 1
#define IW_ENCODE_ALG_TKIP 2
#define IW_ENCODE_ALG_CCMP 3
+#define IW_ENCODE_ALG_PMK 4
/* struct iw_encode_ext ->ext_flags */
#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
@@ -635,6 +636,7 @@
#define IW_ENC_CAPA_WPA2 0x00000002
#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004
#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008
+#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010
/* Event capability macros - in (struct iw_range *)->event_capa
* Because we have more than 32 possible events, we use an array of
On Mon, 28 Apr 2008 00:07:24 -0400
Dan Williams <[email protected]> wrote:
> On Sun, 2008-04-27 at 09:35 +0300, Jouni Malinen wrote:
> > On Sat, Apr 26, 2008 at 06:13:47PM +0200, Johannes Berg wrote:
> >
> > > Looks fine to me. You might want to ask for Jouni's input since took
> > > part in the original design and will have to take the wpa_supplicant
> > > patch :)
> >
> > Actually, I had already seen this (and the matching wpa_supplicant
> > patch) and commented it before it was sent to linux-wireless. I'm fine
> > with this version.
>
> Yeah, looks good to me too.
>
Thanks for your reviews!
I've got Jouni's comments as already he mentioned. This set was the
revised version.
I'll submit them as usual patches.
--
Masakazu Mokuno