[net80211] start refactoring out the "am I a wep / group key!" code.
This is a bunch of pointer arithmetic that is copypasta'ed everywhere. Let's undo that copypasta.
This commit is contained in:
parent
43482f897b
commit
54a95d0d68
@ -520,6 +520,26 @@ ieee80211_crypto_setkey(struct ieee80211vap *vap, struct ieee80211_key *key)
|
||||
return dev_key_set(vap, key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return index if the key is a WEP key (0..3); -1 otherwise.
|
||||
*
|
||||
* This is different to "get_keyid" which defaults to returning
|
||||
* 0 for unicast keys; it assumes that it won't be used for WEP.
|
||||
*/
|
||||
int
|
||||
ieee80211_crypto_get_key_wepidx(const struct ieee80211vap *vap,
|
||||
const struct ieee80211_key *k)
|
||||
{
|
||||
|
||||
if (k >= &vap->iv_nw_keys[0] &&
|
||||
k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])
|
||||
return (k - vap->iv_nw_keys);
|
||||
return (-1):
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: only supports a single unicast key (0).
|
||||
*/
|
||||
uint8_t
|
||||
ieee80211_crypto_get_keyid(struct ieee80211vap *vap, struct ieee80211_key *k)
|
||||
{
|
||||
|
@ -202,6 +202,8 @@ void ieee80211_crypto_register(const struct ieee80211_cipher *);
|
||||
void ieee80211_crypto_unregister(const struct ieee80211_cipher *);
|
||||
int ieee80211_crypto_available(u_int cipher);
|
||||
|
||||
int ieee80211_crypto_get_key_wepidx(const struct ieee80211vap *,
|
||||
const struct ieee80211_key *k);
|
||||
uint8_t ieee80211_crypto_get_keyid(struct ieee80211vap *vap,
|
||||
struct ieee80211_key *k);
|
||||
struct ieee80211_key *ieee80211_crypto_get_txkey(struct ieee80211_node *,
|
||||
|
Loading…
x
Reference in New Issue
Block a user