summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2003-12-05 02:23:43 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2003-12-05 02:23:43 +0000
commit34c1fa05176ed493fccdf3c136c1ce35184ae01c (patch)
tree5340d787308ade9670464d7c8a71d13abd4f1690 /sys
parentac0f5cfe3a8e9ecab2b4e0561895eca10aee861d (diff)
consistently treat wi_keylen as le16, fixes wicontrol crash for if_wi
and if_wi_usb ok millert@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/if_wi.c9
-rw-r--r--sys/dev/usb/if_wi_usb.c9
2 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index 260c8d9e8a6..510e3ec2303 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.101 2003/10/26 15:34:15 drahn Exp $ */
+/* $OpenBSD: if_wi.c,v 1.102 2003/12/05 02:23:42 drahn Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -126,7 +126,7 @@ u_int32_t widebug = WIDEBUG;
#if !defined(lint) && !defined(__OpenBSD__)
static const char rcsid[] =
- "$OpenBSD: if_wi.c,v 1.101 2003/10/26 15:34:15 drahn Exp $";
+ "$OpenBSD: if_wi.c,v 1.102 2003/12/05 02:23:42 drahn Exp $";
#endif /* lint */
#ifdef foo
@@ -1208,6 +1208,7 @@ wi_write_record_io(sc, ltv)
struct wi_ltv_str ws;
struct wi_ltv_keys *wk = (struct wi_ltv_keys *)ltv;
keylen = wk->wi_keys[sc->wi_tx_key].wi_keylen;
+ keylen = letoh16(keylen);
for (i = 0; i < 4; i++) {
bzero(&ws, sizeof(ws));
@@ -2078,7 +2079,7 @@ wi_do_hostencrypt(struct wi_softc *sc, caddr_t buf, int len)
key[1] = sc->wi_icv >> 8;
key[2] = sc->wi_icv;
- klen = sc->wi_keys.wi_keys[sc->wi_tx_key].wi_keylen;
+ klen = letoh16(sc->wi_keys.wi_keys[sc->wi_tx_key].wi_keylen);
bcopy((char *)&sc->wi_keys.wi_keys[sc->wi_tx_key].wi_keydat,
(char *)key + IEEE80211_WEP_IVLEN, klen);
klen = (klen > IEEE80211_WEP_KEYLEN) ? RC4KEYLEN : RC4KEYLEN / 2;
@@ -2133,7 +2134,7 @@ wi_do_hostdecrypt(struct wi_softc *sc, caddr_t buf, int len)
kid = (dat[3] >> 6) % 4;
dat += 4;
- klen = sc->wi_keys.wi_keys[kid].wi_keylen;
+ klen = letoh16(sc->wi_keys.wi_keys[kid].wi_keylen);
bcopy((char *)&sc->wi_keys.wi_keys[kid].wi_keydat,
(char *)key + IEEE80211_WEP_IVLEN, klen);
klen = (klen > IEEE80211_WEP_KEYLEN) ? RC4KEYLEN : RC4KEYLEN / 2;
diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c
index 84e14aa72ce..418e594d451 100644
--- a/sys/dev/usb/if_wi_usb.c
+++ b/sys/dev/usb/if_wi_usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_usb.c,v 1.4 2003/11/09 20:54:19 drahn Exp $ */
+/* $OpenBSD: if_wi_usb.c,v 1.5 2003/12/05 02:23:42 drahn Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
@@ -796,8 +796,11 @@ wi_write_record_usb(struct wi_softc *wsc, struct wi_ltv_gen *ltv)
int error;
int keylen;
struct wi_ltv_str ws;
- struct wi_ltv_keys *wk = (struct wi_ltv_keys *)ltv;
+ struct wi_ltv_keys *wk;
+
+ wk = (struct wi_ltv_keys *)ltv;
keylen = wk->wi_keys[wsc->wi_tx_key].wi_keylen;
+ keylen = letoh16(keylen);
for (i = 0; i < 4; i++) {
bzero(&ws, sizeof(ws));
@@ -1393,8 +1396,8 @@ wi_usb_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status
case WI_USB_ERROR:
printf("wi_usb: received USB_ERROR packet\n"); /* XXX */
break;
- default:
#if 0
+ default:
printf("wi_usb: received Unknown packet 0x%x len %x\n",
rtype, total_len);
wi_dump_data(c->wi_usb_buf, total_len);