mac80211: fix remain_off_channel regression
[pandora-kernel.git] / net / mac80211 / key.h
index d801d53..7d4e31f 100644 (file)
@@ -28,8 +28,9 @@
 #define CCMP_PN_LEN            6
 #define TKIP_IV_LEN            8
 #define TKIP_ICV_LEN           4
+#define CMAC_PN_LEN            6
 
-#define NUM_RX_DATA_QUEUES     17
+#define NUM_RX_DATA_QUEUES     16
 
 struct ieee80211_local;
 struct ieee80211_sub_if_data;
@@ -40,9 +41,11 @@ struct sta_info;
  *
  * @KEY_FLAG_UPLOADED_TO_HARDWARE: Indicates that this key is present
  *     in the hardware for TX crypto hardware acceleration.
+ * @KEY_FLAG_TAINTED: Key is tainted and packets should be dropped.
  */
 enum ieee80211_internal_key_flags {
        KEY_FLAG_UPLOADED_TO_HARDWARE   = BIT(0),
+       KEY_FLAG_TAINTED                = BIT(1),
 };
 
 enum ieee80211_internal_tkip_state {
@@ -52,9 +55,10 @@ enum ieee80211_internal_tkip_state {
 };
 
 struct tkip_ctx {
-       u32 iv32;
-       u16 iv16;
-       u16 p1k[5];
+       u32 iv32;       /* current iv32 */
+       u16 iv16;       /* current iv16 */
+       u16 p1k[5];     /* p1k cache */
+       u32 p1k_iv32;   /* iv32 for which p1k computed */
        enum ieee80211_internal_tkip_state state;
 };
 
@@ -71,6 +75,9 @@ struct ieee80211_key {
 
        union {
                struct {
+                       /* protects tx context */
+                       spinlock_t txlock;
+
                        /* last used TSC */
                        struct tkip_ctx tx;
 
@@ -78,32 +85,23 @@ struct ieee80211_key {
                        struct tkip_ctx rx[NUM_RX_DATA_QUEUES];
                } tkip;
                struct {
-                       u8 tx_pn[6];
+                       atomic64_t tx_pn;
                        /*
                         * Last received packet number. The first
                         * NUM_RX_DATA_QUEUES counters are used with Data
                         * frames and the last counter is used with Robust
                         * Management frames.
                         */
-                       u8 rx_pn[NUM_RX_DATA_QUEUES + 1][6];
+                       u8 rx_pn[NUM_RX_DATA_QUEUES + 1][CCMP_PN_LEN];
                        struct crypto_cipher *tfm;
                        u32 replays; /* dot11RSNAStatsCCMPReplays */
-                       /* scratch buffers for virt_to_page() (crypto API) */
-#ifndef AES_BLOCK_LEN
-#define AES_BLOCK_LEN 16
-#endif
-                       u8 tx_crypto_buf[6 * AES_BLOCK_LEN];
-                       u8 rx_crypto_buf[6 * AES_BLOCK_LEN];
                } ccmp;
                struct {
-                       u8 tx_pn[6];
-                       u8 rx_pn[6];
+                       atomic64_t tx_pn;
+                       u8 rx_pn[CMAC_PN_LEN];
                        struct crypto_cipher *tfm;
                        u32 replays; /* dot11RSNAStatsCMACReplays */
                        u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
-                       /* scratch buffers for virt_to_page() (crypto API) */
-                       u8 tx_crypto_buf[2 * AES_BLOCK_LEN];
-                       u8 rx_crypto_buf[2 * AES_BLOCK_LEN];
                } aes_cmac;
        } u;