提交 60ae0f20 编写于 作者: J Johannes Berg 提交者: John W. Linville

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: NJohannes Berg <johannes.berg@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 97359d12
...@@ -277,19 +277,6 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, ...@@ -277,19 +277,6 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
key->u.ccmp.rx_pn[i][j] = key->u.ccmp.rx_pn[i][j] =
seq[CCMP_PN_LEN - j - 1]; seq[CCMP_PN_LEN - j - 1];
} }
break;
case WLAN_CIPHER_SUITE_AES_CMAC:
key->conf.iv_len = 0;
key->conf.icv_len = sizeof(struct ieee80211_mmie);
if (seq)
for (j = 0; j < 6; j++)
key->u.aes_cmac.rx_pn[j] = seq[6 - j - 1];
break;
}
memcpy(key->conf.key, key_data, key_len);
INIT_LIST_HEAD(&key->list);
if (cipher == WLAN_CIPHER_SUITE_CCMP) {
/* /*
* Initialize AES key state here as an optimization so that * Initialize AES key state here as an optimization so that
* it does not need to be initialized for every packet. * 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,9 +287,13 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
kfree(key); kfree(key);
key = ERR_PTR(err); key = ERR_PTR(err);
} }
} break;
case WLAN_CIPHER_SUITE_AES_CMAC:
if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) { key->conf.iv_len = 0;
key->conf.icv_len = sizeof(struct ieee80211_mmie);
if (seq)
for (j = 0; j < 6; j++)
key->u.aes_cmac.rx_pn[j] = seq[6 - j - 1];
/* /*
* Initialize AES key state here as an optimization so that * Initialize AES key state here as an optimization so that
* it does not need to be initialized for every packet. * 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,7 +305,10 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
kfree(key); kfree(key);
key = ERR_PTR(err); key = ERR_PTR(err);
} }
break;
} }
memcpy(key->conf.key, key_data, key_len);
INIT_LIST_HEAD(&key->list);
return key; return key;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册