summaryrefslogtreecommitdiff
path: root/sys/dev/ic/if_wi.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-02-20 21:51:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-02-20 21:51:08 +0000
commit971099584d1d8407f7aeeadec4cd6224e4658793 (patch)
tree4c12a96976fac8a06e9786bcce26ed8a09191d4b /sys/dev/ic/if_wi.c
parent838b75834ce9535a077cc06275ff0ffa32e1f0f9 (diff)
104 byte WEP key support for Prism2 cards; from NetBSD
Diffstat (limited to 'sys/dev/ic/if_wi.c')
-rw-r--r--sys/dev/ic/if_wi.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index eab3f11e84b..c724b853fa1 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.20 2002/02/20 20:52:42 millert Exp $ */
+/* $OpenBSD: if_wi.c,v 1.21 2002/02/20 21:51:07 millert Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -122,7 +122,7 @@ u_int32_t widebug = WIDEBUG;
#if !defined(lint) && !defined(__OpenBSD__)
static const char rcsid[] =
- "$OpenBSD: if_wi.c,v 1.20 2002/02/20 20:52:42 millert Exp $";
+ "$OpenBSD: if_wi.c,v 1.21 2002/02/20 21:51:07 millert Exp $";
#endif /* lint */
#ifdef foo
@@ -768,11 +768,21 @@ wi_write_record(sc, ltv)
struct wi_ltv_str ws;
struct wi_ltv_keys *wk = (struct wi_ltv_keys *)ltv;
for (i = 0; i < 4; i++) {
- ws.wi_len = 4;
+ bzero(&ws, sizeof(ws));
+ if (wk->wi_keys[i].wi_keylen <= 5) {
+ /* 5 Octet WEP Keys */
+ ws.wi_len = 4;
+ bcopy(&wk->wi_keys[i].wi_keydat,
+ ws.wi_str, 5);
+ ws.wi_str[5] = '\0';
+ } else {
+ /* 13 Octet WEP Keys */
+ ws.wi_len = 8;
+ bcopy(&wk->wi_keys[i].wi_keydat,
+ ws.wi_str, 13);
+ ws.wi_str[13] = '\0';
+ }
ws.wi_type = WI_RID_P2_CRYPT_KEY0 + i;
- bcopy(&wk->wi_keys[i].wi_keydat,
- ws.wi_str, 5);
- ws.wi_str[5] = '\0';
error = wi_write_record(sc,
(struct wi_ltv_gen *)&ws);
if (error)