Lines Matching refs:tkey

286 	struct lib80211_tkip_data *tkey = priv;
298 if (!tkey->tx_phase1_done) {
299 tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
300 tkey->tx_iv32);
301 tkey->tx_phase1_done = 1;
303 tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
312 *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ;
313 *pos++ = tkey->tx_iv32 & 0xff;
314 *pos++ = (tkey->tx_iv32 >> 8) & 0xff;
315 *pos++ = (tkey->tx_iv32 >> 16) & 0xff;
316 *pos++ = (tkey->tx_iv32 >> 24) & 0xff;
318 tkey->tx_iv16++;
319 if (tkey->tx_iv16 == 0) {
320 tkey->tx_phase1_done = 0;
321 tkey->tx_iv32++;
329 struct lib80211_tkip_data *tkey = priv;
334 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
357 arc4_setkey(&tkey->tx_ctx_arc4, rc4key, 16);
358 arc4_crypt(&tkey->tx_ctx_arc4, pos, pos, len + 4);
378 struct lib80211_tkip_data *tkey = priv;
390 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) {
407 if (tkey->key_idx != keyidx) {
408 net_dbg_ratelimited("TKIP: RX tkey->key_idx=%d frame keyidx=%d\n",
409 tkey->key_idx, keyidx);
412 if (!tkey->key_set) {
421 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) {
424 hdr->addr2, tkey->rx_iv32, tkey->rx_iv16,
427 tkey->dot11RSNAStatsTKIPReplays++;
431 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
432 tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
433 tkey->rx_phase1_done = 1;
435 tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
439 arc4_setkey(&tkey->rx_ctx_arc4, rc4key, 16);
440 arc4_crypt(&tkey->rx_ctx_arc4, pos, pos, plen + 4);
448 if (iv32 != tkey->rx_iv32) {
451 tkey->rx_phase1_done = 0;
457 tkey->dot11RSNAStatsTKIPICVErrors++;
463 tkey->rx_iv32_new = iv32;
464 tkey->rx_iv16_new = iv16;
544 struct lib80211_tkip_data *tkey = priv;
554 michael_mic_hdr(skb, tkey->tx_hdr);
556 if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
587 struct lib80211_tkip_data *tkey = priv;
590 if (!tkey->key_set)
593 michael_mic_hdr(skb, tkey->rx_hdr);
594 if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
606 tkey->dot11RSNAStatsTKIPLocalMICFailures++;
612 tkey->rx_iv32 = tkey->rx_iv32_new;
613 tkey->rx_iv16 = tkey->rx_iv16_new;
622 struct lib80211_tkip_data *tkey = priv;
624 struct crypto_shash *tfm = tkey->tx_tfm_michael;
625 struct arc4_ctx *tfm2 = &tkey->tx_ctx_arc4;
626 struct crypto_shash *tfm3 = tkey->rx_tfm_michael;
627 struct arc4_ctx *tfm4 = &tkey->rx_ctx_arc4;
629 keyidx = tkey->key_idx;
630 memset(tkey, 0, sizeof(*tkey));
631 tkey->key_idx = keyidx;
632 tkey->tx_tfm_michael = tfm;
633 tkey->tx_ctx_arc4 = *tfm2;
634 tkey->rx_tfm_michael = tfm3;
635 tkey->rx_ctx_arc4 = *tfm4;
637 memcpy(tkey->key, key, TKIP_KEY_LEN);
638 tkey->key_set = 1;
639 tkey->tx_iv16 = 1; /* TSC is initialized to 1 */
641 tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) |
643 tkey->rx_iv16 = (seq[1] << 8) | seq[0];
646 tkey->key_set = 0;
655 struct lib80211_tkip_data *tkey = priv;
660 if (!tkey->key_set)
662 memcpy(key, tkey->key, TKIP_KEY_LEN);
666 u16 iv16 = tkey->tx_iv16;
667 u32 iv32 = tkey->tx_iv32;
671 seq[0] = tkey->tx_iv16;
672 seq[1] = tkey->tx_iv16 >> 8;
673 seq[2] = tkey->tx_iv32;
674 seq[3] = tkey->tx_iv32 >> 8;
675 seq[4] = tkey->tx_iv32 >> 16;
676 seq[5] = tkey->tx_iv32 >> 24;