diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-08-05 16:23:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:12:42 -0400 |
commit | 16e158480d542f3909b5aca8b125af986ae128c1 (patch) | |
tree | 9be78070834c14bb05224f86db0d8eea3370c83d /drivers | |
parent | 5c9f41e285ad60013f0962746192769f899757be (diff) |
orinoco: pass orinoco_set_tkip_key the sequence lengths
When we store the keys for cfg80211, the sequence lengths will also be
stored. So avoid assuming the sequence lengths at this level.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/orinoco/hw.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/hw.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/wext.c | 2 |
3 files changed, 21 insertions, 14 deletions
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index d069fe8b6033..35516a9e2a30 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -905,11 +905,12 @@ int __orinoco_hw_setup_enc(struct orinoco_private *priv) | |||
905 | } | 905 | } |
906 | 906 | ||
907 | /* key must be 32 bytes, including the tx and rx MIC keys. | 907 | /* key must be 32 bytes, including the tx and rx MIC keys. |
908 | * rsc must be 8 bytes | 908 | * rsc must be NULL or up to 8 bytes |
909 | * tsc must be 8 bytes or NULL | 909 | * tsc must be NULL or up to 8 bytes |
910 | */ | 910 | */ |
911 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, | 911 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, |
912 | int set_tx, u8 *key, u8 *rsc, u8 *tsc) | 912 | int set_tx, u8 *key, u8 *rsc, size_t rsc_len, |
913 | u8 *tsc, size_t tsc_len) | ||
913 | { | 914 | { |
914 | struct { | 915 | struct { |
915 | __le16 idx; | 916 | __le16 idx; |
@@ -934,17 +935,22 @@ int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, | |||
934 | memcpy(buf.key, key, | 935 | memcpy(buf.key, key, |
935 | sizeof(buf.key) + sizeof(buf.tx_mic) + sizeof(buf.rx_mic)); | 936 | sizeof(buf.key) + sizeof(buf.tx_mic) + sizeof(buf.rx_mic)); |
936 | 937 | ||
937 | if (rsc == NULL) | 938 | if (rsc_len > sizeof(buf.rsc)) |
938 | memset(buf.rsc, 0, sizeof(buf.rsc)); | 939 | rsc_len = sizeof(buf.rsc); |
939 | else | 940 | |
940 | memcpy(buf.rsc, rsc, sizeof(buf.rsc)); | 941 | if (tsc_len > sizeof(buf.tsc)) |
942 | tsc_len = sizeof(buf.tsc); | ||
943 | |||
944 | memset(buf.rsc, 0, sizeof(buf.rsc)); | ||
945 | memset(buf.tsc, 0, sizeof(buf.tsc)); | ||
946 | |||
947 | if (rsc != NULL) | ||
948 | memcpy(buf.rsc, rsc, rsc_len); | ||
941 | 949 | ||
942 | if (tsc == NULL) { | 950 | if (tsc != NULL) |
943 | memset(buf.tsc, 0, sizeof(buf.tsc)); | 951 | memcpy(buf.tsc, tsc, tsc_len); |
952 | else | ||
944 | buf.tsc[4] = 0x10; | 953 | buf.tsc[4] = 0x10; |
945 | } else { | ||
946 | memcpy(buf.tsc, tsc, sizeof(buf.tsc)); | ||
947 | } | ||
948 | 954 | ||
949 | /* Wait upto 100ms for tx queue to empty */ | 955 | /* Wait upto 100ms for tx queue to empty */ |
950 | for (k = 100; k > 0; k--) { | 956 | for (k = 100; k > 0; k--) { |
diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h index 27b427649d1b..33a31fa7c625 100644 --- a/drivers/net/wireless/orinoco/hw.h +++ b/drivers/net/wireless/orinoco/hw.h | |||
@@ -38,7 +38,8 @@ int __orinoco_hw_set_wap(struct orinoco_private *priv); | |||
38 | int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv); | 38 | int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv); |
39 | int __orinoco_hw_setup_enc(struct orinoco_private *priv); | 39 | int __orinoco_hw_setup_enc(struct orinoco_private *priv); |
40 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, | 40 | int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, |
41 | int set_tx, u8 *key, u8 *rsc, u8 *tsc); | 41 | int set_tx, u8 *key, u8 *rsc, size_t rsc_len, |
42 | u8 *tsc, size_t tsc_len); | ||
42 | int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); | 43 | int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); |
43 | int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, | 44 | int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, |
44 | struct dev_addr_list *mc_list, | 45 | struct dev_addr_list *mc_list, |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index 33d81b4823a2..7e18bb404935 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -863,7 +863,7 @@ static int orinoco_ioctl_set_encodeext(struct net_device *dev, | |||
863 | err = __orinoco_hw_set_tkip_key(priv, idx, | 863 | err = __orinoco_hw_set_tkip_key(priv, idx, |
864 | ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY, | 864 | ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY, |
865 | (u8 *) &priv->tkip_key[idx], | 865 | (u8 *) &priv->tkip_key[idx], |
866 | tkip_iv, NULL); | 866 | tkip_iv, ORINOCO_SEQ_LEN, NULL, 0); |
867 | if (err) | 867 | if (err) |
868 | printk(KERN_ERR "%s: Error %d setting TKIP key" | 868 | printk(KERN_ERR "%s: Error %d setting TKIP key" |
869 | "\n", dev->name, err); | 869 | "\n", dev->name, err); |