ctx->initialized = 1;
 }
 
-static void tkip_mixing_phase2(const u16 *p1k, const u8 *tk, u16 tsc_IV16,
-                              u8 *rc4key)
+static void tkip_mixing_phase2(struct ieee80211_key *key, struct tkip_ctx *ctx,
+                              u16 tsc_IV16, u8 *rc4key)
 {
        u16 ppk[6];
+       const u16 *p1k = ctx->p1k;
+       const u8 *tk = &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY];
        int i;
 
        ppk[0] = p1k[0];
        if (key->u.tkip.tx.iv16 == 0 || !key->u.tkip.tx.initialized)
                tkip_mixing_phase1(key, ta, &key->u.tkip.tx, key->u.tkip.tx.iv32);
 
-       tkip_mixing_phase2(key->u.tkip.tx.p1k,
-                          &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY],
-                          key->u.tkip.tx.iv16, rc4key);
+       tkip_mixing_phase2(key, &key->u.tkip.tx, key->u.tkip.tx.iv16, rc4key);
 }
 
 void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
                return;
        }
 
-       tkip_mixing_phase2(key->u.tkip.tx.p1k,
-               &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY], iv16, outkey);
+       tkip_mixing_phase2(key, &key->u.tkip.tx, iv16, outkey);
 }
 EXPORT_SYMBOL(ieee80211_get_tkip_key);
 
                }
        }
 
-       tkip_mixing_phase2(key->u.tkip.rx[queue].p1k,
-                          &key->conf.key[ALG_TKIP_TEMP_ENCR_KEY],
-                          iv16, rc4key);
+       tkip_mixing_phase2(key, &key->u.tkip.rx[queue], iv16, rc4key);
 #ifdef CONFIG_TKIP_DEBUG
        {
                int i;