|
@@ -49,8 +49,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
|
|
!(tx->flags & IEEE80211_TX_FRAGMENTED) &&
|
|
!(tx->flags & IEEE80211_TX_FRAGMENTED) &&
|
|
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) &&
|
|
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) &&
|
|
!wpa_test) {
|
|
!wpa_test) {
|
|
- /* hwaccel - with no need for preallocated room for Michael MIC
|
|
|
|
- */
|
|
|
|
|
|
+ /* hwaccel - with no need for preallocated room for MMIC */
|
|
return TX_CONTINUE;
|
|
return TX_CONTINUE;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -67,8 +66,6 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
|
|
#else
|
|
#else
|
|
authenticator = 1;
|
|
authenticator = 1;
|
|
#endif
|
|
#endif
|
|
- /* At this point we know we're using ALG_TKIP. To get the MIC key
|
|
|
|
- * we now will rely on the offset from the ieee80211_key_conf::key */
|
|
|
|
key_offset = authenticator ?
|
|
key_offset = authenticator ?
|
|
NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY :
|
|
NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY :
|
|
NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY;
|
|
NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY;
|
|
@@ -91,9 +88,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
|
|
struct sk_buff *skb = rx->skb;
|
|
struct sk_buff *skb = rx->skb;
|
|
int authenticator = 1, wpa_test = 0;
|
|
int authenticator = 1, wpa_test = 0;
|
|
|
|
|
|
- /*
|
|
|
|
- * No way to verify the MIC if the hardware stripped it
|
|
|
|
- */
|
|
|
|
|
|
+ /* No way to verify the MIC if the hardware stripped it */
|
|
if (rx->status->flag & RX_FLAG_MMIC_STRIPPED)
|
|
if (rx->status->flag & RX_FLAG_MMIC_STRIPPED)
|
|
return RX_CONTINUE;
|
|
return RX_CONTINUE;
|
|
|
|
|
|
@@ -115,8 +110,6 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
|
|
#else
|
|
#else
|
|
authenticator = 1;
|
|
authenticator = 1;
|
|
#endif
|
|
#endif
|
|
- /* At this point we know we're using ALG_TKIP. To get the MIC key
|
|
|
|
- * we now will rely on the offset from the ieee80211_key_conf::key */
|
|
|
|
key_offset = authenticator ?
|
|
key_offset = authenticator ?
|
|
NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY :
|
|
NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY :
|
|
NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY;
|
|
NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY;
|
|
@@ -201,6 +194,7 @@ ieee80211_tx_result
|
|
ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
|
|
ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
|
|
{
|
|
{
|
|
struct sk_buff *skb = tx->skb;
|
|
struct sk_buff *skb = tx->skb;
|
|
|
|
+ int i;
|
|
|
|
|
|
ieee80211_tx_set_protected(tx);
|
|
ieee80211_tx_set_protected(tx);
|
|
|
|
|
|
@@ -208,9 +202,8 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
|
|
return TX_DROP;
|
|
return TX_DROP;
|
|
|
|
|
|
if (tx->extra_frag) {
|
|
if (tx->extra_frag) {
|
|
- int i;
|
|
|
|
for (i = 0; i < tx->num_extra_frag; i++) {
|
|
for (i = 0; i < tx->num_extra_frag; i++) {
|
|
- if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0)
|
|
|
|
|
|
+ if (tkip_encrypt_skb(tx, tx->extra_frag[i]))
|
|
return TX_DROP;
|
|
return TX_DROP;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -348,7 +341,7 @@ static inline void ccmp_pn2hdr(u8 *hdr, u8 *pn, int key_id)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
|
|
|
|
|
|
+static inline void ccmp_hdr2pn(u8 *pn, u8 *hdr)
|
|
{
|
|
{
|
|
pn[0] = hdr[7];
|
|
pn[0] = hdr[7];
|
|
pn[1] = hdr[6];
|
|
pn[1] = hdr[6];
|
|
@@ -356,7 +349,6 @@ static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
|
|
pn[3] = hdr[4];
|
|
pn[3] = hdr[4];
|
|
pn[4] = hdr[1];
|
|
pn[4] = hdr[1];
|
|
pn[5] = hdr[0];
|
|
pn[5] = hdr[0];
|
|
- return (hdr[3] >> 6) & 0x03;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -371,7 +363,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
|
|
|
|
|
|
if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
|
|
if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
|
|
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
|
|
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
|
|
- /* hwaccel - with no need for preallocated room for CCMP "
|
|
|
|
|
|
+ /* hwaccel - with no need for preallocated room for CCMP
|
|
* header or MIC fields */
|
|
* header or MIC fields */
|
|
info->control.hw_key = &tx->key->conf;
|
|
info->control.hw_key = &tx->key->conf;
|
|
return 0;
|
|
return 0;
|
|
@@ -424,6 +416,7 @@ ieee80211_tx_result
|
|
ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
|
|
ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
|
|
{
|
|
{
|
|
struct sk_buff *skb = tx->skb;
|
|
struct sk_buff *skb = tx->skb;
|
|
|
|
+ int i;
|
|
|
|
|
|
ieee80211_tx_set_protected(tx);
|
|
ieee80211_tx_set_protected(tx);
|
|
|
|
|
|
@@ -431,9 +424,8 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
|
|
return TX_DROP;
|
|
return TX_DROP;
|
|
|
|
|
|
if (tx->extra_frag) {
|
|
if (tx->extra_frag) {
|
|
- int i;
|
|
|
|
for (i = 0; i < tx->num_extra_frag; i++) {
|
|
for (i = 0; i < tx->num_extra_frag; i++) {
|
|
- if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0)
|
|
|
|
|
|
+ if (ccmp_encrypt_skb(tx, tx->extra_frag[i]))
|
|
return TX_DROP;
|
|
return TX_DROP;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -465,7 +457,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
|
|
(rx->status->flag & RX_FLAG_IV_STRIPPED))
|
|
(rx->status->flag & RX_FLAG_IV_STRIPPED))
|
|
return RX_CONTINUE;
|
|
return RX_CONTINUE;
|
|
|
|
|
|
- (void) ccmp_hdr2pn(pn, skb->data + hdrlen);
|
|
|
|
|
|
+ ccmp_hdr2pn(pn, skb->data + hdrlen);
|
|
|
|
|
|
if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) {
|
|
if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) {
|
|
key->u.ccmp.replays++;
|
|
key->u.ccmp.replays++;
|
|
@@ -480,9 +472,8 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
|
|
key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf,
|
|
key->u.ccmp.tfm, key->u.ccmp.rx_crypto_buf,
|
|
skb->data + hdrlen + CCMP_HDR_LEN, data_len,
|
|
skb->data + hdrlen + CCMP_HDR_LEN, data_len,
|
|
skb->data + skb->len - CCMP_MIC_LEN,
|
|
skb->data + skb->len - CCMP_MIC_LEN,
|
|
- skb->data + hdrlen + CCMP_HDR_LEN)) {
|
|
|
|
|
|
+ skb->data + hdrlen + CCMP_HDR_LEN))
|
|
return RX_DROP_UNUSABLE;
|
|
return RX_DROP_UNUSABLE;
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN);
|
|
memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN);
|