Lines Matching full:key
32 * DOC: Key handling basics
34 * Key handling in mac80211 is done based on per-interface (sub_if_data)
36 * each station key also belongs to that interface.
39 * that are implemented in software, for each key the hardware is asked
40 * to enable that key for offloading but if it cannot do that the key is
43 * There is currently no way of knowing whether a key is handled in SW
46 * All key management is internally protected by a mutex. Within all
47 * other parts of mac80211, key references are, just as STA structure
49 * unprotected, namely the key->sta dereferences within the hardware
51 * remove the key which waits for an RCU grace period.
87 * 1. SKB resize was skipped because no key was added but just before in increment_tailroom_need_count()
88 * the xmit key is added and SW encryption kicks off. in increment_tailroom_need_count()
91 * just before xmit one of the key is deleted and SW encryption kicks in increment_tailroom_need_count()
125 static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) in ieee80211_key_enable_hw_accel() argument
127 struct ieee80211_sub_if_data *sdata = key->sdata; in ieee80211_key_enable_hw_accel()
133 if (key->flags & KEY_FLAG_TAINTED) { in ieee80211_key_enable_hw_accel()
134 /* If we get here, it's during resume and the key is in ieee80211_key_enable_hw_accel()
141 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && in ieee80211_key_enable_hw_accel()
142 !(key->conf.flags & (IEEE80211_KEY_FLAG_GENERATE_MMIC | in ieee80211_key_enable_hw_accel()
147 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; in ieee80211_key_enable_hw_accel()
151 if (!key->local->ops->set_key) in ieee80211_key_enable_hw_accel()
154 assert_key_lock(key->local); in ieee80211_key_enable_hw_accel()
156 sta = key->sta; in ieee80211_key_enable_hw_accel()
162 if (sta && !(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE) && in ieee80211_key_enable_hw_accel()
163 !ieee80211_hw_check(&key->local->hw, SUPPORTS_PER_STA_GTK)) in ieee80211_key_enable_hw_accel()
174 if (!(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) { in ieee80211_key_enable_hw_accel()
180 if (key->conf.link_id >= 0 && sdata->vif.active_links && in ieee80211_key_enable_hw_accel()
181 !(sdata->vif.active_links & BIT(key->conf.link_id))) in ieee80211_key_enable_hw_accel()
184 ret = drv_set_key(key->local, SET_KEY, sdata, in ieee80211_key_enable_hw_accel()
185 sta ? &sta->sta : NULL, &key->conf); in ieee80211_key_enable_hw_accel()
188 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; in ieee80211_key_enable_hw_accel()
190 if (!(key->conf.flags & (IEEE80211_KEY_FLAG_GENERATE_MMIC | in ieee80211_key_enable_hw_accel()
195 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && in ieee80211_key_enable_hw_accel()
196 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)); in ieee80211_key_enable_hw_accel()
198 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_MIC_SPACE) && in ieee80211_key_enable_hw_accel()
199 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)); in ieee80211_key_enable_hw_accel()
206 "failed to set key (%d, %pM) to hardware (%d)\n", in ieee80211_key_enable_hw_accel()
207 key->conf.keyidx, in ieee80211_key_enable_hw_accel()
211 switch (key->conf.cipher) { in ieee80211_key_enable_hw_accel()
226 if (ieee80211_hw_check(&key->local->hw, SW_CRYPTO_CONTROL)) in ieee80211_key_enable_hw_accel()
234 static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) in ieee80211_key_disable_hw_accel() argument
242 if (!key || !key->local->ops->set_key) in ieee80211_key_disable_hw_accel()
245 assert_key_lock(key->local); in ieee80211_key_disable_hw_accel()
247 if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) in ieee80211_key_disable_hw_accel()
250 sta = key->sta; in ieee80211_key_disable_hw_accel()
251 sdata = key->sdata; in ieee80211_key_disable_hw_accel()
253 if (key->conf.link_id >= 0 && sdata->vif.active_links && in ieee80211_key_disable_hw_accel()
254 !(sdata->vif.active_links & BIT(key->conf.link_id))) in ieee80211_key_disable_hw_accel()
257 if (!(key->conf.flags & (IEEE80211_KEY_FLAG_GENERATE_MMIC | in ieee80211_key_disable_hw_accel()
262 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; in ieee80211_key_disable_hw_accel()
263 ret = drv_set_key(key->local, DISABLE_KEY, sdata, in ieee80211_key_disable_hw_accel()
264 sta ? &sta->sta : NULL, &key->conf); in ieee80211_key_disable_hw_accel()
268 "failed to remove key (%d, %pM) from hardware (%d)\n", in ieee80211_key_disable_hw_accel()
269 key->conf.keyidx, in ieee80211_key_disable_hw_accel()
273 static int _ieee80211_set_tx_key(struct ieee80211_key *key, bool force) in _ieee80211_set_tx_key() argument
275 struct sta_info *sta = key->sta; in _ieee80211_set_tx_key()
276 struct ieee80211_local *local = key->local; in _ieee80211_set_tx_key()
282 sta->ptk_idx = key->conf.keyidx; in _ieee80211_set_tx_key()
291 int ieee80211_set_tx_key(struct ieee80211_key *key) in ieee80211_set_tx_key() argument
293 return _ieee80211_set_tx_key(key, false); in ieee80211_set_tx_key()
306 /* Extended Key ID key install, initial one or rekey */ in ieee80211_pairwise_rekey()
310 /* Aggregation Sessions with Extended Key ID must not in ieee80211_pairwise_rekey()
315 * supporting A-MPDU key borders. (Blocking Tx only in ieee80211_pairwise_rekey()
327 /* Rekey without Extended Key ID. in ieee80211_pairwise_rekey()
335 /* Stop Tx till we are on the new key */ in ieee80211_pairwise_rekey()
359 struct ieee80211_key *key = NULL; in __ieee80211_set_default_key() local
364 key = key_mtx_dereference(sdata->local, sdata->keys[idx]); in __ieee80211_set_default_key()
365 if (!key) in __ieee80211_set_default_key()
366 key = key_mtx_dereference(sdata->local, link->gtk[idx]); in __ieee80211_set_default_key()
370 rcu_assign_pointer(sdata->default_unicast_key, key); in __ieee80211_set_default_key()
377 rcu_assign_pointer(link->default_multicast_key, key); in __ieee80211_set_default_key()
394 struct ieee80211_key *key = NULL; in __ieee80211_set_default_mgmt_key() local
400 key = key_mtx_dereference(sdata->local, link->gtk[idx]); in __ieee80211_set_default_mgmt_key()
402 rcu_assign_pointer(link->default_mgmt_key, key); in __ieee80211_set_default_mgmt_key()
419 struct ieee80211_key *key = NULL; in __ieee80211_set_default_beacon_key() local
426 key = key_mtx_dereference(sdata->local, link->gtk[idx]); in __ieee80211_set_default_beacon_key()
428 rcu_assign_pointer(link->default_beacon_key, key); in __ieee80211_set_default_beacon_key()
499 /* Unicast rekey needs special handling. With Extended Key ID in ieee80211_key_replace()
532 /* Only needed for transition from no key -> key. in ieee80211_key_replace()
533 * Still triggers unnecessary when using Extended Key ID in ieee80211_key_replace()
534 * and installing the second key ID the first time. in ieee80211_key_replace()
591 struct ieee80211_key *key; in ieee80211_key_alloc() local
599 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); in ieee80211_key_alloc()
600 if (!key) in ieee80211_key_alloc()
605 * key to the hardware if possible. in ieee80211_key_alloc()
607 key->conf.flags = 0; in ieee80211_key_alloc()
608 key->flags = 0; in ieee80211_key_alloc()
610 key->conf.link_id = -1; in ieee80211_key_alloc()
611 key->conf.cipher = cipher; in ieee80211_key_alloc()
612 key->conf.keyidx = idx; in ieee80211_key_alloc()
613 key->conf.keylen = key_len; in ieee80211_key_alloc()
617 key->conf.iv_len = IEEE80211_WEP_IV_LEN; in ieee80211_key_alloc()
618 key->conf.icv_len = IEEE80211_WEP_ICV_LEN; in ieee80211_key_alloc()
621 key->conf.iv_len = IEEE80211_TKIP_IV_LEN; in ieee80211_key_alloc()
622 key->conf.icv_len = IEEE80211_TKIP_ICV_LEN; in ieee80211_key_alloc()
625 key->u.tkip.rx[i].iv32 = in ieee80211_key_alloc()
627 key->u.tkip.rx[i].iv16 = in ieee80211_key_alloc()
631 spin_lock_init(&key->u.tkip.txlock); in ieee80211_key_alloc()
634 key->conf.iv_len = IEEE80211_CCMP_HDR_LEN; in ieee80211_key_alloc()
635 key->conf.icv_len = IEEE80211_CCMP_MIC_LEN; in ieee80211_key_alloc()
639 key->u.ccmp.rx_pn[i][j] = in ieee80211_key_alloc()
643 * Initialize AES key state here as an optimization so that in ieee80211_key_alloc()
646 key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt( in ieee80211_key_alloc()
648 if (IS_ERR(key->u.ccmp.tfm)) { in ieee80211_key_alloc()
649 err = PTR_ERR(key->u.ccmp.tfm); in ieee80211_key_alloc()
650 kfree(key); in ieee80211_key_alloc()
655 key->conf.iv_len = IEEE80211_CCMP_256_HDR_LEN; in ieee80211_key_alloc()
656 key->conf.icv_len = IEEE80211_CCMP_256_MIC_LEN; in ieee80211_key_alloc()
659 key->u.ccmp.rx_pn[i][j] = in ieee80211_key_alloc()
661 /* Initialize AES key state here as an optimization so that in ieee80211_key_alloc()
664 key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt( in ieee80211_key_alloc()
666 if (IS_ERR(key->u.ccmp.tfm)) { in ieee80211_key_alloc()
667 err = PTR_ERR(key->u.ccmp.tfm); in ieee80211_key_alloc()
668 kfree(key); in ieee80211_key_alloc()
674 key->conf.iv_len = 0; in ieee80211_key_alloc()
676 key->conf.icv_len = sizeof(struct ieee80211_mmie); in ieee80211_key_alloc()
678 key->conf.icv_len = sizeof(struct ieee80211_mmie_16); in ieee80211_key_alloc()
681 key->u.aes_cmac.rx_pn[j] = in ieee80211_key_alloc()
684 * Initialize AES key state here as an optimization so that in ieee80211_key_alloc()
687 key->u.aes_cmac.tfm = in ieee80211_key_alloc()
689 if (IS_ERR(key->u.aes_cmac.tfm)) { in ieee80211_key_alloc()
690 err = PTR_ERR(key->u.aes_cmac.tfm); in ieee80211_key_alloc()
691 kfree(key); in ieee80211_key_alloc()
697 key->conf.iv_len = 0; in ieee80211_key_alloc()
698 key->conf.icv_len = sizeof(struct ieee80211_mmie_16); in ieee80211_key_alloc()
701 key->u.aes_gmac.rx_pn[j] = in ieee80211_key_alloc()
703 /* Initialize AES key state here as an optimization so that in ieee80211_key_alloc()
706 key->u.aes_gmac.tfm = in ieee80211_key_alloc()
708 if (IS_ERR(key->u.aes_gmac.tfm)) { in ieee80211_key_alloc()
709 err = PTR_ERR(key->u.aes_gmac.tfm); in ieee80211_key_alloc()
710 kfree(key); in ieee80211_key_alloc()
716 key->conf.iv_len = IEEE80211_GCMP_HDR_LEN; in ieee80211_key_alloc()
717 key->conf.icv_len = IEEE80211_GCMP_MIC_LEN; in ieee80211_key_alloc()
720 key->u.gcmp.rx_pn[i][j] = in ieee80211_key_alloc()
722 /* Initialize AES key state here as an optimization so that in ieee80211_key_alloc()
725 key->u.gcmp.tfm = ieee80211_aes_gcm_key_setup_encrypt(key_data, in ieee80211_key_alloc()
727 if (IS_ERR(key->u.gcmp.tfm)) { in ieee80211_key_alloc()
728 err = PTR_ERR(key->u.gcmp.tfm); in ieee80211_key_alloc()
729 kfree(key); in ieee80211_key_alloc()
734 memcpy(key->conf.key, key_data, key_len); in ieee80211_key_alloc()
735 INIT_LIST_HEAD(&key->list); in ieee80211_key_alloc()
737 return key; in ieee80211_key_alloc()
740 static void ieee80211_key_free_common(struct ieee80211_key *key) in ieee80211_key_free_common() argument
742 switch (key->conf.cipher) { in ieee80211_key_free_common()
745 ieee80211_aes_key_free(key->u.ccmp.tfm); in ieee80211_key_free_common()
749 ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); in ieee80211_key_free_common()
753 ieee80211_aes_gmac_key_free(key->u.aes_gmac.tfm); in ieee80211_key_free_common()
757 ieee80211_aes_gcm_key_free(key->u.gcmp.tfm); in ieee80211_key_free_common()
760 kfree_sensitive(key); in ieee80211_key_free_common()
763 static void __ieee80211_key_destroy(struct ieee80211_key *key, in __ieee80211_key_destroy() argument
766 if (key->local) { in __ieee80211_key_destroy()
767 struct ieee80211_sub_if_data *sdata = key->sdata; in __ieee80211_key_destroy()
769 ieee80211_debugfs_key_remove(key); in __ieee80211_key_destroy()
781 ieee80211_key_free_common(key); in __ieee80211_key_destroy()
784 static void ieee80211_key_destroy(struct ieee80211_key *key, in ieee80211_key_destroy() argument
787 if (!key) in ieee80211_key_destroy()
791 * Synchronize so the TX path and rcu key iterators in ieee80211_key_destroy()
792 * can no longer be using this key before we free/remove it. in ieee80211_key_destroy()
796 __ieee80211_key_destroy(key, delay_tailroom); in ieee80211_key_destroy()
799 void ieee80211_key_free_unused(struct ieee80211_key *key) in ieee80211_key_free_unused() argument
801 WARN_ON(key->sdata || key->local); in ieee80211_key_free_unused()
802 ieee80211_key_free_common(key); in ieee80211_key_free_unused()
815 tk_old = old->conf.key; in ieee80211_key_identical()
816 tk_new = new->conf.key; in ieee80211_key_identical()
819 * In station mode, don't compare the TX MIC key, as it's never used in ieee80211_key_identical()
838 int ieee80211_key_link(struct ieee80211_key *key, in ieee80211_key_link() argument
845 int idx = key->conf.keyidx; in ieee80211_key_link()
846 bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; in ieee80211_key_link()
863 /* The rekey code assumes that the old and new key are using in ieee80211_key_link()
866 if ((alt_key && alt_key->conf.cipher != key->conf.cipher) || in ieee80211_key_link()
867 (old_key && old_key->conf.cipher != key->conf.cipher)) in ieee80211_key_link()
871 int link_id = key->conf.link_id; in ieee80211_key_link()
894 if (old_key && old_key->conf.cipher != key->conf.cipher) in ieee80211_key_link()
899 * Silently accept key re-installation without really installing the in ieee80211_key_link()
900 * new version of the key to avoid nonce reuse or replay issues. in ieee80211_key_link()
902 if (ieee80211_key_identical(sdata, old_key, key)) { in ieee80211_key_link()
903 ieee80211_key_free_unused(key); in ieee80211_key_link()
908 key->local = sdata->local; in ieee80211_key_link()
909 key->sdata = sdata; in ieee80211_key_link()
910 key->sta = sta; in ieee80211_key_link()
913 * Assign a unique ID to every key so we can easily prevent mixed in ieee80211_key_link()
914 * key and fragment cache attacks. in ieee80211_key_link()
916 key->color = atomic_inc_return(&key_color); in ieee80211_key_link()
920 ret = ieee80211_key_replace(sdata, link, sta, pairwise, old_key, key); in ieee80211_key_link()
923 ieee80211_debugfs_key_add(key); in ieee80211_key_link()
926 ieee80211_key_free(key, delay_tailroom); in ieee80211_key_link()
935 void ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom) in ieee80211_key_free() argument
937 if (!key) in ieee80211_key_free()
941 * Replace key with nothingness if it was ever used. in ieee80211_key_free()
943 if (key->sdata) in ieee80211_key_free()
944 ieee80211_key_replace(key->sdata, NULL, key->sta, in ieee80211_key_free()
945 key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, in ieee80211_key_free()
946 key, NULL); in ieee80211_key_free()
947 ieee80211_key_destroy(key, delay_tailroom); in ieee80211_key_free()
952 struct ieee80211_key *key; in ieee80211_reenable_keys() local
970 list_for_each_entry(key, &sdata->key_list, list) { in ieee80211_reenable_keys()
972 ieee80211_key_enable_hw_accel(key); in ieee80211_reenable_keys()
984 struct ieee80211_key_conf *key, in ieee80211_iter_keys() argument
989 struct ieee80211_key *key, *tmp; in ieee80211_iter_keys() local
997 list_for_each_entry_safe(key, tmp, &sdata->key_list, list) in ieee80211_iter_keys()
999 key->sta ? &key->sta->sta : NULL, in ieee80211_iter_keys()
1000 &key->conf, iter_data); in ieee80211_iter_keys()
1003 list_for_each_entry_safe(key, tmp, in ieee80211_iter_keys()
1006 key->sta ? &key->sta->sta : NULL, in ieee80211_iter_keys()
1007 &key->conf, iter_data); in ieee80211_iter_keys()
1019 struct ieee80211_key_conf *key, in _ieee80211_iter_keys_rcu() argument
1023 struct ieee80211_key *key; in _ieee80211_iter_keys_rcu() local
1025 list_for_each_entry_rcu(key, &sdata->key_list, list) { in _ieee80211_iter_keys_rcu()
1027 if (key->sta && key->sta->removed) in _ieee80211_iter_keys_rcu()
1029 if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) in _ieee80211_iter_keys_rcu()
1033 key->sta ? &key->sta->sta : NULL, in _ieee80211_iter_keys_rcu()
1034 &key->conf, iter_data); in _ieee80211_iter_keys_rcu()
1043 struct ieee80211_key_conf *key, in ieee80211_iter_keys_rcu() argument
1063 struct ieee80211_key *key, *tmp; in ieee80211_free_keys_iface() local
1072 list_for_each_entry_safe(key, tmp, &sdata->key_list, list) { in ieee80211_free_keys_iface()
1073 ieee80211_key_replace(key->sdata, NULL, key->sta, in ieee80211_free_keys_iface()
1074 key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, in ieee80211_free_keys_iface()
1075 key, NULL); in ieee80211_free_keys_iface()
1076 list_add_tail(&key->list, keys); in ieee80211_free_keys_iface()
1087 struct ieee80211_key *key, *tmp; in ieee80211_remove_link_keys() local
1090 list_for_each_entry_safe(key, tmp, &sdata->key_list, list) { in ieee80211_remove_link_keys()
1091 if (key->conf.link_id != link->link_id) in ieee80211_remove_link_keys()
1093 ieee80211_key_replace(key->sdata, link, key->sta, in ieee80211_remove_link_keys()
1094 key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, in ieee80211_remove_link_keys()
1095 key, NULL); in ieee80211_remove_link_keys()
1096 list_add_tail(&key->list, keys); in ieee80211_remove_link_keys()
1104 struct ieee80211_key *key, *tmp; in ieee80211_free_key_list() local
1107 list_for_each_entry_safe(key, tmp, keys, list) in ieee80211_free_key_list()
1108 __ieee80211_key_destroy(key, false); in ieee80211_free_key_list()
1118 struct ieee80211_key *key, *tmp; in ieee80211_free_keys() local
1134 list_for_each_entry_safe(key, tmp, &keys, list) in ieee80211_free_keys()
1135 __ieee80211_key_destroy(key, false); in ieee80211_free_keys()
1163 struct ieee80211_key *key; in ieee80211_free_sta_keys() local
1168 key = key_mtx_dereference(local, sta->deflink.gtk[i]); in ieee80211_free_sta_keys()
1169 if (!key) in ieee80211_free_sta_keys()
1171 ieee80211_key_replace(key->sdata, NULL, key->sta, in ieee80211_free_sta_keys()
1172 key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, in ieee80211_free_sta_keys()
1173 key, NULL); in ieee80211_free_sta_keys()
1174 __ieee80211_key_destroy(key, key->sdata->vif.type == in ieee80211_free_sta_keys()
1179 key = key_mtx_dereference(local, sta->ptk[i]); in ieee80211_free_sta_keys()
1180 if (!key) in ieee80211_free_sta_keys()
1182 ieee80211_key_replace(key->sdata, NULL, key->sta, in ieee80211_free_sta_keys()
1183 key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, in ieee80211_free_sta_keys()
1184 key, NULL); in ieee80211_free_sta_keys()
1185 __ieee80211_key_destroy(key, key->sdata->vif.type == in ieee80211_free_sta_keys()
1202 * and then new keys are installed. The first new key causes the in ieee80211_delayed_tailroom_dec()
1206 * key removal for a while, so if we roam the value is larger than in ieee80211_delayed_tailroom_dec()
1236 struct ieee80211_key *key; in ieee80211_get_key_rx_seq() local
1239 key = container_of(keyconf, struct ieee80211_key, conf); in ieee80211_get_key_rx_seq()
1241 switch (key->conf.cipher) { in ieee80211_get_key_rx_seq()
1245 seq->tkip.iv32 = key->u.tkip.rx[tid].iv32; in ieee80211_get_key_rx_seq()
1246 seq->tkip.iv16 = key->u.tkip.rx[tid].iv16; in ieee80211_get_key_rx_seq()
1253 pn = key->u.ccmp.rx_pn[IEEE80211_NUM_TIDS]; in ieee80211_get_key_rx_seq()
1255 pn = key->u.ccmp.rx_pn[tid]; in ieee80211_get_key_rx_seq()
1262 pn = key->u.aes_cmac.rx_pn; in ieee80211_get_key_rx_seq()
1269 pn = key->u.aes_gmac.rx_pn; in ieee80211_get_key_rx_seq()
1277 pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS]; in ieee80211_get_key_rx_seq()
1279 pn = key->u.gcmp.rx_pn[tid]; in ieee80211_get_key_rx_seq()
1289 struct ieee80211_key *key; in ieee80211_set_key_rx_seq() local
1292 key = container_of(keyconf, struct ieee80211_key, conf); in ieee80211_set_key_rx_seq()
1294 switch (key->conf.cipher) { in ieee80211_set_key_rx_seq()
1298 key->u.tkip.rx[tid].iv32 = seq->tkip.iv32; in ieee80211_set_key_rx_seq()
1299 key->u.tkip.rx[tid].iv16 = seq->tkip.iv16; in ieee80211_set_key_rx_seq()
1306 pn = key->u.ccmp.rx_pn[IEEE80211_NUM_TIDS]; in ieee80211_set_key_rx_seq()
1308 pn = key->u.ccmp.rx_pn[tid]; in ieee80211_set_key_rx_seq()
1315 pn = key->u.aes_cmac.rx_pn; in ieee80211_set_key_rx_seq()
1322 pn = key->u.aes_gmac.rx_pn; in ieee80211_set_key_rx_seq()
1330 pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS]; in ieee80211_set_key_rx_seq()
1332 pn = key->u.gcmp.rx_pn[tid]; in ieee80211_set_key_rx_seq()
1344 struct ieee80211_key *key; in ieee80211_remove_key() local
1346 key = container_of(keyconf, struct ieee80211_key, conf); in ieee80211_remove_key()
1348 assert_key_lock(key->local); in ieee80211_remove_key()
1351 * if key was uploaded, we assume the driver will/has remove(d) in ieee80211_remove_key()
1354 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { in ieee80211_remove_key()
1355 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; in ieee80211_remove_key()
1357 if (!(key->conf.flags & (IEEE80211_KEY_FLAG_GENERATE_MMIC | in ieee80211_remove_key()
1360 increment_tailroom_need_count(key->sdata); in ieee80211_remove_key()
1363 ieee80211_key_free(key, false); in ieee80211_remove_key()
1373 struct ieee80211_key *key; in ieee80211_gtk_rekey_add() local
1382 key = ieee80211_key_alloc(keyconf->cipher, keyconf->keyidx, in ieee80211_gtk_rekey_add()
1383 keyconf->keylen, keyconf->key, in ieee80211_gtk_rekey_add()
1385 if (IS_ERR(key)) in ieee80211_gtk_rekey_add()
1386 return ERR_CAST(key); in ieee80211_gtk_rekey_add()
1389 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; in ieee80211_gtk_rekey_add()
1392 err = ieee80211_key_link(key, &sdata->deflink, NULL); in ieee80211_gtk_rekey_add()
1396 return &key->conf; in ieee80211_gtk_rekey_add()
1402 struct ieee80211_key *key; in ieee80211_key_mic_failure() local
1404 key = container_of(keyconf, struct ieee80211_key, conf); in ieee80211_key_mic_failure()
1406 switch (key->conf.cipher) { in ieee80211_key_mic_failure()
1409 key->u.aes_cmac.icverrors++; in ieee80211_key_mic_failure()
1413 key->u.aes_gmac.icverrors++; in ieee80211_key_mic_failure()
1424 struct ieee80211_key *key; in ieee80211_key_replay() local
1426 key = container_of(keyconf, struct ieee80211_key, conf); in ieee80211_key_replay()
1428 switch (key->conf.cipher) { in ieee80211_key_replay()
1431 key->u.ccmp.replays++; in ieee80211_key_replay()
1435 key->u.aes_cmac.replays++; in ieee80211_key_replay()
1439 key->u.aes_gmac.replays++; in ieee80211_key_replay()
1443 key->u.gcmp.replays++; in ieee80211_key_replay()
1453 struct ieee80211_key *key; in ieee80211_key_switch_links() local
1456 list_for_each_entry(key, &sdata->key_list, list) { in ieee80211_key_switch_links()
1457 if (key->conf.link_id < 0 || in ieee80211_key_switch_links()
1458 !(del_links_mask & BIT(key->conf.link_id))) in ieee80211_key_switch_links()
1462 WARN_ON(key->sta); in ieee80211_key_switch_links()
1464 ieee80211_key_disable_hw_accel(key); in ieee80211_key_switch_links()
1467 list_for_each_entry(key, &sdata->key_list, list) { in ieee80211_key_switch_links()
1468 if (key->conf.link_id < 0 || in ieee80211_key_switch_links()
1469 !(add_links_mask & BIT(key->conf.link_id))) in ieee80211_key_switch_links()
1473 WARN_ON(key->sta); in ieee80211_key_switch_links()
1475 ret = ieee80211_key_enable_hw_accel(key); in ieee80211_key_switch_links()