2008-05-30 07:41:55

by Masakazu Mokuno

[permalink] [raw]
Subject: [PATCH 0/3] wireless: Add support for passing PMK to WEXT

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 set 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.

This patch set is identical to my previous RFC post on Apr 25 in
functionality.

Best regards.

--
Masakazu Mokuno



2008-05-30 17:54:34

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH 3/3] PS3: gelic: Deprecate the private ioctls in the gelic driver

On Fri, 2008-05-30 at 16:52 +0900, Masakazu Mokuno wrote:
> As the driver has the standard way to handle PSK, deprecate the old
> interface.
>
> Signed-off-by: Masakazu Mokuno <[email protected]>

Yay, fewer private ioctls == better.

Acked-by: Dan Williams <[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)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html


2008-05-30 07:52:30

by Masakazu Mokuno

[permalink] [raw]
Subject: [PATCH 1/3] WEXT: Add support for passing PMK and capability flags to WEXT

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
@@ -611,6 +611,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
@@ -630,6 +631,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


2008-05-30 07:53:04

by Masakazu Mokuno

[permalink] [raw]
Subject: [PATCH 3/3] PS3: gelic: Deprecate the private ioctls in the gelic driver

As the driver has the standard way to handle PSK, deprecate the old
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)


2008-05-30 17:52:37

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH 1/3] WEXT: Add support for passing PMK and capability flags to WEXT

On Fri, 2008-05-30 at 16:52 +0900, Masakazu Mokuno wrote:
> 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]>

Acked-by: Dan Williams <[email protected]>

> ---
> include/linux/wireless.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> --- a/include/linux/wireless.h
> +++ b/include/linux/wireless.h
> @@ -611,6 +611,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
> @@ -630,6 +631,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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html


2008-05-30 18:17:44

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH 2/3] PS3: gelic: Use the new PMK interface in the gelic driver

On Fri, 2008-05-30 at 16:52 +0900, Masakazu Mokuno wrote:
> 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]>

Awesome; I assume that once the 4WAY_HANDSHAKE bits get in you can
switch over to the WEXT driver for wpa_supplicant, right?

Acked-by: Dan Williams <[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);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html


2008-05-30 07:52:52

by Masakazu Mokuno

[permalink] [raw]
Subject: [PATCH 2/3] 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 <[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);


2008-06-02 04:00:16

by Masakazu Mokuno

[permalink] [raw]
Subject: Re: [PATCH 2/3] PS3: gelic: Use the new PMK interface in the gelic driver


On Fri, 30 May 2008 13:53:42 -0400
Dan Williams <[email protected]> wrote:
>
> Awesome; I assume that once the 4WAY_HANDSHAKE bits get in you can
> switch over to the WEXT driver for wpa_supplicant, right?
>
> Acked-by: Dan Williams <[email protected]>

Yes, that's definitely the primary reason for this change.


--
Masakazu Mokuno