]> Pileus Git - ~andy/linux/blobdiff - net/mac80211/tkip.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[~andy/linux] / net / mac80211 / tkip.c
index b9c1d54051809bd584b7213d4b0de04c876bb562..3abe194e4d55328ae61aba0bdcd1515a299212fd 100644 (file)
@@ -238,7 +238,8 @@ void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
 int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
                                struct ieee80211_key *key,
                                u8 *payload, size_t payload_len, u8 *ta,
-                               int only_iv, int queue)
+                               int only_iv, int queue,
+                               u32 *out_iv32, u16 *out_iv16)
 {
        u32 iv32;
        u32 iv16;
@@ -275,9 +276,10 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
             (iv32 == key->u.tkip.iv32_rx[queue] &&
              iv16 <= key->u.tkip.iv16_rx[queue]))) {
 #ifdef CONFIG_TKIP_DEBUG
+               DECLARE_MAC_BUF(mac);
                printk(KERN_DEBUG "TKIP replay detected for RX frame from "
-                      MAC_FMT " (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
-                      MAC_ARG(ta),
+                      "%s (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
+                      print_mac(mac, ta),
                       iv32, iv16, key->u.tkip.iv32_rx[queue],
                       key->u.tkip.iv16_rx[queue]);
 #endif /* CONFIG_TKIP_DEBUG */
@@ -299,8 +301,9 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
 #ifdef CONFIG_TKIP_DEBUG
                {
                        int i;
-                       printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=" MAC_FMT
-                              " TK=", MAC_ARG(ta));
+                       DECLARE_MAC_BUF(mac);
+                       printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%s"
+                              " TK=", print_mac(mac, ta));
                        for (i = 0; i < 16; i++)
                                printk("%02x ",
                                       key->conf.key[
@@ -330,11 +333,14 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
        res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12);
  done:
        if (res == TKIP_DECRYPT_OK) {
-               /* FIX: these should be updated only after Michael MIC has been
-                * verified */
-               /* Record previously received IV */
-               key->u.tkip.iv32_rx[queue] = iv32;
-               key->u.tkip.iv16_rx[queue] = iv16;
+               /*
+                * Record previously received IV, will be copied into the
+                * key information after MIC verification. It is possible
+                * that we don't catch replays of fragments but that's ok
+                * because the Michael MIC verication will then fail.
+                */
+               *out_iv32 = iv32;
+               *out_iv16 = iv16;
        }
 
        return res;