diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2007-07-18 18:10:32 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2007-07-18 18:10:32 +0000 |
commit | b0b399694977801dc175a7554f8045923e44f7eb (patch) | |
tree | 7d1f39fd88f1022730d45f888f660cd787566366 /sys/dev/usb | |
parent | f7f63cd087c89a071fd5bbd90a28ce1cf0d1275f (diff) |
replace the ieee80211_wepkey structure with a more generic ieee80211_key
one that can be used with other ciphers than WEP.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_atu.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_ral.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/if_uath.c | 19 |
3 files changed, 17 insertions, 20 deletions
diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index c2569ee4606..9cc51335637 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atu.c,v 1.85 2007/06/14 10:11:15 mbalmer Exp $ */ +/* $OpenBSD: if_atu.c,v 1.86 2007/07/18 18:10:31 damien Exp $ */ /* * Copyright (c) 2003, 2004 * Daan Vreeken <Danovitsch@Vitsch.net>. All rights reserved. @@ -689,11 +689,11 @@ atu_initial_config(struct atu_softc *sc) cmd.PrivacyInvoked = (ic->ic_flags & IEEE80211_F_WEPON) ? 1 : 0; cmd.ExcludeUnencrypted = 0; - switch (ic->ic_nw_keys[ic->ic_wep_txkey].wk_len) { - case 5: + switch (ic->ic_nw_keys[ic->ic_wep_txkey].k_cipher) { + case IEEE80211_CIPHER_WEP40: cmd.EncryptionType = ATU_WEP_40BITS; break; - case 13: + case IEEE80211_CIPHER_WEP104: cmd.EncryptionType = ATU_WEP_104BITS; break; default: @@ -703,8 +703,8 @@ atu_initial_config(struct atu_softc *sc) cmd.WEP_DefaultKeyID = ic->ic_wep_txkey; for (i = 0; i < IEEE80211_WEP_NKID; i++) { - memcpy(cmd.WEP_DefaultKey[i], ic->ic_nw_keys[i].wk_key, - ic->ic_nw_keys[i].wk_len); + memcpy(cmd.WEP_DefaultKey[i], ic->ic_nw_keys[i].k_key, + ic->ic_nw_keys[i].k_len); } /* Setting the SSID here doesn't seem to do anything */ diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index 5132575bcf1..400c9a72c49 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.99 2007/06/14 10:11:15 mbalmer Exp $ */ +/* $OpenBSD: if_ral.c,v 1.100 2007/07/18 18:10:31 damien Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1979,9 +1979,9 @@ ural_init(struct ifnet *ifp) * Copy WEP keys into adapter's memory (SEC_CSR0 to SEC_CSR31). */ for (i = 0; i < IEEE80211_WEP_NKID; i++) { - struct ieee80211_wepkey *wk = &ic->ic_nw_keys[i]; + struct ieee80211_key *k = &ic->ic_nw_keys[i]; ural_write_multi(sc, RAL_SEC_CSR0 + i * IEEE80211_KEYBUF_SIZE, - wk->wk_key, IEEE80211_KEYBUF_SIZE); + k->k_key, IEEE80211_KEYBUF_SIZE); } /* diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c index f85dda16c6a..eedd8755a08 100644 --- a/sys/dev/usb/if_uath.c +++ b/sys/dev/usb/if_uath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uath.c,v 1.26 2007/06/14 10:11:15 mbalmer Exp $ */ +/* $OpenBSD: if_uath.c,v 1.27 2007/07/18 18:10:31 damien Exp $ */ /*- * Copyright (c) 2006 @@ -174,8 +174,7 @@ int uath_reset(struct uath_softc *); int uath_reset_tx_queues(struct uath_softc *); int uath_wme_init(struct uath_softc *); int uath_set_chan(struct uath_softc *, struct ieee80211_channel *); -int uath_set_key(struct uath_softc *, const struct ieee80211_wepkey *, - int); +int uath_set_key(struct uath_softc *, const struct ieee80211_key *, int); int uath_set_keys(struct uath_softc *); int uath_set_rates(struct uath_softc *, const struct ieee80211_rateset *); int uath_set_rxfilter(struct uath_softc *, uint32_t, uint32_t); @@ -1751,8 +1750,7 @@ uath_set_chan(struct uath_softc *sc, struct ieee80211_channel *c) } int -uath_set_key(struct uath_softc *sc, const struct ieee80211_wepkey *wk, - int index) +uath_set_key(struct uath_softc *sc, const struct ieee80211_key *k, int index) { struct uath_cmd_crypto crypto; int i; @@ -1771,10 +1769,10 @@ uath_set_key(struct uath_softc *sc, const struct ieee80211_wepkey *wk, * Each byte of the key must be XOR'ed with 10101010 before being * transmitted to the firmware. */ - for (i = 0; i < wk->wk_len; i++) - crypto.key[i] = wk->wk_key[i] ^ 0xaa; + for (i = 0; i < k->k_len; i++) + crypto.key[i] = k->k_key[i] ^ 0xaa; - DPRINTF(("setting crypto key index=%d len=%d\n", index, wk->wk_len)); + DPRINTF(("setting crypto key index=%d len=%d\n", index, k->k_len)); return uath_cmd_write(sc, UATH_CMD_CRYPTO, &crypto, sizeof crypto, 0); } @@ -1785,10 +1783,9 @@ uath_set_keys(struct uath_softc *sc) int i, error; for (i = 0; i < IEEE80211_WEP_NKID; i++) { - const struct ieee80211_wepkey *wk = &ic->ic_nw_keys[i]; + const struct ieee80211_key *k = &ic->ic_nw_keys[i]; - if (wk->wk_len > 0 && - (error = uath_set_key(sc, wk, i)) != 0) + if (k->k_len > 0 && (error = uath_set_key(sc, k, i)) != 0) return error; } return uath_set_key(sc, &ic->ic_nw_keys[ic->ic_wep_txkey], |