History

mac80211: don't accept WEP keys other than WEP40 and WEP104

This patch makes mac80211 refuse a WEP key whose length is not WEP40 nor WEP104.

Emmanuel Grumbach committed 18 years ago

Commit 23976ef1 parent 1bcca3c2 files · +16 −0Browse files

Unified · Split

2 files
  1. include/net/mac80211.h +9 −0
  2. net/mac80211/wext.c +7 −0
include/net/mac80211.h+9−0
@@ -595,6 +595,15 @@ enum ieee80211_key_alg { · 594 unmodified lines
595595 ALG_CCMP,
596596 };
597597
598+/**
599+ * enum ieee80211_key_len - key length
600+ * @WEP40: WEP 5 byte long key
601+ * @WEP104: WEP 13 byte long key
602+ */
603+enum ieee80211_key_len {
604+ LEN_WEP40 = 5,
605+ LEN_WEP104 = 13,
606+};
598607
599608 /**
600609 * enum ieee80211_key_flags - key flags
net/mac80211/wext.c+7−0
@@ -95,6 +95,13 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, · 94 unmodified lines
9595 }
9696 }
9797
98+ if (alg == ALG_WEP &&
99+ key_len != LEN_WEP40 && key_len != LEN_WEP104) {
100+ ieee80211_key_free(key);
101+ err = -EINVAL;
102+ goto out_unlock;
103+ }
104+
98105 ieee80211_key_link(key, sdata, sta);
99106
100107 if (set_tx_key || (!sta && !sdata->default_key && key))