Skip to content

Commit

Permalink
mac80211: don't accept WEP keys other than WEP40 and WEP104
Browse files Browse the repository at this point in the history
This patch makes mac80211 refuse a WEP key whose length is not WEP40 nor
WEP104.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Emmanuel Grumbach authored and John W. Linville committed Jun 30, 2008
1 parent 1bcca3c commit 23976ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,15 @@ enum ieee80211_key_alg {
ALG_CCMP,
};

/**
* enum ieee80211_key_len - key length
* @WEP40: WEP 5 byte long key
* @WEP104: WEP 13 byte long key
*/
enum ieee80211_key_len {
LEN_WEP40 = 5,
LEN_WEP104 = 13,
};

/**
* enum ieee80211_key_flags - key flags
Expand Down
7 changes: 7 additions & 0 deletions net/mac80211/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
}
}

if (alg == ALG_WEP &&
key_len != LEN_WEP40 && key_len != LEN_WEP104) {
ieee80211_key_free(key);
err = -EINVAL;
goto out_unlock;
}

ieee80211_key_link(key, sdata, sta);

if (set_tx_key || (!sta && !sdata->default_key && key))
Expand Down

0 comments on commit 23976ef

Please sign in to comment.