Lines Matching refs:key

66  * Default "null" key management routines.
73 *keyix = 0; /* use key index 0 for ucast key */
101 * Reset key state to an unused state. The crypto
102 * key allocation mechanism insures other state (e.g.
103 * key data) is properly setup before a key is used.
116 * Establish a relationship between the specified key and cipher
118 * Note that when a fixed key index is required it must be specified
121 * This must be the first call applied to a key; all the other key
130 struct ieee80211_key *key)
155 oflags = key->wk_flags;
169 * combination; we handle it by flagging each key,
180 * Bind cipher to key instance. Note we do this
185 if (key->wk_cipher != cip || key->wk_flags != flags) {
193 key->wk_flags = (uint16_t)flags;
194 keyctx = cip->ic_attach(ic, key);
198 key->wk_flags = oflags; /* restore old flags */
201 CIPHER_DETACH(key); /* Detach old cipher */
202 key->wk_cipher = cip;
203 key->wk_private = keyctx;
208 key->wk_flags = (uint16_t)flags;
211 * Ask the driver for a key index if we don't have one.
212 * Note that entries in the global key table always have
216 * crypto we also call the driver to give us a key index.
218 if (key->wk_keyix == IEEE80211_KEYIX_NONE) {
219 if (!DEV_KEY_ALLOC(ic, key, &keyix, &rxkeyix)) {
225 * the key in a inconsistent state if the caller
228 if ((key->wk_flags & IEEE80211_KEY_SWCRYPT) == 0) {
233 oflags = key->wk_flags;
243 key->wk_keyix = keyix;
244 key->wk_rxkeyix = rxkeyix;
250 * Remove the key (no locking, for internal use).
253 ieee80211_crypto_delkey_locked(ieee80211com_t *ic, struct ieee80211_key *key)
257 ASSERT(key->wk_cipher != NULL);
259 keyix = key->wk_keyix;
264 if (!DEV_KEY_DELETE(ic, key)) {
267 "driverdeletes key %u failed\n", keyix);
270 CIPHER_DETACH(key);
271 bzero(key, sizeof (struct ieee80211_key));
272 /* NB: cannot depend on key index to decide this */
273 ieee80211_crypto_resetkey(ic, key, IEEE80211_KEYIX_NONE);
278 * Remove the specified key.
281 ieee80211_crypto_delkey(ieee80211com_t *ic, struct ieee80211_key *key)
286 status = ieee80211_crypto_delkey_locked(ic, key);
292 * Clear the global key table.
306 * Set the contents of the specified key.
313 ieee80211_crypto_setkey(ieee80211com_t *ic, struct ieee80211_key *key,
316 const struct ieee80211_cipher *cip = key->wk_cipher;
322 cip->ic_name, key->wk_keyix, key->wk_flags,
323 ieee80211_macaddr_sprintf(macaddr), key->wk_keylen);
326 * Give cipher a chance to validate key contents.
329 if (cip->ic_setkey(key) == 0) {
331 "cipher %s rejected key index %u len %u flags 0x%x\n",
332 cip->ic_name, key->wk_keyix, key->wk_keylen,
333 key->wk_flags);
336 if (key->wk_keyix == IEEE80211_KEYIX_NONE) {
338 "no key index; should not happen!\n");
341 return (DEV_KEY_SET(ic, key, macaddr));
345 * Return the transmit key to use in sending a frame.
359 struct ieee80211_key *key;
373 key = ieee80211_crypto_getkey(ic);
374 if (key == NULL)
377 cipher = key->wk_cipher->ic_cipher;
383 * Add privacy headers appropriate for the specified key.
395 " No default xmit key for frame\n");
424 * Locate the key. If unicast and there is no unicast
425 * key then we fall back to the key id in the header.
427 * the key id in the header is meaningless (typically 0).
433 /* check to avoid panic when wep is on but key is not set */
463 * Initialize the driver key support routines to noop entries.