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); \
63 KEY_READ(ifindex, sdata->name, "%s\n");
71 struct ieee80211_key *key = file->private_data; in key_algorithm_read() local
72 u32 c = key->conf.cipher; in key_algorithm_read()
74 sprintf(buf, "%.2x-%.2x-%.2x:%d\n", in key_algorithm_read()
83 struct ieee80211_key *key = file->private_data; in key_tx_spec_write() local
87 switch (key->conf.cipher) { in key_tx_spec_write()
90 return -EINVAL; in key_tx_spec_write()
93 return -EOPNOTSUPP; in key_tx_spec_write()
105 /* PN is a 48-bit counter */ in key_tx_spec_write()
107 return -ERANGE; in key_tx_spec_write()
108 atomic64_set(&key->conf.tx_pn, pn); in key_tx_spec_write()
121 struct ieee80211_key *key = file->private_data; in key_tx_spec_read() local
123 switch (key->conf.cipher) { in key_tx_spec_read()
129 pn = atomic64_read(&key->conf.tx_pn); in key_tx_spec_read()
142 pn = atomic64_read(&key->conf.tx_pn); in key_tx_spec_read()
157 struct ieee80211_key *key = file->private_data; in key_rx_spec_read() local
162 switch (key->conf.cipher) { in key_rx_spec_read()
169 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
171 key->u.tkip.rx[i].iv32, in key_rx_spec_read()
172 key->u.tkip.rx[i].iv16); in key_rx_spec_read()
173 len = p - buf; in key_rx_spec_read()
178 rpn = key->u.ccmp.rx_pn[i]; in key_rx_spec_read()
179 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
181 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
184 len = p - buf; in key_rx_spec_read()
188 rpn = key->u.aes_cmac.rx_pn; in key_rx_spec_read()
189 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
191 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
193 len = p - buf; in key_rx_spec_read()
197 rpn = key->u.aes_gmac.rx_pn; in key_rx_spec_read()
198 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
200 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
202 len = p - buf; in key_rx_spec_read()
207 rpn = key->u.gcmp.rx_pn[i]; in key_rx_spec_read()
208 p += scnprintf(p, sizeof(buf)+buf-p, in key_rx_spec_read()
210 rpn[0], rpn[1], rpn[2], in key_rx_spec_read()
213 len = p - buf; in key_rx_spec_read()
225 struct ieee80211_key *key = file->private_data; in key_replays_read() local
229 switch (key->conf.cipher) { in key_replays_read()
232 len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays); in key_replays_read()
237 key->u.aes_cmac.replays); in key_replays_read()
242 key->u.aes_gmac.replays); in key_replays_read()
246 len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays); in key_replays_read()
258 struct ieee80211_key *key = file->private_data; in key_icverrors_read() local
262 switch (key->conf.cipher) { in key_icverrors_read()
266 key->u.aes_cmac.icverrors); in key_icverrors_read()
271 key->u.aes_gmac.icverrors); in key_icverrors_read()
283 struct ieee80211_key *key = file->private_data; in key_mic_failures_read() local
287 if (key->conf.cipher != WLAN_CIPHER_SUITE_TKIP) in key_mic_failures_read()
288 return -EINVAL; in key_mic_failures_read()
290 len = scnprintf(buf, sizeof(buf), "%u\n", key->u.tkip.mic_failures); in key_mic_failures_read()
299 struct ieee80211_key *key = file->private_data; in key_key_read() local
300 int i, bufsize = 2 * key->conf.keylen + 2; in key_key_read()
306 return -ENOMEM; in key_key_read()
308 for (i = 0; i < key->conf.keylen; i++) in key_key_read()
309 p += scnprintf(p, bufsize + buf - p, "%02x", key->conf.key[i]); in key_key_read()
310 p += scnprintf(p, bufsize+buf-p, "\n"); in key_key_read()
311 res = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); in key_key_read()
315 KEY_OPS(key);
318 debugfs_create_file(#name, 0400, key->debugfs.dir, \
319 key, &key_##name##_ops)
321 debugfs_create_file(#name, 0600, key->debugfs.dir, \
322 key, &key_##name##_ops);
324 void ieee80211_debugfs_key_add(struct ieee80211_key *key) in ieee80211_debugfs_key_add() argument
330 if (!key->local->debugfs.keys) in ieee80211_debugfs_key_add()
334 key->debugfs.cnt = keycount; in ieee80211_debugfs_key_add()
336 key->debugfs.dir = debugfs_create_dir(buf, in ieee80211_debugfs_key_add()
337 key->local->debugfs.keys); in ieee80211_debugfs_key_add()
339 sta = key->sta; in ieee80211_debugfs_key_add()
342 sta->sdata->name, sta->sta.addr); in ieee80211_debugfs_key_add()
343 key->debugfs.stalink = in ieee80211_debugfs_key_add()
344 debugfs_create_symlink("station", key->debugfs.dir, buf); in ieee80211_debugfs_key_add()
357 DEBUGFS_ADD(key); in ieee80211_debugfs_key_add()
361 void ieee80211_debugfs_key_remove(struct ieee80211_key *key) in ieee80211_debugfs_key_remove() argument
363 if (!key) in ieee80211_debugfs_key_remove()
366 debugfs_remove_recursive(key->debugfs.dir); in ieee80211_debugfs_key_remove()
367 key->debugfs.dir = NULL; in ieee80211_debugfs_key_remove()
373 struct ieee80211_key *key; in ieee80211_debugfs_key_update_default() local
375 if (!sdata->vif.debugfs_dir) in ieee80211_debugfs_key_update_default()
378 lockdep_assert_wiphy(sdata->local->hw.wiphy); in ieee80211_debugfs_key_update_default()
380 debugfs_remove(sdata->debugfs.default_unicast_key); in ieee80211_debugfs_key_update_default()
381 sdata->debugfs.default_unicast_key = NULL; in ieee80211_debugfs_key_update_default()
383 if (sdata->default_unicast_key) { in ieee80211_debugfs_key_update_default()
384 key = wiphy_dereference(sdata->local->hw.wiphy, in ieee80211_debugfs_key_update_default()
385 sdata->default_unicast_key); in ieee80211_debugfs_key_update_default()
386 sprintf(buf, "../keys/%d", key->debugfs.cnt); in ieee80211_debugfs_key_update_default()
387 sdata->debugfs.default_unicast_key = in ieee80211_debugfs_key_update_default()
389 sdata->vif.debugfs_dir, buf); in ieee80211_debugfs_key_update_default()
392 debugfs_remove(sdata->debugfs.default_multicast_key); in ieee80211_debugfs_key_update_default()
393 sdata->debugfs.default_multicast_key = NULL; in ieee80211_debugfs_key_update_default()
395 if (sdata->deflink.default_multicast_key) { in ieee80211_debugfs_key_update_default()
396 key = wiphy_dereference(sdata->local->hw.wiphy, in ieee80211_debugfs_key_update_default()
397 sdata->deflink.default_multicast_key); in ieee80211_debugfs_key_update_default()
398 sprintf(buf, "../keys/%d", key->debugfs.cnt); in ieee80211_debugfs_key_update_default()
399 sdata->debugfs.default_multicast_key = in ieee80211_debugfs_key_update_default()
401 sdata->vif.debugfs_dir, buf); in ieee80211_debugfs_key_update_default()
410 debugfs_remove(sdata->debugfs.default_mgmt_key); in ieee80211_debugfs_key_remove_mgmt_default()
411 sdata->debugfs.default_mgmt_key = NULL; in ieee80211_debugfs_key_remove_mgmt_default()
420 debugfs_remove(sdata->debugfs.default_beacon_key); in ieee80211_debugfs_key_remove_beacon_default()
421 sdata->debugfs.default_beacon_key = NULL; in ieee80211_debugfs_key_remove_beacon_default()