Blame view
net/mac80211/key.h
4.68 KB
d2912cb15 treewide: Replace... |
1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
f0706e828 [MAC80211]: Add m... |
2 3 4 |
/* * Copyright 2002-2004, Instant802 Networks, Inc. * Copyright 2005, Devicescape Software, Inc. |
624ff4b21 mac80211: clear c... |
5 |
* Copyright (C) 2019 Intel Corporation |
f0706e828 [MAC80211]: Add m... |
6 7 8 9 10 11 |
*/ #ifndef IEEE80211_KEY_H #define IEEE80211_KEY_H #include <linux/types.h> |
8f37171a6 [MAC80211]: remov... |
12 |
#include <linux/list.h> |
f0706e828 [MAC80211]: Add m... |
13 |
#include <linux/crypto.h> |
db4d1169d mac80211: split i... |
14 |
#include <linux/rcupdate.h> |
5fdb37357 net/mac80211: mov... |
15 |
#include <crypto/arc4.h> |
f0706e828 [MAC80211]: Add m... |
16 |
#include <net/mac80211.h> |
e31b82136 cfg80211/mac80211... |
17 18 |
#define NUM_DEFAULT_KEYS 4 #define NUM_DEFAULT_MGMT_KEYS 2 |
e5473e80d mac80211: Support... |
19 |
#define NUM_DEFAULT_BEACON_KEYS 2 |
96fc6efb9 mac80211: IEEE 80... |
20 |
#define INVALID_PTK_KEYIDX 2 /* Keyidx always pointing to a NULL key for PTK */ |
e31b82136 cfg80211/mac80211... |
21 |
|
11a843b7e [MAC80211]: rewor... |
22 23 24 |
struct ieee80211_local; struct ieee80211_sub_if_data; struct sta_info; |
db4d1169d mac80211: split i... |
25 26 27 28 29 |
/** * enum ieee80211_internal_key_flags - internal key flags * * @KEY_FLAG_UPLOADED_TO_HARDWARE: Indicates that this key is present * in the hardware for TX crypto hardware acceleration. |
95acac61b mac80211: allow d... |
30 |
* @KEY_FLAG_TAINTED: Key is tainted and packets should be dropped. |
c7ef38e0c mac80211: Get IV ... |
31 |
* @KEY_FLAG_CIPHER_SCHEME: This key is for a hardware cipher scheme |
db4d1169d mac80211: split i... |
32 33 34 |
*/ enum ieee80211_internal_key_flags { KEY_FLAG_UPLOADED_TO_HARDWARE = BIT(0), |
95acac61b mac80211: allow d... |
35 |
KEY_FLAG_TAINTED = BIT(1), |
c7ef38e0c mac80211: Get IV ... |
36 |
KEY_FLAG_CIPHER_SCHEME = BIT(2), |
db4d1169d mac80211: split i... |
37 |
}; |
11a843b7e [MAC80211]: rewor... |
38 |
|
ca99861d5 mac80211 : fix a ... |
39 40 41 42 43 |
enum ieee80211_internal_tkip_state { TKIP_STATE_NOT_INIT, TKIP_STATE_PHASE1_DONE, TKIP_STATE_PHASE1_HW_UPLOADED, }; |
b0f76b335 mac80211: add a s... |
44 |
struct tkip_ctx { |
523b02ea2 mac80211: fix TKI... |
45 46 |
u16 p1k[5]; /* p1k cache */ u32 p1k_iv32; /* iv32 for which p1k computed */ |
ca99861d5 mac80211 : fix a ... |
47 |
enum ieee80211_internal_tkip_state state; |
b0f76b335 mac80211: add a s... |
48 |
}; |
f8079d43c mac80211: move TK... |
49 50 51 52 53 |
struct tkip_ctx_rx { struct tkip_ctx ctx; u32 iv32; /* current iv32 */ u16 iv16; /* current iv16 */ }; |
f0706e828 [MAC80211]: Add m... |
54 |
struct ieee80211_key { |
11a843b7e [MAC80211]: rewor... |
55 56 57 |
struct ieee80211_local *local; struct ieee80211_sub_if_data *sdata; struct sta_info *sta; |
3b96766f0 mac80211: fix key... |
58 |
/* for sdata list */ |
11a843b7e [MAC80211]: rewor... |
59 |
struct list_head list; |
ad0e2b5a0 mac80211: simplif... |
60 |
/* protected by key mutex */ |
11a843b7e [MAC80211]: rewor... |
61 |
unsigned int flags; |
f0706e828 [MAC80211]: Add m... |
62 63 |
union { struct { |
523b02ea2 mac80211: fix TKI... |
64 65 |
/* protects tx context */ spinlock_t txlock; |
f0706e828 [MAC80211]: Add m... |
66 |
/* last used TSC */ |
b0f76b335 mac80211: add a s... |
67 |
struct tkip_ctx tx; |
f0706e828 [MAC80211]: Add m... |
68 69 |
/* last received RSC */ |
f8079d43c mac80211: move TK... |
70 |
struct tkip_ctx_rx rx[IEEE80211_NUM_TIDS]; |
b98ea0586 mac80211: add deb... |
71 72 73 |
/* number of mic failures */ u32 mic_failures; |
f0706e828 [MAC80211]: Add m... |
74 75 |
} tkip; struct { |
9190252c9 mac80211: Use a s... |
76 77 |
/* * Last received packet number. The first |
5a306f588 mac80211: introdu... |
78 |
* IEEE80211_NUM_TIDS counters are used with Data |
9190252c9 mac80211: Use a s... |
79 80 81 |
* frames and the last counter is used with Robust * Management frames. */ |
4325f6caa wireless: move cr... |
82 |
u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN]; |
7ec7c4a9a mac80211: port CC... |
83 |
struct crypto_aead *tfm; |
f0706e828 [MAC80211]: Add m... |
84 |
u32 replays; /* dot11RSNAStatsCCMPReplays */ |
f0706e828 [MAC80211]: Add m... |
85 |
} ccmp; |
765cb46a3 mac80211: 802.11w... |
86 |
struct { |
4325f6caa wireless: move cr... |
87 |
u8 rx_pn[IEEE80211_CMAC_PN_LEN]; |
26717828b mac80211: aes-cma... |
88 |
struct crypto_shash *tfm; |
765cb46a3 mac80211: 802.11w... |
89 90 |
u32 replays; /* dot11RSNAStatsCMACReplays */ u32 icverrors; /* dot11RSNAStatsCMACICVErrors */ |
765cb46a3 mac80211: 802.11w... |
91 |
} aes_cmac; |
2475b1cc0 mac80211: add gen... |
92 |
struct { |
8ade538bf mac80111: Add BIP... |
93 94 95 96 97 98 |
u8 rx_pn[IEEE80211_GMAC_PN_LEN]; struct crypto_aead *tfm; u32 replays; /* dot11RSNAStatsCMACReplays */ u32 icverrors; /* dot11RSNAStatsCMACICVErrors */ } aes_gmac; struct { |
00b9cfa3f mac80111: Add GCM... |
99 100 101 102 103 104 105 106 107 108 |
/* Last received packet number. The first * IEEE80211_NUM_TIDS counters are used with Data * frames and the last counter is used with Robust * Management frames. */ u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_GCMP_PN_LEN]; struct crypto_aead *tfm; u32 replays; /* dot11RSNAStatsGCMPReplays */ } gcmp; struct { |
2475b1cc0 mac80211: add gen... |
109 |
/* generic cipher scheme */ |
a31cf1c69 mac80211: extend ... |
110 |
u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_MAX_PN_LEN]; |
2475b1cc0 mac80211: add gen... |
111 |
} gen; |
f0706e828 [MAC80211]: Add m... |
112 |
} u; |
f0706e828 [MAC80211]: Add m... |
113 |
|
e9f207f0f [MAC80211]: Add d... |
114 115 116 117 |
#ifdef CONFIG_MAC80211_DEBUGFS struct { struct dentry *stalink; struct dentry *dir; |
d9c58f30b mac80211: fix key... |
118 |
int cnt; |
e9f207f0f [MAC80211]: Add d... |
119 120 |
} debugfs; #endif |
8f20fc249 [MAC80211]: embed... |
121 122 123 124 125 |
/* * key config, must be last because it contains key * material as variable length member */ struct ieee80211_key_conf conf; |
f0706e828 [MAC80211]: Add m... |
126 |
}; |
2475b1cc0 mac80211: add gen... |
127 128 129 130 131 |
struct ieee80211_key * ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, const u8 *key_data, size_t seq_len, const u8 *seq, const struct ieee80211_cipher_scheme *cs); |
db4d1169d mac80211: split i... |
132 133 |
/* * Insert a key into data structures (sdata, sta if necessary) |
79cf2dfa3 mac80211: clean u... |
134 |
* to make it used, free old key. On failure, also free the new key. |
db4d1169d mac80211: split i... |
135 |
*/ |
79cf2dfa3 mac80211: clean u... |
136 137 138 |
int ieee80211_key_link(struct ieee80211_key *key, struct ieee80211_sub_if_data *sdata, struct sta_info *sta); |
96fc6efb9 mac80211: IEEE 80... |
139 |
int ieee80211_set_tx_key(struct ieee80211_key *key); |
3b8d9c290 mac80211: remove ... |
140 |
void ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom); |
79cf2dfa3 mac80211: clean u... |
141 |
void ieee80211_key_free_unused(struct ieee80211_key *key); |
f7e0104c1 mac80211: support... |
142 143 |
void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, bool uni, bool multi); |
3cfcf6ac6 mac80211: 802.11w... |
144 145 |
void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, int idx); |
e5473e80d mac80211: Support... |
146 147 |
void ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata, int idx); |
7907c7d33 mac80211: free al... |
148 149 |
void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, bool force_synchronize); |
6d10e46be mac80211: batch k... |
150 151 |
void ieee80211_free_sta_keys(struct ieee80211_local *local, struct sta_info *sta); |
624ff4b21 mac80211: clear c... |
152 |
void ieee80211_reenable_keys(struct ieee80211_sub_if_data *sdata); |
11a843b7e [MAC80211]: rewor... |
153 |
|
40b275b69 mac80211: sparse ... |
154 155 |
#define key_mtx_dereference(local, ref) \ rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) |
8d1f7ecd2 mac80211: defer t... |
156 |
void ieee80211_delayed_tailroom_dec(struct work_struct *wk); |
f0706e828 [MAC80211]: Add m... |
157 |
#endif /* IEEE80211_KEY_H */ |