diff options
| author | ichiro <ichiro@NetBSD.org> | 2002-03-10 14:43:38 +0000 |
|---|---|---|
| committer | ichiro <ichiro@NetBSD.org> | 2002-03-10 14:43:38 +0000 |
| commit | 8596bfd754ee1bc987c8304ecc02888e301d51cd (patch) | |
| tree | 74bc8653ea2dadbfb7503ef9a7088f8b1efb6bee /sys/dev/ic | |
| parent | 6b92497159811cec6ec751956c1b1068f566ba0d (diff) | |
fix 128bit WEP work with Prism2 Card.
from FreeBSD
Diffstat (limited to 'sys/dev/ic')
| -rw-r--r-- | sys/dev/ic/wi.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/sys/dev/ic/wi.c b/sys/dev/ic/wi.c index 9c3ace2863c..400c075e340 100644 --- a/sys/dev/ic/wi.c +++ b/sys/dev/ic/wi.c @@ -1,4 +1,4 @@ -/* $NetBSD: wi.c,v 1.51 2002/03/10 00:16:47 augustss Exp $ */ +/* $NetBSD: wi.c,v 1.52 2002/03/10 14:43:38 ichiro Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.51 2002/03/10 00:16:47 augustss Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.52 2002/03/10 14:43:38 ichiro Exp $"); #define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */ #define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ @@ -970,24 +970,21 @@ static int wi_write_record(sc, ltv) case WI_RID_DEFLT_CRYPT_KEYS: { int error; + int keylen; 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; + for (i = 0; i < 4; i++) { memset(&ws, 0, sizeof(ws)); - if(wk->wi_keys[i].wi_keylen <= 5) { - /* 5 Octets WEP Keys */ - ws.wi_len = 4; - memcpy(ws.wi_str, &wk->wi_keys[i].wi_keydat, 5); - ws.wi_str[5] = '\0'; - } else { - /* 13 Octets WEP Keys */ - ws.wi_len = 8; - memcpy(ws.wi_str, &wk->wi_keys[i].wi_keydat, 13); - ws.wi_str[13] = '\0'; - } + ws.wi_len = (keylen > 5) ? 8 : 4; ws.wi_type = WI_RID_P2_CRYPT_KEY0 + i; - - if(wi_write_record(sc, (struct wi_ltv_gen *)&ws)) + memcpy(ws.wi_str, + &wk->wi_keys[i].wi_keydat, keylen); + error = wi_write_record(sc, + (struct wi_ltv_gen *)&ws); + if (error) return error; } return 0; |
