summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2005-04-01 13:13:44 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2005-04-01 13:13:44 +0000
commitf1624c6f14d3298cd8fdb402526cc1eaef838959 (patch)
tree9fd9984d0b659b149786bbd513f5af08d9c9d222 /sys
parent13c610e2a7ebcc229a632c19249d94dd42529e51 (diff)
add code for setting WEP keys. this will be useful when i'll implement
hardware WEP.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_ral.c12
-rw-r--r--sys/dev/usb/if_ralreg.h7
2 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c
index ac1de00c278..401941ce25d 100644
--- a/sys/dev/usb/if_ral.c
+++ b/sys/dev/usb/if_ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ral.c,v 1.21 2005/04/01 12:57:27 damien Exp $ */
+/* $OpenBSD: if_ral.c,v 1.22 2005/04/01 13:13:42 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -1958,6 +1958,7 @@ ural_init(struct ifnet *ifp)
#define N(a) (sizeof (a) / sizeof ((a)[0]))
struct ural_softc *sc = ifp->if_softc;
struct ieee80211com *ic = &sc->sc_ic;
+ struct ieee80211_wepkey *wk;
struct ural_rx_data *data;
uint16_t sta[11], tmp;
usbd_status error;
@@ -2008,6 +2009,15 @@ ural_init(struct ifnet *ifp)
ural_set_macaddr(sc, ic->ic_myaddr);
/*
+ * Copy WEP keys into adapter's memory (SEC_CSR0 to SEC_CSR31).
+ */
+ for (i = 0; i < IEEE80211_WEP_NKID; i++) {
+ wk = &ic->ic_nw_keys[i];
+ ural_write_multi(sc, RAL_SEC_CSR0 + i * IEEE80211_KEYBUF_SIZE,
+ wk->wk_key, IEEE80211_KEYBUF_SIZE);
+ }
+
+ /*
* Open Tx and Rx USB bulk pipes.
*/
error = usbd_open_pipe(sc->sc_iface, sc->sc_tx_no, USBD_EXCLUSIVE_USE,
diff --git a/sys/dev/usb/if_ralreg.h b/sys/dev/usb/if_ralreg.h
index 3f80ddadf9e..847f6af9319 100644
--- a/sys/dev/usb/if_ralreg.h
+++ b/sys/dev/usb/if_ralreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ralreg.h,v 1.4 2005/04/01 12:57:27 damien Exp $ */
+/* $OpenBSD: if_ralreg.h,v 1.5 2005/04/01 13:13:43 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -70,6 +70,11 @@
#define RAL_TXRX_CSR21 0x046a /* XXX not documented */
/*
+ * Security registers.
+ */
+#define RAL_SEC_CSR0 0x0480 /* Shared key 0, word 0 */
+
+/*
* PHY registers.
*/
#define RAL_PHY_CSR2 0x04c4 /* Tx MAC configuration */