Commit 3f53dd64 authored by Jouni Malinen's avatar Jouni Malinen Committed by John W. Linville

ath9k: Fix hw crypto configuration for TKIP in AP mode

Incorrect Michael MIC key (RX, should have been TX) was set for the
group key in AP mode. This resulted in all broadcast frames triggering
Michael MIC errors and eventual TKIP countermeasures. The change here
sets the correct Michael MIC key based on whether the local end is the
authenticator (well, AP for now).
Signed-off-by: default avatarJouni Malinen <jouni.malinen@atheros.com>
Tested-by: default avatarPat Erley <pat-lkml@erley.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 998a5a7d
...@@ -648,8 +648,8 @@ static int ath_keyset(struct ath_softc *sc, u16 keyix, ...@@ -648,8 +648,8 @@ static int ath_keyset(struct ath_softc *sc, u16 keyix,
} }
static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key, static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key,
struct ath9k_keyval *hk, struct ath9k_keyval *hk, const u8 *addr,
const u8 *addr) bool authenticator)
{ {
const u8 *key_rxmic; const u8 *key_rxmic;
const u8 *key_txmic; const u8 *key_txmic;
...@@ -659,7 +659,13 @@ static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key, ...@@ -659,7 +659,13 @@ static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key,
if (addr == NULL) { if (addr == NULL) {
/* Group key installation */ /* Group key installation */
memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); if (authenticator) {
memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic));
memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_mic));
} else {
memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic));
memcpy(hk->kv_txmic, key_rxmic, sizeof(hk->kv_mic));
}
return ath_keyset(sc, keyix, hk, addr); return ath_keyset(sc, keyix, hk, addr);
} }
if (!sc->splitmic) { if (!sc->splitmic) {
...@@ -769,6 +775,7 @@ static int ath_reserve_key_cache_slot(struct ath_softc *sc) ...@@ -769,6 +775,7 @@ static int ath_reserve_key_cache_slot(struct ath_softc *sc)
} }
static int ath_key_config(struct ath_softc *sc, static int ath_key_config(struct ath_softc *sc,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct ieee80211_key_conf *key) struct ieee80211_key_conf *key)
{ {
...@@ -828,7 +835,8 @@ static int ath_key_config(struct ath_softc *sc, ...@@ -828,7 +835,8 @@ static int ath_key_config(struct ath_softc *sc,
} }
if (key->alg == ALG_TKIP) if (key->alg == ALG_TKIP)
ret = ath_setkey_tkip(sc, idx, key->key, &hk, mac); ret = ath_setkey_tkip(sc, idx, key->key, &hk, mac,
vif->type == NL80211_IFTYPE_AP);
else else
ret = ath_keyset(sc, idx, &hk, mac); ret = ath_keyset(sc, idx, &hk, mac);
...@@ -2481,7 +2489,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw, ...@@ -2481,7 +2489,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
switch (cmd) { switch (cmd) {
case SET_KEY: case SET_KEY:
ret = ath_key_config(sc, sta, key); ret = ath_key_config(sc, vif, sta, key);
if (ret >= 0) { if (ret >= 0) {
key->hw_key_idx = ret; key->hw_key_idx = ret;
/* push IV and Michael MIC generation to stack */ /* push IV and Michael MIC generation to stack */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment