Page MenuHomeFreeBSD

D54462.1783667476.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D54462.1783667476.diff

diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -193,8 +193,8 @@
static void rum_read_multi(struct rum_softc *, uint16_t, void *,
int);
static usb_error_t rum_write(struct rum_softc *, uint16_t, uint32_t);
-static usb_error_t rum_write_multi(struct rum_softc *, uint16_t, void *,
- size_t);
+static usb_error_t rum_write_multi(struct rum_softc *, uint16_t,
+ const void *, size_t);
static usb_error_t rum_setbits(struct rum_softc *, uint16_t, uint32_t);
static usb_error_t rum_clrbits(struct rum_softc *, uint16_t, uint32_t);
static usb_error_t rum_modbits(struct rum_softc *, uint16_t, uint32_t,
@@ -1460,7 +1460,8 @@
if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) {
cipher = k->wk_cipher->ic_cipher;
pos = k->wk_keyix;
- mode = rum_crypto_mode(sc, cipher, k->wk_keylen);
+ mode = rum_crypto_mode(sc, cipher,
+ ieee80211_crypto_get_key_len(k));
if (mode == 0)
return 0;
@@ -1843,7 +1844,8 @@
}
static usb_error_t
-rum_write_multi(struct rum_softc *sc, uint16_t reg, void *buf, size_t len)
+rum_write_multi(struct rum_softc *sc, uint16_t reg, const void *buf,
+ size_t len)
{
struct usb_device_request req;
usb_error_t error;
@@ -1858,7 +1860,8 @@
USETW(req.wIndex, reg + offset);
USETW(req.wLength, MIN(len - offset, 64));
- error = rum_do_request(sc, &req, (char *)buf + offset);
+ error = rum_do_request(sc, &req, __DECONST(char *, buf)
+ + offset);
if (error != 0) {
device_printf(sc->sc_dev,
"could not multi write MAC register: %s\n",
@@ -2859,15 +2862,16 @@
uint16_t base)
{
- if (rum_write_multi(sc, base, k->wk_key, k->wk_keylen))
+ if (rum_write_multi(sc, base, ieee80211_crypto_get_key_data(k),
+ ieee80211_crypto_get_key_len(k)))
return EIO;
if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) {
if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE,
- k->wk_txmic, 8))
+ ieee80211_crypto_get_key_txmic_data(k), 8))
return EIO;
if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE + 8,
- k->wk_rxmic, 8))
+ ieee80211_crypto_get_key_rxmic_data(k), 8))
return EIO;
}
@@ -2886,7 +2890,8 @@
sc->sc_clr_shkeys = 1;
}
- mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher, k->wk_keylen);
+ mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher,
+ ieee80211_crypto_get_key_len(k));
if (mode == 0)
goto print_err;
@@ -2941,7 +2946,8 @@
uint8_t buf[IEEE80211_ADDR_LEN + 1];
uint8_t mode;
- mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher, k->wk_keylen);
+ mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher,
+ ieee80211_crypto_get_key_len(k));
if (mode == 0)
goto print_err;
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -2375,7 +2375,7 @@
/* map net80211 cipher to RT2860 security mode */
switch (cipher) {
case IEEE80211_CIPHER_WEP:
- if(k->wk_keylen < 8)
+ if(ieee80211_crypto_get_key_len(k) < 8) /* TODO: add a specific WEP40/WEP104 call! */
mode = RT2860_MODE_WEP40;
else
mode = RT2860_MODE_WEP104;
@@ -2408,15 +2408,20 @@
}
if (cipher == IEEE80211_CIPHER_TKIP) {
- if(run_write_region_1(sc, base, k->wk_key, 16))
+ if (run_write_region_1(sc, base,
+ ieee80211_crypto_get_key_data(k), 16))
return;
- if(run_write_region_1(sc, base + 16, &k->wk_key[16], 8)) /* wk_txmic */
+ if (run_write_region_1(sc, base + 16,
+ ieee80211_crypto_get_key_txmic_data(k), 8)) /* wk_txmic */
return;
- if(run_write_region_1(sc, base + 24, &k->wk_key[24], 8)) /* wk_rxmic */
+ if (run_write_region_1(sc, base + 24,
+ ieee80211_crypto_get_key_rxmic_data(k), 8)) /* wk_rxmic */
return;
} else {
/* roundup len to 16-bit: XXX fix write_region_1() instead */
- if(run_write_region_1(sc, base, k->wk_key, (k->wk_keylen + 1) & ~1))
+ if (run_write_region_1(sc, base,
+ ieee80211_crypto_get_key_data(k),
+ (ieee80211_crypto_get_key_len(k) + 1) & ~1))
return;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 10, 7:11 AM (3 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29053575
Default Alt Text
D54462.1783667476.diff (3 KB)

Event Timeline