#include <linux/if_ether.h>
#include <linux/etherdevice.h>
#include <linux/list.h>
#include <linux/rcupdate.h>
#include <linux/rtnetlink.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <net/mac80211.h>
#include <asm/unaligned.h>
#include "ieee80211_i.h"
#include "driver-ops.h"
#include "debugfs_key.h"
#include "aes_ccm.h"
#include "aes_cmac.h"
Go to the source code of this file.
Functions | |
static void | __ieee80211_key_destroy (struct ieee80211_key *key) |
void | __ieee80211_key_free (struct ieee80211_key *key) |
static void | __ieee80211_key_replace (struct ieee80211_sub_if_data *sdata, struct sta_info *sta, bool pairwise, struct ieee80211_key *old, struct ieee80211_key *new) |
static void | __ieee80211_set_default_key (struct ieee80211_sub_if_data *sdata, int idx, bool uni, bool multi) |
static void | __ieee80211_set_default_mgmt_key (struct ieee80211_sub_if_data *sdata, int idx) |
static void | assert_key_lock (struct ieee80211_local *local) |
EXPORT_SYMBOL (ieee80211_iter_keys) | |
EXPORT_SYMBOL (ieee80211_get_key_tx_seq) | |
EXPORT_SYMBOL (ieee80211_get_key_rx_seq) | |
EXPORT_SYMBOL_GPL (ieee80211_key_removed) | |
EXPORT_SYMBOL_GPL (ieee80211_gtk_rekey_notify) | |
void | ieee80211_disable_keys (struct ieee80211_sub_if_data *sdata) |
void | ieee80211_enable_keys (struct ieee80211_sub_if_data *sdata) |
void | ieee80211_free_keys (struct ieee80211_sub_if_data *sdata) |
void | ieee80211_get_key_rx_seq (struct ieee80211_key_conf *keyconf, int tid, struct ieee80211_key_seq *seq) |
void | ieee80211_get_key_tx_seq (struct ieee80211_key_conf *keyconf, struct ieee80211_key_seq *seq) |
void | ieee80211_gtk_rekey_notify (struct ieee80211_vif *vif, const u8 *bssid, const u8 *replay_ctr, gfp_t gfp) |
void | ieee80211_iter_keys (struct ieee80211_hw *hw, struct ieee80211_vif *vif, void(*iter)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key, void *data), void *iter_data) |
struct ieee80211_key * | ieee80211_key_alloc (u32 cipher, int idx, size_t key_len, const u8 *key_data, size_t seq_len, const u8 *seq) |
static void | ieee80211_key_disable_hw_accel (struct ieee80211_key *key) |
static int | ieee80211_key_enable_hw_accel (struct ieee80211_key *key) |
void | ieee80211_key_free (struct ieee80211_local *local, struct ieee80211_key *key) |
int | ieee80211_key_link (struct ieee80211_key *key, struct ieee80211_sub_if_data *sdata, struct sta_info *sta) |
void | ieee80211_key_removed (struct ieee80211_key_conf *key_conf) |
void | ieee80211_set_default_key (struct ieee80211_sub_if_data *sdata, int idx, bool uni, bool multi) |
void | ieee80211_set_default_mgmt_key (struct ieee80211_sub_if_data *sdata, int idx) |
static void | increment_tailroom_need_count (struct ieee80211_sub_if_data *sdata) |
Variables | |
static const u8 | bcast_addr [ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } |
static void __ieee80211_key_destroy | ( | struct ieee80211_key * | key | ) | [static] |
Definition at line 416 of file kernel-3.5/key.c.
void __ieee80211_key_free | ( | struct ieee80211_key * | key | ) |
Definition at line 508 of file kernel-3.5/key.c.
static void __ieee80211_key_replace | ( | struct ieee80211_sub_if_data * | sdata, |
struct sta_info * | sta, | ||
bool | pairwise, | ||
struct ieee80211_key * | old, | ||
struct ieee80211_key * | new | ||
) | [static] |
Definition at line 268 of file kernel-3.5/key.c.
static void __ieee80211_set_default_key | ( | struct ieee80211_sub_if_data * | sdata, |
int | idx, | ||
bool | uni, | ||
bool | multi | ||
) | [static] |
Definition at line 217 of file kernel-3.5/key.c.
static void __ieee80211_set_default_mgmt_key | ( | struct ieee80211_sub_if_data * | sdata, |
int | idx | ||
) | [static] |
Definition at line 244 of file kernel-3.5/key.c.
static void assert_key_lock | ( | struct ieee80211_local * | local | ) | [static] |
Definition at line 53 of file kernel-3.5/key.c.
void ieee80211_disable_keys | ( | struct ieee80211_sub_if_data * | sdata | ) |
Definition at line 585 of file kernel-3.5/key.c.
void ieee80211_enable_keys | ( | struct ieee80211_sub_if_data * | sdata | ) |
Definition at line 531 of file kernel-3.5/key.c.
void ieee80211_free_keys | ( | struct ieee80211_sub_if_data * | sdata | ) |
Definition at line 599 of file kernel-3.5/key.c.
void ieee80211_get_key_rx_seq | ( | struct ieee80211_key_conf * | keyconf, |
int | tid, | ||
struct ieee80211_key_seq * | seq | ||
) |
Definition at line 667 of file kernel-3.5/key.c.
void ieee80211_get_key_tx_seq | ( | struct ieee80211_key_conf * | keyconf, |
struct ieee80211_key_seq * | seq | ||
) |
Definition at line 627 of file kernel-3.5/key.c.
void ieee80211_gtk_rekey_notify | ( | struct ieee80211_vif * | vif, |
const u8 * | bssid, | ||
const u8 * | replay_ctr, | ||
gfp_t | gfp | ||
) |
Definition at line 616 of file kernel-3.5/key.c.
void ieee80211_iter_keys | ( | struct ieee80211_hw * | hw, |
struct ieee80211_vif * | vif, | ||
void(*)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key, void *data) | iter, | ||
void * | iter_data | ||
) |
Definition at line 552 of file kernel-3.5/key.c.
struct ieee80211_key* ieee80211_key_alloc | ( | u32 | cipher, |
int | idx, | ||
size_t | key_len, | ||
const u8 * | key_data, | ||
size_t | seq_len, | ||
const u8 * | seq | ||
) | [read] |
Definition at line 329 of file kernel-3.5/key.c.
static void ieee80211_key_disable_hw_accel | ( | struct ieee80211_key * | key | ) | [static] |
Definition at line 161 of file kernel-3.5/key.c.
static int ieee80211_key_enable_hw_accel | ( | struct ieee80211_key * | key | ) | [static] |
Definition at line 88 of file kernel-3.5/key.c.
void ieee80211_key_free | ( | struct ieee80211_local * | local, |
struct ieee80211_key * | key | ||
) |
Definition at line 523 of file kernel-3.5/key.c.
int ieee80211_key_link | ( | struct ieee80211_key * | key, |
struct ieee80211_sub_if_data * | sdata, | ||
struct sta_info * | sta | ||
) |
Definition at line 442 of file kernel-3.5/key.c.
void ieee80211_key_removed | ( | struct ieee80211_key_conf * | key_conf | ) |
Definition at line 197 of file kernel-3.5/key.c.
void ieee80211_set_default_key | ( | struct ieee80211_sub_if_data * | sdata, |
int | idx, | ||
bool | uni, | ||
bool | multi | ||
) |
Definition at line 235 of file kernel-3.5/key.c.
void ieee80211_set_default_mgmt_key | ( | struct ieee80211_sub_if_data * | sdata, |
int | idx | ||
) |
Definition at line 259 of file kernel-3.5/key.c.
static void increment_tailroom_need_count | ( | struct ieee80211_sub_if_data * | sdata | ) | [static] |
Definition at line 58 of file kernel-3.5/key.c.
const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } [static] |
DOC: Key handling basics
Key handling in mac80211 is done based on per-interface (sub_if_data) keys and per-station keys. Since each station belongs to an interface, each station key also belongs to that interface.
Hardware acceleration is done on a best-effort basis for algorithms that are implemented in software, for each key the hardware is asked to enable that key for offloading but if it cannot do that the key is simply kept for software encryption (unless it is for an algorithm that isn't implemented in software). There is currently no way of knowing whether a key is handled in SW or HW except by looking into debugfs.
All key management is internally protected by a mutex. Within all other parts of mac80211, key references are, just as STA structure references, protected by RCU. Note, however, that some things are unprotected, namely the key->sta dereferences within the hardware acceleration functions. This means that sta_info_destroy() must remove the key which waits for an RCU grace period.
Definition at line 51 of file kernel-3.5/key.c.