diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-08-10 03:46:38 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-08-16 16:45:11 -0400 |
commit | 97359d1235eaf634fe706c9faa6e40181cc95fb8 (patch) | |
tree | 5799455c94622eaa6a4fb065bd3b5c350bb705e0 /net/mac80211/key.c | |
parent | 915a824e30c503157c38115eb6a85f60bb653738 (diff) |
mac80211: use cipher suite selectors
Currently, mac80211 translates the cfg80211
cipher suite selectors into ALG_* values.
That isn't all too useful, and some drivers
benefit from the distinction between WEP40
and WEP104 as well. Therefore, convert it
all to use the cipher suite selectors.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r-- | net/mac80211/key.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index d6dbc8ea4ead..3203d1d3cd38 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -227,9 +227,7 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, | |||
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
230 | struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, | 230 | struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, |
231 | int idx, | ||
232 | size_t key_len, | ||
233 | const u8 *key_data, | 231 | const u8 *key_data, |
234 | size_t seq_len, const u8 *seq) | 232 | size_t seq_len, const u8 *seq) |
235 | { | 233 | { |
@@ -249,15 +247,16 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, | |||
249 | key->conf.flags = 0; | 247 | key->conf.flags = 0; |
250 | key->flags = 0; | 248 | key->flags = 0; |
251 | 249 | ||
252 | key->conf.alg = alg; | 250 | key->conf.cipher = cipher; |
253 | key->conf.keyidx = idx; | 251 | key->conf.keyidx = idx; |
254 | key->conf.keylen = key_len; | 252 | key->conf.keylen = key_len; |
255 | switch (alg) { | 253 | switch (cipher) { |
256 | case ALG_WEP: | 254 | case WLAN_CIPHER_SUITE_WEP40: |
255 | case WLAN_CIPHER_SUITE_WEP104: | ||
257 | key->conf.iv_len = WEP_IV_LEN; | 256 | key->conf.iv_len = WEP_IV_LEN; |
258 | key->conf.icv_len = WEP_ICV_LEN; | 257 | key->conf.icv_len = WEP_ICV_LEN; |
259 | break; | 258 | break; |
260 | case ALG_TKIP: | 259 | case WLAN_CIPHER_SUITE_TKIP: |
261 | key->conf.iv_len = TKIP_IV_LEN; | 260 | key->conf.iv_len = TKIP_IV_LEN; |
262 | key->conf.icv_len = TKIP_ICV_LEN; | 261 | key->conf.icv_len = TKIP_ICV_LEN; |
263 | if (seq) { | 262 | if (seq) { |
@@ -269,7 +268,7 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, | |||
269 | } | 268 | } |
270 | } | 269 | } |
271 | break; | 270 | break; |
272 | case ALG_CCMP: | 271 | case WLAN_CIPHER_SUITE_CCMP: |
273 | key->conf.iv_len = CCMP_HDR_LEN; | 272 | key->conf.iv_len = CCMP_HDR_LEN; |
274 | key->conf.icv_len = CCMP_MIC_LEN; | 273 | key->conf.icv_len = CCMP_MIC_LEN; |
275 | if (seq) { | 274 | if (seq) { |
@@ -279,7 +278,7 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, | |||
279 | seq[CCMP_PN_LEN - j - 1]; | 278 | seq[CCMP_PN_LEN - j - 1]; |
280 | } | 279 | } |
281 | break; | 280 | break; |
282 | case ALG_AES_CMAC: | 281 | case WLAN_CIPHER_SUITE_AES_CMAC: |
283 | key->conf.iv_len = 0; | 282 | key->conf.iv_len = 0; |
284 | key->conf.icv_len = sizeof(struct ieee80211_mmie); | 283 | key->conf.icv_len = sizeof(struct ieee80211_mmie); |
285 | if (seq) | 284 | if (seq) |
@@ -290,7 +289,7 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, | |||
290 | memcpy(key->conf.key, key_data, key_len); | 289 | memcpy(key->conf.key, key_data, key_len); |
291 | INIT_LIST_HEAD(&key->list); | 290 | INIT_LIST_HEAD(&key->list); |
292 | 291 | ||
293 | if (alg == ALG_CCMP) { | 292 | if (cipher == WLAN_CIPHER_SUITE_CCMP) { |
294 | /* | 293 | /* |
295 | * Initialize AES key state here as an optimization so that | 294 | * Initialize AES key state here as an optimization so that |
296 | * it does not need to be initialized for every packet. | 295 | * it does not need to be initialized for every packet. |
@@ -303,7 +302,7 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, | |||
303 | } | 302 | } |
304 | } | 303 | } |
305 | 304 | ||
306 | if (alg == ALG_AES_CMAC) { | 305 | if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) { |
307 | /* | 306 | /* |
308 | * Initialize AES key state here as an optimization so that | 307 | * Initialize AES key state here as an optimization so that |
309 | * it does not need to be initialized for every packet. | 308 | * it does not need to be initialized for every packet. |
@@ -328,9 +327,9 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key) | |||
328 | if (key->local) | 327 | if (key->local) |
329 | ieee80211_key_disable_hw_accel(key); | 328 | ieee80211_key_disable_hw_accel(key); |
330 | 329 | ||
331 | if (key->conf.alg == ALG_CCMP) | 330 | if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP) |
332 | ieee80211_aes_key_free(key->u.ccmp.tfm); | 331 | ieee80211_aes_key_free(key->u.ccmp.tfm); |
333 | if (key->conf.alg == ALG_AES_CMAC) | 332 | if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC) |
334 | ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); | 333 | ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); |
335 | if (key->local) | 334 | if (key->local) |
336 | ieee80211_debugfs_key_remove(key); | 335 | ieee80211_debugfs_key_remove(key); |