diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-08-10 03:46:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-08-16 16:45:20 -0400 |
commit | 60ae0f20058d19ada94093dc3ef7ae0737597fba (patch) | |
tree | 2428c7561d8f7927bb79ddc96f0d448070873454 /net | |
parent | 97359d1235eaf634fe706c9faa6e40181cc95fb8 (diff) |
mac80211: move key tfm setup
There's no need to keep separate if statements
for setting up the CCMP/AES-CMAC tfm structs;
move that into the existing switch statement.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/key.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 3203d1d3cd38..9c27c53cfae5 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -277,19 +277,6 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
277 | key->u.ccmp.rx_pn[i][j] = | 277 | key->u.ccmp.rx_pn[i][j] = |
278 | seq[CCMP_PN_LEN - j - 1]; | 278 | seq[CCMP_PN_LEN - j - 1]; |
279 | } | 279 | } |
280 | break; | ||
281 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
282 | key->conf.iv_len = 0; | ||
283 | key->conf.icv_len = sizeof(struct ieee80211_mmie); | ||
284 | if (seq) | ||
285 | for (j = 0; j < 6; j++) | ||
286 | key->u.aes_cmac.rx_pn[j] = seq[6 - j - 1]; | ||
287 | break; | ||
288 | } | ||
289 | memcpy(key->conf.key, key_data, key_len); | ||
290 | INIT_LIST_HEAD(&key->list); | ||
291 | |||
292 | if (cipher == WLAN_CIPHER_SUITE_CCMP) { | ||
293 | /* | 280 | /* |
294 | * Initialize AES key state here as an optimization so that | 281 | * Initialize AES key state here as an optimization so that |
295 | * it does not need to be initialized for every packet. | 282 | * it does not need to be initialized for every packet. |
@@ -300,9 +287,13 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
300 | kfree(key); | 287 | kfree(key); |
301 | key = ERR_PTR(err); | 288 | key = ERR_PTR(err); |
302 | } | 289 | } |
303 | } | 290 | break; |
304 | 291 | case WLAN_CIPHER_SUITE_AES_CMAC: | |
305 | if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) { | 292 | key->conf.iv_len = 0; |
293 | key->conf.icv_len = sizeof(struct ieee80211_mmie); | ||
294 | if (seq) | ||
295 | for (j = 0; j < 6; j++) | ||
296 | key->u.aes_cmac.rx_pn[j] = seq[6 - j - 1]; | ||
306 | /* | 297 | /* |
307 | * Initialize AES key state here as an optimization so that | 298 | * Initialize AES key state here as an optimization so that |
308 | * it does not need to be initialized for every packet. | 299 | * it does not need to be initialized for every packet. |
@@ -314,7 +305,10 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, | |||
314 | kfree(key); | 305 | kfree(key); |
315 | key = ERR_PTR(err); | 306 | key = ERR_PTR(err); |
316 | } | 307 | } |
308 | break; | ||
317 | } | 309 | } |
310 | memcpy(key->conf.key, key_data, key_len); | ||
311 | INIT_LIST_HEAD(&key->list); | ||
318 | 312 | ||
319 | return key; | 313 | return key; |
320 | } | 314 | } |