Main index | Section 9 | Options |
#include <net80211/ieee80211_var.h>
void
ieee80211_crypto_register(const struct ieee80211_cipher *);
void
ieee80211_crypto_unregister(const struct ieee80211_cipher *);
int
ieee80211_crypto_available(int cipher);
void
ieee80211_notify_replay_failure(struct ieee80211vap *, const struct ieee80211_frame *, const struct ieee80211_key *, uint64_t rsc, int tid);
void
ieee80211_notify_michael_failure(struct ieee80211vap *, const struct ieee80211_frame *, u_int keyix);
int
ieee80211_crypto_newkey(struct ieee80211vap *, int cipher, int flags, struct ieee80211_key *);
int
ieee80211_crypto_setkey(struct ieee80211vap *, struct ieee80211_key *);
int
ieee80211_crypto_delkey(struct ieee80211vap *, struct ieee80211_key *);
void
ieee80211_key_update_begin(struct ieee80211vap *);
void
ieee80211_key_update_end(struct ieee80211vap *);
void
ieee80211_crypto_delglobalkeys(struct ieee80211vap *);
void
ieee80211_crypto_reload_keys(struct ieee80211com *);
struct ieee80211_key *
ieee80211_crypto_encap(struct ieee80211_node *, struct mbuf *);
struct ieee80211_key *
ieee80211_crypto_decap(struct ieee80211_node *, struct mbuf *, int flags);
int
ieee80211_crypto_demic(struct ieee80211vap *, struct ieee80211_key *, struct mbuf *, int force);
int
ieee80211_crypto_enmic(struct ieee80211vap *, struct ieee80211_key *, struct mbuf *, int force);
Cipher modules can associate private state to each key through the wk_private structure member. If state is setup by the module it will be called before a key is destroyed so it can reclaim resources.
Crypto modules can notify the system of two events. When a packet replay event is recognized ieee80211_notify_replay_failure() can be used to signal the event. When a TKIP Michael failure is detected ieee80211_notify_michael_failure() can be invoked. Drivers may also use these routines to signal events detected by the hardware.
net80211 provides ioctl(2) operations for managing both global and per-station keys. Drivers typically do not participate in software key management; they are involved only when providing hardware acceleration of cryptographic operations.
ieee80211_crypto_newkey() is used to allocate a new net80211 key or reconfigure an existing key. The cipher must be specified along with any fixed key index. The net80211 layer will handle allocating cipher and driver resources to support the key.
Once a key is allocated it's contents can be set using ieee80211_crypto_setkey() and deleted with ieee80211_crypto_delkey() (with any cipher and driver resources reclaimed).
ieee80211_crypto_delglobalkeys() is used to reclaim all keys in the global key table for a vap; it typically is used only within the net80211 layer.
ieee80211_crypto_reload_keys() handles hardware key state reloading from software key state, such as required after a suspend/resume cycle.
When net80211 allocates a software key and the driver can accelerate the cipher operations the iv_key_alloc method will be invoked. Drivers may return a token that is associated with outbound traffic (for use in encrypting frames). Otherwise, e.g. if hardware resources are not available, the driver will not return a token and net80211 will arrange to do the work in software and pass frames to the driver that are already prepared for transmission.
For receive, drivers mark frames with the M_WEP mbuf flag to indicate the hardware has decrypted the payload. If frames have the IEEE80211_FC1_PROTECTED bit marked in their 802.11 header and are not tagged with M_WEP then decryption is done in software. For more complicated scenarios the software key state is consulted; e.g. to decide if Michael verification needs to be done in software after the hardware has handled TKIP decryption.
Drivers that manage complicated key data structures, e.g. faulting software keys into a hardware key cache, can safely manipulate software key state by bracketing their work with calls to ieee80211_key_update_begin() and ieee80211_key_update_end(). These calls also synchronize hardware key state update when receive traffic is active.
IEEE80211_CRYPTO (9) | March 29, 2010 |
Main index | Section 9 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | C is a language that combines all the elegance and power of assembly language with all the readability and maintainability of assembly language. | ” |