Lines Matching +full:key +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright 2003-2005 Devicescape Software, Inc.
7 * Copyright (C) 2021-2023 Intel Corporation
13 #include "key.h"
22 struct ieee80211_key *key = file->private_data; \
24 format_string, key->prop); \
66 KEY_READ(ifindex, sdata->name, "%s\n");
74 struct ieee80211_key *key = file->private_data; in key_algorithm_read() local
75 u32 c = key->conf.cipher; in key_algorithm_read()
77 sprintf(buf, "%.2x-%.2x-%.2x:%d\n", in key_algorithm_read()
86 struct ieee80211_key *key = file->private_data; in key_tx_spec_write() local
90 switch (key->conf.cipher) { in key_tx_spec_write()
93 return -EINVAL; in key_tx_spec_write()
96 return -EOPNOTSUPP; in key_tx_spec_write()
108 /* PN is a 48-bit counter */ in key_tx_spec_write()
110 return -ERANGE; in key_tx_spec_write()
111 atomic64_set(&key->conf.tx_pn, pn); in key_tx_spec_write()
124 struct ieee80211_key *key = file->private_data; in key_tx_spec_read() local
126 switch (key->conf.cipher) { in key_tx_spec_read()
132 pn = atomic64_read(&key->conf.tx_pn); in key_tx_spec_read()
145 pn = atomic64_read(&key->conf.tx_pn); in key_tx_spec_read()
160 struct ieee80211_key *key = file->private_data; in key_rx_spec_read() local
165 switch (key->conf.cipher) { in key_rx_spec_read()
172 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
174 key->u.tkip.rx[i].iv32, in key_rx_spec_read()
175 key->u.tkip.rx[i].iv16); in key_rx_spec_read()
176 len = p - buf; in key_rx_spec_read()
181 rpn = key->u.ccmp.rx_pn[i]; in key_rx_spec_read()
182 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
184 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
187 len = p - buf; in key_rx_spec_read()
191 rpn = key->u.aes_cmac.rx_pn; in key_rx_spec_read()
192 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
194 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
196 len = p - buf; in key_rx_spec_read()
200 rpn = key->u.aes_gmac.rx_pn; in key_rx_spec_read()
201 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
203 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
205 len = p - buf; in key_rx_spec_read()
210 rpn = key->u.gcmp.rx_pn[i]; in key_rx_spec_read()
211 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
213 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
216 len = p - buf; in key_rx_spec_read()
228 struct ieee80211_key *key = file->private_data; in key_replays_read() local
232 switch (key->conf.cipher) { in key_replays_read()
235 len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays); in key_replays_read()
240 key->u.aes_cmac.replays); in key_replays_read()
245 key->u.aes_gmac.replays); in key_replays_read()
249 len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays); in key_replays_read()
261 struct ieee80211_key *key = file->private_data; in key_icverrors_read() local
265 switch (key->conf.cipher) { in key_icverrors_read()
269 key->u.aes_cmac.icverrors); in key_icverrors_read()
274 key->u.aes_gmac.icverrors); in key_icverrors_read()
286 struct ieee80211_key *key = file->private_data; in key_mic_failures_read() local
290 if (key->conf.cipher != WLAN_CIPHER_SUITE_TKIP) in key_mic_failures_read()
291 return -EINVAL; in key_mic_failures_read()
293 len = scnprintf(buf, sizeof(buf), "%u\n", key->u.tkip.mic_failures); in key_mic_failures_read()
302 struct ieee80211_key *key = file->private_data; in key_key_read() local
303 int i, bufsize = 2 * key->conf.keylen + 2; in key_key_read()
309 return -ENOMEM; in key_key_read()
311 for (i = 0; i < key->conf.keylen; i++) in key_key_read()
312 p += scnprintf(p, bufsize + buf - p, "%02x", key->conf.key[i]); in key_key_read()
313 p += scnprintf(p, bufsize+buf-p, "\n"); in key_key_read()
314 res = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); in key_key_read()
318 KEY_OPS(key);
321 debugfs_create_file(#name, 0400, key->debugfs.dir, \
322 key, &key_##name##_ops)
324 debugfs_create_file(#name, 0600, key->debugfs.dir, \
325 key, &key_##name##_ops);
327 void ieee80211_debugfs_key_add(struct ieee80211_key *key) in ieee80211_debugfs_key_add() argument
333 if (!key->local->debugfs.keys) in ieee80211_debugfs_key_add()
337 key->debugfs.cnt = keycount; in ieee80211_debugfs_key_add()
339 key->debugfs.dir = debugfs_create_dir(buf, in ieee80211_debugfs_key_add()
340 key->local->debugfs.keys); in ieee80211_debugfs_key_add()
342 sta = key->sta; in ieee80211_debugfs_key_add()
345 sta->sdata->name, sta->sta.addr); in ieee80211_debugfs_key_add()
346 key->debugfs.stalink = in ieee80211_debugfs_key_add()
347 debugfs_create_symlink("station", key->debugfs.dir, buf); in ieee80211_debugfs_key_add()
360 DEBUGFS_ADD(key); in ieee80211_debugfs_key_add()
364 void ieee80211_debugfs_key_remove(struct ieee80211_key *key) in ieee80211_debugfs_key_remove() argument
366 if (!key) in ieee80211_debugfs_key_remove()
369 debugfs_remove_recursive(key->debugfs.dir); in ieee80211_debugfs_key_remove()
370 key->debugfs.dir = NULL; in ieee80211_debugfs_key_remove()
376 struct ieee80211_key *key; in ieee80211_debugfs_key_update_default() local
378 if (!sdata->vif.debugfs_dir) in ieee80211_debugfs_key_update_default()
381 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_debugfs_key_update_default()
383 debugfs_remove(sdata->debugfs.default_unicast_key); in ieee80211_debugfs_key_update_default()
384 sdata->debugfs.default_unicast_key = NULL; in ieee80211_debugfs_key_update_default()
386 if (sdata->default_unicast_key) { in ieee80211_debugfs_key_update_default()
387 key = wiphy_dereference(sdata->local->hw.wiphy, in ieee80211_debugfs_key_update_default()
388 sdata->default_unicast_key); in ieee80211_debugfs_key_update_default()
389 sprintf(buf, "../keys/%d", key->debugfs.cnt); in ieee80211_debugfs_key_update_default()
390 sdata->debugfs.default_unicast_key = in ieee80211_debugfs_key_update_default()
392 sdata->vif.debugfs_dir, buf); in ieee80211_debugfs_key_update_default()
395 debugfs_remove(sdata->debugfs.default_multicast_key); in ieee80211_debugfs_key_update_default()
396 sdata->debugfs.default_multicast_key = NULL; in ieee80211_debugfs_key_update_default()
398 if (sdata->deflink.default_multicast_key) { in ieee80211_debugfs_key_update_default()
399 key = wiphy_dereference(sdata->local->hw.wiphy, in ieee80211_debugfs_key_update_default()
400 sdata->deflink.default_multicast_key); in ieee80211_debugfs_key_update_default()
401 sprintf(buf, "../keys/%d", key->debugfs.cnt); in ieee80211_debugfs_key_update_default()
402 sdata->debugfs.default_multicast_key = in ieee80211_debugfs_key_update_default()
404 sdata->vif.debugfs_dir, buf); in ieee80211_debugfs_key_update_default()
411 struct ieee80211_key *key; in ieee80211_debugfs_key_add_mgmt_default() local
413 if (!sdata->vif.debugfs_dir) in ieee80211_debugfs_key_add_mgmt_default()
416 key = wiphy_dereference(sdata->local->hw.wiphy, in ieee80211_debugfs_key_add_mgmt_default()
417 sdata->deflink.default_mgmt_key); in ieee80211_debugfs_key_add_mgmt_default()
418 if (key) { in ieee80211_debugfs_key_add_mgmt_default()
419 sprintf(buf, "../keys/%d", key->debugfs.cnt); in ieee80211_debugfs_key_add_mgmt_default()
420 sdata->debugfs.default_mgmt_key = in ieee80211_debugfs_key_add_mgmt_default()
422 sdata->vif.debugfs_dir, buf); in ieee80211_debugfs_key_add_mgmt_default()
432 debugfs_remove(sdata->debugfs.default_mgmt_key); in ieee80211_debugfs_key_remove_mgmt_default()
433 sdata->debugfs.default_mgmt_key = NULL; in ieee80211_debugfs_key_remove_mgmt_default()
440 struct ieee80211_key *key; in ieee80211_debugfs_key_add_beacon_default() local
442 if (!sdata->vif.debugfs_dir) in ieee80211_debugfs_key_add_beacon_default()
445 key = wiphy_dereference(sdata->local->hw.wiphy, in ieee80211_debugfs_key_add_beacon_default()
446 sdata->deflink.default_beacon_key); in ieee80211_debugfs_key_add_beacon_default()
447 if (key) { in ieee80211_debugfs_key_add_beacon_default()
448 sprintf(buf, "../keys/%d", key->debugfs.cnt); in ieee80211_debugfs_key_add_beacon_default()
449 sdata->debugfs.default_beacon_key = in ieee80211_debugfs_key_add_beacon_default()
451 sdata->vif.debugfs_dir, buf); in ieee80211_debugfs_key_add_beacon_default()
463 debugfs_remove(sdata->debugfs.default_beacon_key); in ieee80211_debugfs_key_remove_beacon_default()
464 sdata->debugfs.default_beacon_key = NULL; in ieee80211_debugfs_key_remove_beacon_default()
467 void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, in ieee80211_debugfs_key_sta_del() argument
470 debugfs_remove(key->debugfs.stalink); in ieee80211_debugfs_key_sta_del()
471 key->debugfs.stalink = NULL; in ieee80211_debugfs_key_sta_del()